private void expandRelatedAttributeUseComponents(XSAttributeUse component, Vector componentList, String namespace, Hashtable dependencies) { addRelatedAttribute(component.getAttrDeclaration(), 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 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); }
private List<Schema.Field> createFields(XSComplexTypeDefinition type) { final Map<String, Schema.Field> fields = new LinkedHashMap<>(); XSObjectList attrUses = type.getAttributeUses(); for (int i = 0; i < attrUses.getLength(); i++) { XSAttributeUse attrUse = (XSAttributeUse) attrUses.item(i); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); boolean optional = !attrUse.getRequired(); Schema.Field field = createField(fields.values(), attrDecl, attrDecl.getTypeDefinition(), optional, false); fields.put(field.getProp(Source.SOURCE), field); } XSParticle particle = type.getParticle(); if (particle == null) return new ArrayList<>(fields.values()); XSTerm term = particle.getTerm(); if (term.getType() != XSConstants.MODEL_GROUP) throw new ConverterException("Unsupported term type " + term.getType()); XSModelGroup group = (XSModelGroup) term; createGroupFields(group, fields, false); return new ArrayList<>(fields.values()); }
XSAttributeDeclaration attrDecl = ( (XSAttributeUse) xsdValueType.getAttributeUses().item( i ) ).getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); attrDecls.put( name, attrDecl ); XSAttributeUse attrUse = (XSAttributeUse) xsdValueType.getAttributeUses().item( i ); if ( attrUse.getRequired() ) { XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); if ( !attrs.containsKey( name ) ) {
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; }
XSAttributeDeclaration decl = use.getAttrDeclaration(); buf.append(write(decl));
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
attrDecls = new HashMap<QName, XSAttributeDeclaration>(); 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 ); XSAttributeUse attrUse = (XSAttributeUse) xsdValueType.getAttributeUses().item( i ); if ( attrUse.getRequired() ) { XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName name = new QName( attrDecl.getNamespace(), attrDecl.getName() ); if ( !attrs.containsKey( name ) ) {
xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
for ( int i = 0; i < attrUses.getLength(); i++ ) { XSAttributeUse attrUse = (XSAttributeUse) attrUses.item( i ); QName attrName = getQName( attrUse.getAttrDeclaration() ); if ( qName.equals( attrName ) ) { return new Pair<PrimitiveType, Boolean>( new PrimitiveType( attrUse.getAttrDeclaration().getTypeDefinition() ), !attrUse.getRequired() );
public static boolean checkComplexType(XSTypeDefinition td) { if (td.getTypeCategory() != XSTypeDefinition.COMPLEX_TYPE) { return false; } XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td; if (ctd.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_ELEMENT) { return true; } if ((td instanceof XSComplexTypeDecl) && ((XSComplexTypeDecl) td).getAbstract()) { return true; } if (TEXT_ELEMENTS_ARE_COMPLEX) { return true; } if (ctd.getAttributeUses() != null) { for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) { XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses().item(i)).getAttrDeclaration() .getTypeDefinition(); if ("ID".equals(xsstd.getName())) { continue; } return true; } } return false; }
for ( int i = 0; i < attributeUses.getLength(); i++ ) { XSAttributeUse attrUse = ( (XSAttributeUse) attributeUses.item( i ) ); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName attrName = new QName( attrDecl.getName() ); if ( XLNNS.equals( attrDecl.getNamespace() ) ) {
for ( int i = 0; i < attributeUses.getLength(); i++ ) { XSAttributeUse attrUse = ( (XSAttributeUse) attributeUses.item( i ) ); XSAttributeDeclaration attrDecl = attrUse.getAttrDeclaration(); QName attrName = new QName( attrDecl.getName() ); if ( attrDecl.getNamespace() != null ) {
public static boolean checkEnumType(XSTypeDefinition td) { final XSSimpleTypeDefinition st; if (td.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { XSComplexTypeDefinition ctd = (XSComplexTypeDefinition) td; if (ctd.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) { return false; } if (ctd.getAttributeUses() != null) { for (int i = 0; i < ctd.getAttributeUses().getLength(); i++) { XSSimpleTypeDefinition xsstd = ((XSAttributeUse) ctd.getAttributeUses() .item(i)).getAttrDeclaration() .getTypeDefinition(); if ("ID".equals(xsstd.getName())) { continue; } return false; } } st = ctd.getSimpleType(); } else if (td.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { st = (XSSimpleTypeDefinition) td; } else { return false; } return st.getLexicalEnumeration() != null && st.getLexicalEnumeration().getLength() != 0; }
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) XSAttributeDeclaration attr = attrUse.getAttrDeclaration(); QName attrName = new QName(attr.getNamespace(), attr.getName());
for ( int i = 0; i < attributeUses.getLength(); i++ ) { XSAttributeUse attributeUse = (XSAttributeUse) attributeUses.item( i ); s += "\n - attribute: " + attributeUse.getAttrDeclaration().getName();
case XSConstants.ATTRIBUTE_USE: if (NO_FILTER == filter || XSConstants.ATTRIBUTE_DECLARATION == filter) { addComponent(((XSAttributeUse)sourceComponent).getAttrDeclaration(), nameTest, targetComponents); XSObjectList attrbuses = ((XSAttributeGroupDefinition) sourceComponent).getAttributeUses(); for (int i = 0, n = attrbuses.size(); i < n; ++i) { addComponent(((XSAttributeUse) attrbuses.item(i)).getAttrDeclaration(), nameTest, targetComponents);