Search in sources :

Example 1 with XSAttGroupDecl

use of com.sun.xml.xsom.XSAttGroupDecl in project atlasmap by atlasmap.

the class SchemaTreeTraverser method schema.

/* (non-Javadoc)
     * @see com.sun.xml.xsom.visitor.XSVisitor#schema(com.sun.xml.xsom.XSSchema)
     */
public void schema(XSSchema s) {
    // QUICK HACK: don't print the built-in components
    if (s.getTargetNamespace().equals(Const.schemaNamespace)) {
        return;
    }
    SchemaTreeNode newNode = new SchemaTreeNode("Schema " + s.getLocator().getSystemId(), s.getLocator());
    this.currNode = newNode;
    this.model.addSchemaNode(newNode);
    for (XSAttGroupDecl groupDecl : s.getAttGroupDecls().values()) {
        attGroupDecl(groupDecl);
    }
    for (XSAttributeDecl attrDecl : s.getAttributeDecls().values()) {
        attributeDecl(attrDecl);
    }
    for (XSComplexType complexType : s.getComplexTypes().values()) {
        complexType(complexType);
    }
    for (XSElementDecl elementDecl : s.getElementDecls().values()) {
        elementDecl(elementDecl);
    }
    for (XSModelGroupDecl modelGroupDecl : s.getModelGroupDecls().values()) {
        modelGroupDecl(modelGroupDecl);
    }
    for (XSSimpleType simpleType : s.getSimpleTypes().values()) {
        simpleType(simpleType);
    }
}
Also used : XSAttGroupDecl(com.sun.xml.xsom.XSAttGroupDecl) XSSimpleType(com.sun.xml.xsom.XSSimpleType) XSComplexType(com.sun.xml.xsom.XSComplexType) XSModelGroupDecl(com.sun.xml.xsom.XSModelGroupDecl) XSAttributeDecl(com.sun.xml.xsom.XSAttributeDecl) XSElementDecl(com.sun.xml.xsom.XSElementDecl)

Example 2 with XSAttGroupDecl

use of com.sun.xml.xsom.XSAttGroupDecl in project atlasmap by atlasmap.

the class AttributesHolder method getAttributeUses.

/**
 * Returns the attribute uses by looking at attribute groups and etc.
 * Searching for the base type is done in {@link ComplexTypeImpl}.
 */
public Collection<XSAttributeUse> getAttributeUses() {
    // TODO: this is fairly inefficient
    List<XSAttributeUse> v = new ArrayList<XSAttributeUse>();
    v.addAll(attributes.values());
    for (XSAttGroupDecl agd : getAttGroups()) v.addAll(agd.getAttributeUses());
    return v;
}
Also used : XSAttGroupDecl(com.sun.xml.xsom.XSAttGroupDecl) ArrayList(java.util.ArrayList) XSAttributeUse(com.sun.xml.xsom.XSAttributeUse)

Example 3 with XSAttGroupDecl

use of com.sun.xml.xsom.XSAttGroupDecl in project atlasmap by atlasmap.

the class SchemaWriter method schema.

public void schema(XSSchema s) {
    // QUICK HACK: don't print the built-in components
    if (s.getTargetNamespace().equals(Const.schemaNamespace))
        return;
    println(MessageFormat.format("<schema targetNamespace=\"{0}\">", s.getTargetNamespace()));
    indent++;
    Iterator itr;
    itr = s.iterateAttGroupDecls();
    while (itr.hasNext()) attGroupDecl((XSAttGroupDecl) itr.next());
    itr = s.iterateAttributeDecls();
    while (itr.hasNext()) attributeDecl((XSAttributeDecl) itr.next());
    itr = s.iterateComplexTypes();
    while (itr.hasNext()) complexType((XSComplexType) itr.next());
    itr = s.iterateElementDecls();
    while (itr.hasNext()) elementDecl((XSElementDecl) itr.next());
    itr = s.iterateModelGroupDecls();
    while (itr.hasNext()) modelGroupDecl((XSModelGroupDecl) itr.next());
    itr = s.iterateSimpleTypes();
    while (itr.hasNext()) simpleType((XSSimpleType) itr.next());
    indent--;
    println("</schema>");
}
Also used : XSAttGroupDecl(com.sun.xml.xsom.XSAttGroupDecl) XSSimpleType(com.sun.xml.xsom.XSSimpleType) XSComplexType(com.sun.xml.xsom.XSComplexType) XSModelGroupDecl(com.sun.xml.xsom.XSModelGroupDecl) XSAttributeDecl(com.sun.xml.xsom.XSAttributeDecl) Iterator(java.util.Iterator) XSElementDecl(com.sun.xml.xsom.XSElementDecl)

Example 4 with XSAttGroupDecl

use of com.sun.xml.xsom.XSAttGroupDecl in project atlasmap by atlasmap.

the class SchemaWriter method attGroupDecl.

public void attGroupDecl(XSAttGroupDecl decl) {
    Iterator itr;
    println(MessageFormat.format("<attGroup name=\"{0}\">", decl.getName()));
    indent++;
    // TODO: wildcard
    itr = decl.iterateAttGroups();
    while (itr.hasNext()) dumpRef((XSAttGroupDecl) itr.next());
    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) attributeUse((XSAttributeUse) itr.next());
    indent--;
    println("</attGroup>");
}
Also used : XSAttGroupDecl(com.sun.xml.xsom.XSAttGroupDecl) Iterator(java.util.Iterator) XSAttributeUse(com.sun.xml.xsom.XSAttributeUse)

Example 5 with XSAttGroupDecl

use of com.sun.xml.xsom.XSAttGroupDecl in project atlasmap by atlasmap.

the class SchemaWriter method dumpComplexTypeAttribute.

private void dumpComplexTypeAttribute(XSComplexType type) {
    Iterator itr;
    itr = type.iterateAttGroups();
    while (itr.hasNext()) dumpRef((XSAttGroupDecl) itr.next());
    itr = type.iterateDeclaredAttributeUses();
    while (itr.hasNext()) attributeUse((XSAttributeUse) itr.next());
    XSWildcard awc = type.getAttributeWildcard();
    if (awc != null)
        wildcard("anyAttribute", awc, "");
}
Also used : XSAttGroupDecl(com.sun.xml.xsom.XSAttGroupDecl) Iterator(java.util.Iterator) XSAttributeUse(com.sun.xml.xsom.XSAttributeUse) XSWildcard(com.sun.xml.xsom.XSWildcard)

Aggregations

XSAttGroupDecl (com.sun.xml.xsom.XSAttGroupDecl)8 XSAttributeUse (com.sun.xml.xsom.XSAttributeUse)5 Iterator (java.util.Iterator)5 XSAttributeDecl (com.sun.xml.xsom.XSAttributeDecl)2 XSComplexType (com.sun.xml.xsom.XSComplexType)2 XSElementDecl (com.sun.xml.xsom.XSElementDecl)2 XSModelGroupDecl (com.sun.xml.xsom.XSModelGroupDecl)2 XSSimpleType (com.sun.xml.xsom.XSSimpleType)2 XSType (com.sun.xml.xsom.XSType)1 XSWildcard (com.sun.xml.xsom.XSWildcard)1 ArrayList (java.util.ArrayList)1