private QName getQName( XSAttributeDeclaration attrUse ) { if ( attrUse.getNamespace() == null || attrUse.getNamespace().isEmpty() ) { return new QName( attrUse.getName() ); } return new QName( attrUse.getNamespace(), attrUse.getName() ); }
public void addXSAttributeDeclaration(XSAttributeDeclaration attr) { //Add attribute to the namespace item String ns = attr.getNamespace(); JBossXSNamespaceItem jbnm = createNamespaceItemIfNotExistent(ns); jbnm.addXSAttributeDeclaration(attr); }
private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Hashtable dependencies) { if (decl.getScope() == XSConstants.SCOPE_GLOBAL) { if (!componentList.contains(decl)) { Vector importedNamespaces = findDependentNamespaces(namespace, dependencies); addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces); componentList.add(decl); } } else { expandRelatedAttributeComponents(decl, componentList, namespace, dependencies); } }
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 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
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; }
String namespace = decl.getNamespace(); prefix = getPrefix(namespace); buf.append("<attribute ref='" + prefix + ":" + name + "'");
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.";
XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName attrName = new QName( attrDecl.getName() ); if ( XLNNS.equals( attrDecl.getNamespace() ) ) { if ( attrDecl.getNamespace() != null ) { attrName = new QName( attrDecl.getNamespace(), attrDecl.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.";
QName attrName = null; XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); if ( attrDecl.getNamespace() == null || attrDecl.getNamespace().isEmpty() ) { attrName = new QName( attrDecl.getName() ); } else { attrName = new QName( attrDecl.getNamespace(), attrDecl.getName() );
String attrNs = attrDec.getNamespace(); String attrLocal = attrDec.getName(); Object attrValue = provider.getAttributeValue(o, ctx, attrNs, attrLocal);
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
XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName attrName = new QName( attrDecl.getName() ); if ( attrDecl.getNamespace() != null ) { attrName = new QName( attrDecl.getNamespace(), attrDecl.getName() );
XSAnnotation ann = ad.getAnnotation(); String documentation = parseAnnotationString( "Attribute " + ad.getNamespace() + ":" + ad.getName() + " documentation", ann != null ? ann.getAnnotationString() : null );
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); } }
private AttributeBinding bindAttribute(XSAttributeUse attrUse) QName attrName = new QName(attr.getNamespace(), attr.getName());