List attContent = cType.getAttributeContents();
public static List getChildAttributes(XSDComplexTypeDefinition ct) { EList attrContents = ct.getAttributeContents(); List attrs = new ArrayList(); for (int i = 0; i < attrContents.size(); i++) { Object next = attrContents.get(i); if (next instanceof XSDAttributeUse) { attrs.add(((XSDAttributeUse) next).getContent().getResolvedAttributeDeclaration()); } else if (next instanceof XSDAttributeGroupDefinition) { //XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) next; } } return attrs; }
protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributeURIs(XSDComplexTypeDefinition xsdComplexTypeDefinition) { Map<String, XSDAttributeDeclaration> result = getProhibitedAttributes(xsdComplexTypeDefinition.getAttributeContents()); if (xsdComplexTypeDefinition.getBaseTypeDefinition() instanceof XSDComplexTypeDefinition && !xsdComplexTypeDefinition.isCircular()) { result.putAll (getProhibitedAttributes (((XSDComplexTypeDefinition)xsdComplexTypeDefinition.getBaseTypeDefinition()).getAttributeContents())); } return result; }
protected static Map<String, XSDAttributeDeclaration> getProhibitedAttributeURIs(XSDComplexTypeDefinition xsdComplexTypeDefinition) { Map<String, XSDAttributeDeclaration> result = getProhibitedAttributes(xsdComplexTypeDefinition.getAttributeContents()); if (xsdComplexTypeDefinition.getBaseTypeDefinition() instanceof XSDComplexTypeDefinition && !xsdComplexTypeDefinition.isCircular()) { result.putAll (getProhibitedAttributes (((XSDComplexTypeDefinition)xsdComplexTypeDefinition.getBaseTypeDefinition()).getAttributeContents())); } return result; }
private void updateNames(XSDComplexTypeDefinition ct) { Iterator iter = ct.getAttributeContents().iterator(); while (iter.hasNext()) { Object obj = iter.next(); if (obj instanceof XSDAttributeUse) { XSDAttributeUse use = (XSDAttributeUse) obj; XSDAttributeDeclaration attr = use.getAttributeDeclaration(); String attrName = attr.getName(); if (attrName != null) { names.add(attrName); } } } }
public List getAttributeGroupContent() { EList attrContent = getXSDComplexTypeDefinition().getAttributeContents(); List attrUses = new ArrayList(); List list = new ArrayList(); for (Iterator it = attrContent.iterator(); it.hasNext();) { XSDAttributeGroupContent attrGroupContent = (XSDAttributeGroupContent) it.next(); if (attrGroupContent instanceof XSDAttributeGroupDefinition) { XSDAttributeGroupDefinition attributeGroupDefinition = (XSDAttributeGroupDefinition) attrGroupContent; list.add(XSDAdapterFactory.getInstance().adapt(attributeGroupDefinition)); getAttributeUses(attributeGroupDefinition, attrUses); } else { attrUses.add(attrGroupContent); list.add(new TargetConnectionSpaceFiller(this)); } } return list; }
public boolean visit(XSDTypeDefinition type) { //simple types dont have attributes if (type instanceof XSDSimpleTypeDefinition) { return true; } XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type; //get all the attribute content (groups,or uses) and add to q List attContent = cType.getAttributeContents(); for (Iterator itr = attContent.iterator(); itr.hasNext();) { XSDAttributeGroupContent content = (XSDAttributeGroupContent) itr.next(); if (content instanceof XSDAttributeUse) { //an attribute, add it to the list XSDAttributeUse use = (XSDAttributeUse) content; attributes.add(use.getAttributeDeclaration()); } else if (content instanceof XSDAttributeGroupDefinition) { //attribute group, add all atts in group to list XSDAttributeGroupDefinition attGrp = (XSDAttributeGroupDefinition) content; if (attGrp.isAttributeGroupDefinitionReference()) { attGrp = attGrp.getResolvedAttributeGroupDefinition(); } List uses = attGrp.getAttributeUses(); for (Iterator aitr = uses.iterator(); aitr.hasNext();) { XSDAttributeUse use = (XSDAttributeUse) aitr.next(); attributes.add(use.getAttributeDeclaration()); } } } return true; } };
public boolean visit(XSDTypeDefinition type) { //simple types dont have attributes if (type instanceof XSDSimpleTypeDefinition) { return true; } XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type; //get all the attribute content (groups,or uses) and add to q List attContent = cType.getAttributeContents(); for (Iterator itr = attContent.iterator(); itr.hasNext();) { XSDAttributeGroupContent content = (XSDAttributeGroupContent) itr.next(); if (content instanceof XSDAttributeUse) { //an attribute, add it to the list XSDAttributeUse use = (XSDAttributeUse) content; attributes.add(use.getAttributeDeclaration()); } else if (content instanceof XSDAttributeGroupDefinition) { //attribute group, add all atts in group to list XSDAttributeGroupDefinition attGrp = (XSDAttributeGroupDefinition) content; if (attGrp.isAttributeGroupDefinitionReference()) { attGrp = attGrp.getResolvedAttributeGroupDefinition(); } List uses = attGrp.getAttributeUses(); for (Iterator aitr = uses.iterator(); aitr.hasNext();) { XSDAttributeUse use = (XSDAttributeUse) aitr.next(); attributes.add(use.getAttributeDeclaration()); } } } return true; } };
protected List<XSDAttributeUse> getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition) { if (useSortedAttributes()) { return xsdComplexTypeDefinition.getAttributeUses(); } else { List<XSDAttributeUse> result = new ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses()); reorderAttributeUses(result, xsdComplexTypeDefinition.getAttributeContents()); return result; } }
protected List<XSDAttributeUse> getAttributeUses(XSDComplexTypeDefinition xsdComplexTypeDefinition) { if (useSortedAttributes()) { return xsdComplexTypeDefinition.getAttributeUses(); } else { List<XSDAttributeUse> result = new ArrayList<XSDAttributeUse>(xsdComplexTypeDefinition.getAttributeUses()); reorderAttributeUses(result, xsdComplexTypeDefinition.getAttributeContents()); return result; } }
if (type.getAttributeContents() != null) for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); )
protected void makeReferenceAttribute(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setName(getName(reference)); setReferenceAttribType(attrDecl); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(attrUse); map(attrUse, reference); }
protected void makeReferenceAttribute(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setName(getName(reference)); setReferenceAttribType(attrDecl); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(attrUse); map(attrUse, reference); }
protected void addXMIAttributes(XSDComplexTypeDefinition xsdComplexTypeDefinition) { if (!minimizedXMI) { importXMI(); XSDAttributeGroupDefinition objAttribs = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition(); objAttribs.setResolvedAttributeGroupDefinition(objAttribs.resolveAttributeGroupDefinition(XMI_URI, "ObjectAttribs")); xsdComplexTypeDefinition.getAttributeContents().add(0, objAttribs); } else { if (!useEncodedAttributeStyle) { importXMI(); XSDAttributeGroupDefinition linkAttribs = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition(); linkAttribs.setResolvedAttributeGroupDefinition(linkAttribs.resolveAttributeGroupDefinition(XMI_URI, "LinkAttribs")); xsdComplexTypeDefinition.getAttributeContents().add(0, linkAttribs); } } if (!minimizedXMI) { importXMI(); XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setResolvedAttributeDeclaration(attrDecl.resolveAttributeDeclaration(XMI_URI, "id")); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(0, attrUse); } }
protected void addXMIAttributes(XSDComplexTypeDefinition xsdComplexTypeDefinition) { if (!minimizedXMI) { importXMI(); XSDAttributeGroupDefinition objAttribs = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition(); objAttribs.setResolvedAttributeGroupDefinition(objAttribs.resolveAttributeGroupDefinition(XMI_URI, "ObjectAttribs")); xsdComplexTypeDefinition.getAttributeContents().add(0, objAttribs); } else { if (!useEncodedAttributeStyle) { importXMI(); XSDAttributeGroupDefinition linkAttribs = XSDFactory.eINSTANCE.createXSDAttributeGroupDefinition(); linkAttribs.setResolvedAttributeGroupDefinition(linkAttribs.resolveAttributeGroupDefinition(XMI_URI, "LinkAttribs")); xsdComplexTypeDefinition.getAttributeContents().add(0, linkAttribs); } } if (!minimizedXMI) { importXMI(); XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setResolvedAttributeDeclaration(attrDecl.resolveAttributeDeclaration(XMI_URI, "id")); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(0, attrUse); } }
public void visitComplexTypeDefinition(XSDComplexTypeDefinition type) if (type.getAttributeContents() != null) for (Iterator iter = type.getAttributeContents().iterator(); iter.hasNext(); )
protected void createAttributeDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setName(getName(attribute)); setAttributeType(attribute, attrDecl); setDefaultValue(attribute, attrDecl); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); setUseToRequired(attribute, attrUse); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(attrUse); map(attrUse, attribute); }
protected void createAttributeDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDAttributeDeclaration attrDecl = XSDFactory.eINSTANCE.createXSDAttributeDeclaration(); attrDecl.setName(getName(attribute)); setAttributeType(attribute, attrDecl); setDefaultValue(attribute, attrDecl); XSDAttributeUse attrUse = XSDFactory.eINSTANCE.createXSDAttributeUse(); setUseToRequired(attribute, attrUse); attrUse.setContent(attrDecl); xsdComplexTypeDefinition.getAttributeContents().add(attrUse); map(attrUse, attribute); }
@Override protected void validateValue() { XSDSimpleTypeDefinition whiteSpaceEnumeration = ((XSDAttributeUse) ((XSDComplexTypeDefinition) getSimpleTypeDefinition(). getSchema(). getSchemaForSchema(). resolveElementDeclaration("whiteSpace"). getTypeDefinition()). getAttributeContents().get(0)). getAttributeDeclaration().getTypeDefinition(); checkSimpleTypeConstraint (whiteSpaceEnumeration, getLexicalValue(), XSDConstants.PART2, "element-whiteSpace", getElement(), XSDConstants.VALUE_ATTRIBUTE, true); }
@Override protected void validateValue() { XSDSimpleTypeDefinition whiteSpaceEnumeration = ((XSDAttributeUse) ((XSDComplexTypeDefinition) getSimpleTypeDefinition(). getSchema(). getSchemaForSchema(). resolveElementDeclaration("whiteSpace"). getTypeDefinition()). getAttributeContents().get(0)). getAttributeDeclaration().getTypeDefinition(); checkSimpleTypeConstraint (whiteSpaceEnumeration, getLexicalValue(), XSDConstants.PART2, "element-whiteSpace", getElement(), XSDConstants.VALUE_ATTRIBUTE, true); }