/** * Add an XSAttributeDeclaration */ public void addXSAttributeDeclaration(XSAttributeDeclaration att) { if(att == null) throw NativeMessages.MESSAGES.illegalNullArgument("att"); attrs.put(att.getName(),att); }
private boolean allowsXLink( XSComplexTypeDefinition typeDef ) { XSObjectList xsObjectList = typeDef.getAttributeUses(); for ( int i = 0; i < xsObjectList.getLength(); i++ ) { XSAttributeDeclaration attr = ( (XSAttributeUse) xsObjectList.item( i ) ).getAttrDeclaration(); if ( "href".equals( attr.getName() ) && XLNNS.equals( attr.getNamespace() ) ) { return true; } } return false; }
private ATreeNode( XSAttributeDeclaration attrDeclaration ) throws OdaException { this(); this.attr = attrDeclaration; this.value = this.attr.getName( ); this.type = ATTRIBUTE_TYPE; this.dataType = getDataType( attrDeclaration.getTypeDefinition( ) .getName( ) ); }
private boolean isInheritedAttributeOverridden(XMLAttributes attributes, XSAttributeDeclaration inhrAttrDecl) { boolean attrExists = false; for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) { if ((attributes.getLocalName(attrIndx)).equals(inhrAttrDecl.getName()) && XS11TypeHelper.isURIEqual(attributes.getURI(attrIndx), inhrAttrDecl.getNamespace())) { attrExists = true; break; } } return attrExists; } // isInheritedAttributeOverridden
private void processAttribute(Path parent, String path, XSAttributeUse xsAttribute) throws BagriException { path += "/@" + xsAttribute.getAttrDeclaration().getName(); XSSimpleTypeDefinition std = xsAttribute.getAttrDeclaration().getTypeDefinition(); Occurrence occurrence = Occurrence.getOccurrence( xsAttribute.getRequired() ? 1 : 0, std.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST ? -1 : 1); Path xp = modelMgr.translatePath(parent.getRoot(), path, NodeKind.attribute, parent.getPathId(), getBaseType(std), occurrence); logger.trace("processAttribute; attribute: {}; type: {}; got XDMPath: {}", path, std, xp); }
public boolean canHaveRemoteValue() { if (this.type.getTypeCategory() == 14) { return true; } XSComplexTypeDecl complexType = (XSComplexTypeDecl) this.type; XSAttributeGroupDefinition attributeGroupDefinition = complexType .getAttrGrp(); if (attributeGroupDefinition == null) { return false; } XSObjectList attrUses = attributeGroupDefinition.getAttributeUses(); for (int ii = 0; ii < attrUses.getLength(); ii++) { XSAttributeUse attrUse = (XSAttributeUse) attrUses.item(ii); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); if ((attrDecl.getName().equals("href")) && (attrDecl.getNamespace() != null) && (attrDecl.getNamespace() .equals("http://www.w3.org/1999/xlink"))) { return true; } } return false; }
XSAttributeUse attribute = ( (XSAttributeUse) attributes.item( i ) ); writer.writeEmptyElement( "attribute" ); writer.writeAttribute( "name", attribute.getAttrDeclaration().getName() ); XSTypeDefinition type = attribute.getAttrDeclaration().getTypeDefinition();
String name = decl.getName(); String prefix = null;
for ( int i = 0; i < attributeUses.getLength(); i++ ) { XSAttributeUse attributeUse = (XSAttributeUse) attributeUses.item( i ); s += "\n - attribute: " + attributeUse.getAttrDeclaration().getName();
void saveInheritableAttributes(XSElementDecl currentElemDecl, XMLAttributes attributes) { if (currentElemDecl != null && currentElemDecl.fType instanceof XSComplexTypeDecl) { XSComplexTypeDecl complexTypeDecl = (XSComplexTypeDecl) currentElemDecl.fType; XSObjectListImpl attributeUses = (XSObjectListImpl) complexTypeDecl.getAttributeUses(); // iterate all the attribute declarations of the complex type, for the current element for (int attrUsesIndx = 0; attrUsesIndx < attributeUses.getLength(); attrUsesIndx++) { XSAttributeUse attrUse = (XSAttributeUse) attributeUses.get(attrUsesIndx); if (attrUse.getInheritable()) { // this is an inheritable attribute. copy into an global Vector list. XSAttributeDeclaration attrDecl = (XSAttributeDeclaration) attrUse.getAttrDeclaration(); Augmentations attrAugs = attributes.getAugmentations(attrDecl.getNamespace(), attrDecl.getName()); if (attrAugs != null) { (fXmlSchemaValidator.getInheritableAttrList()).add((AttributePSVI)attrAugs.getItem(Constants.ATTRIBUTE_PSVI)); } } } } } // saveInheritableAttributes
for ( int i = 0; i < xsdValueType.getAttributeUses().getLength(); i++ ) { XSAttributeDeclaration attrDecl = ( (XSAttributeUse) xsdValueType.getAttributeUses().item( i ) ).getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); attrDecls.put( name, attrDecl ); if ( attrUse.getRequired() ) { XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); if ( !attrs.containsKey( name ) ) { String msg = "Required attribute '" + name + "' is missing.";
private XMLAttributes getAttributesForCTA(XMLAttributes attributes, Vector inheritableAttrList) { XMLAttributes ctaAttributes = new XMLAttributesImpl(); // copy attributes from the original list of attributes for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) { QName attrQName = new QName(); attributes.getName(attrIndx, attrQName); ctaAttributes.addAttribute(attrQName, attributes.getType(attrIndx), attributes.getValue(attrIndx)); } // add inherited attributes to the CTA attributes list for (int elemIndx = inheritableAttrList.size() - 1; elemIndx > -1; elemIndx--) { AttributePSVI inhAttrPsvi = (AttributePSVI) inheritableAttrList.elementAt(elemIndx); XSAttributeDeclaration inhrAttrDecl = inhAttrPsvi.getAttributeDeclaration(); // if an inherited attribute is not overridden by the current element, add it to the CTA attributes list if (!isInheritedAttributeOverridden(ctaAttributes, inhrAttrDecl)) { QName attrQName = new QName(); attrQName.setValues(null, inhrAttrDecl.getName(), inhrAttrDecl.getName(), inhrAttrDecl.getNamespace()); ctaAttributes.addAttribute(attrQName, null, inhAttrPsvi.getSchemaValue().getNormalizedValue()); } } return ctaAttributes; } // getAttributesForCTA
XSAttributeUse attrUse = ( (XSAttributeUse) attributeUses.item( i ) ); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName attrName = new QName( attrDecl.getName() ); if ( XLNNS.equals( attrDecl.getNamespace() ) ) { attrName = new QName( attrDecl.getNamespace(), attrDecl.getName() );
private void preProcessXSAttributeUse(XSAttributeUse attr) throws Exception { XSAttributeDeclaration decl = attr.getAttrDeclaration(); String sampleValue = null; switch (attr.getConstraintType()) { case XSConstants.VC_FIXED: if (RandomUtil.randomBoolean(config.generateFixedAttributes)) { sampleValue = attr.getValueConstraintValue().getNormalizedValue(); } break; case XSConstants.VC_DEFAULT: if (RandomUtil.randomBoolean(config.generateDefaultAttributes)) { sampleValue = attr.getValueConstraintValue().getNormalizedValue(); } break; default: if (attr.getRequired() || RandomUtil.randomBoolean(config.generateOptionalAttributes)) { if (sampleValue == null) { sampleValue = generateSampleValue(config, decl.getTypeDefinition(), decl.getName(), counters); } } } if (sampleValue != null) { doc.addAttribute(decl.getNamespace(), decl.getName(), sampleValue); } }
for ( int i = 0; i < xsdValueType.getAttributeUses().getLength(); i++ ) { XSAttributeDeclaration attrDecl = ( (XSAttributeUse) xsdValueType.getAttributeUses().item( i ) ).getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); attrDecls.put( name, attrDecl ); if ( attrUse.getRequired() ) { XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); if ( !attrs.containsKey( name ) ) { String msg = "Required attribute '" + name + "' is missing.";
XSAnnotation ann = ad.getAnnotation(); String documentation = parseAnnotationString( "Attribute " + ad.getNamespace() + ":" + ad.getName() + " documentation", ann != null ? ann.getAnnotationString() : null ); Util.toJavaFieldName(ad.getName()), "String", null, au.getRequired() ); fd1.tagName = ad.getName(); fd1.documentation = documentation; fd1.realIndex = td.fdMap.size(); td.duplicates = Util.addToNameMap(td.fdMap, fd1, false) || td.duplicates; if (!"collectiontype".equals(ad.getName()) && checkEnumType(ad.getTypeDefinition())) { XSTypeDefinition etRoot = ad.getTypeDefinition(); if (etRoot.getAnonymous()) {
private AttributeBinding bindAttribute(XSAttributeUse attrUse) QName attrName = new QName(attr.getNamespace(), attr.getName());