com.sun.xml.internal.xsom.XSAttributeUse Java Examples

The following examples show how to use com.sun.xml.internal.xsom.XSAttributeUse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaWriter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void attributeUse( XSAttributeUse use ) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts="";

    if(use.isRequired())
        additionalAtts += " use=\"required\"";
    if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null)
        additionalAtts += " fixed=\""+use.getFixedValue()+'\"';
    if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null)
        additionalAtts += " default=\""+use.getDefaultValue()+'\"';

    if(decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl,additionalAtts);
    } else {
        // reference to a global one
        println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>",
            decl.getTargetNamespace(), decl.getName(), additionalAtts));
    }
}
 
Example #2
Source File: ComplexTypeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Iterator<XSAttributeUse> iterateAttributeUses() {

        XSComplexType baseType = getBaseType().asComplexType();

        if( baseType==null )    return super.iterateAttributeUses();

        return new Iterators.Union<XSAttributeUse>(
            new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) {
                protected boolean matches(XSAttributeUse value) {
                    XSAttributeDecl u = value.getDecl();
                    UName n = new UName(u.getTargetNamespace(),u.getName());
                    return !prohibitedAtts.contains(n);
                }
            },
            super.iterateAttributeUses() );
    }
 
Example #3
Source File: SchemaWriter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void attributeUse( XSAttributeUse use ) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts="";

    if(use.isRequired())
        additionalAtts += " use=\"required\"";
    if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null)
        additionalAtts += " fixed=\""+use.getFixedValue()+'\"';
    if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null)
        additionalAtts += " default=\""+use.getDefaultValue()+'\"';

    if(decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl,additionalAtts);
    } else {
        // reference to a global one
        println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>",
            decl.getTargetNamespace(), decl.getName(), additionalAtts));
    }
}
 
Example #4
Source File: ComplexTypeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Iterator<XSAttributeUse> iterateAttributeUses() {

        XSComplexType baseType = getBaseType().asComplexType();

        if( baseType==null )    return super.iterateAttributeUses();

        return new Iterators.Union<XSAttributeUse>(
            new Iterators.Filter<XSAttributeUse>(baseType.iterateAttributeUses()) {
                protected boolean matches(XSAttributeUse value) {
                    XSAttributeDecl u = value.getDecl();
                    UName n = new UName(u.getTargetNamespace(),u.getName());
                    return !prohibitedAtts.contains(n);
                }
            },
            super.iterateAttributeUses() );
    }
 
Example #5
Source File: SchemaTreeTraverser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \""
            + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    Iterator itr;

    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }

    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #6
Source File: BIProperty.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) {

        boolean forConstant =
            getCustomization(use).isConstantProperty() &&
            use.getFixedValue()!=null;

        String name = getPropertyName(forConstant);
        if(name==null) {
            NameConverter conv = getBuilder().getNameConverter();
            if(forConstant)
                name = conv.toConstantName(use.getDecl().getName());
            else
                name = conv.toPropertyName(use.getDecl().getName());
            if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
                name = JJavaName.getPluralForm(name);
        }

        markAsAcknowledged();
        constantPropertyErrorCheck();

        return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(),
                BGMBuilder.getName(use.getDecl()), tu,
                BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use);
    }
 
Example #7
Source File: SchemaTreeTraverser.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \""
            + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    Iterator itr;

    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }

    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #8
Source File: SchemaTreeTraverser.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \""
            + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    Iterator itr;

    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }

    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #9
Source File: SchemaWriter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void attributeUse( XSAttributeUse use ) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts="";

    if(use.isRequired())
        additionalAtts += " use=\"required\"";
    if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null)
        additionalAtts += " fixed=\""+use.getFixedValue()+'\"';
    if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null)
        additionalAtts += " default=\""+use.getDefaultValue()+'\"';

    if(decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl,additionalAtts);
    } else {
        // reference to a global one
        println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>",
            decl.getTargetNamespace(), decl.getName(), additionalAtts));
    }
}
 
Example #10
Source File: ComplexTypeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
    UName name = new UName(nsURI,localName);

    if(prohibitedAtts.contains(name))       return null;

    XSAttributeUse o = attributes.get(name);


    if(o==null) {
        Iterator itr = iterateAttGroups();
        while(itr.hasNext() && o==null)
            o = ((XSAttGroupDecl)itr.next()).getAttributeUse(nsURI,localName);
    }

    if(o==null) {
        XSType base = getBaseType();
        if(base.asComplexType()!=null)
            o = base.asComplexType().getAttributeUse(nsURI,localName);
    }

    return o;
}
 
Example #11
Source File: SchemaTreeTraverser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \""
            + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    Iterator itr;

    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }

    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #12
Source File: BIProperty.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public CAttributePropertyInfo createAttributeProperty( XSAttributeUse use, TypeUse tu ) {

        boolean forConstant =
            getCustomization(use).isConstantProperty() &&
            use.getFixedValue()!=null;

        String name = getPropertyName(forConstant);
        if(name==null) {
            NameConverter conv = getBuilder().getNameConverter();
            if(forConstant)
                name = conv.toConstantName(use.getDecl().getName());
            else
                name = conv.toPropertyName(use.getDecl().getName());
            if(tu.isCollection() && getBuilder().getGlobalBinding().isSimpleMode())
                name = JJavaName.getPluralForm(name);
        }

        markAsAcknowledged();
        constantPropertyErrorCheck();

        return wrapUp(new CAttributePropertyInfo(name,use,getCustomizations(use),use.getLocator(),
                BGMBuilder.getName(use.getDecl()), tu,
                BGMBuilder.getName(use.getDecl().getType()), use.isRequired() ),use);
    }
 
Example #13
Source File: SchemaWriter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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>");
}
 
Example #14
Source File: SchemaTreeTraverser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group \""
            + decl.getName() + "\"", decl.getLocator());
    this.currNode.add(newNode);
    this.currNode = newNode;

    Iterator itr;

    itr = decl.iterateAttGroups();
    while (itr.hasNext()) {
        dumpRef((XSAttGroupDecl) itr.next());
    }

    itr = decl.iterateDeclaredAttributeUses();
    while (itr.hasNext()) {
        attributeUse((XSAttributeUse) itr.next());
    }

    this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
 
Example #15
Source File: SchemaTreeTraverser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void attributeUse(XSAttributeUse use) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts = "";

    if (use.isRequired()) {
        additionalAtts += " use=\"required\"";
    }
    if (use.getFixedValue() != null
            && use.getDecl().getFixedValue() == null) {
        additionalAtts += " fixed=\"" + use.getFixedValue() + "\"";
    }
    if (use.getDefaultValue() != null
            && use.getDecl().getDefaultValue() == null) {
        additionalAtts += " default=\"" + use.getDefaultValue() + "\"";
    }

    if (decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl, additionalAtts);
    }
    else {
        // reference to a global one
        String str = MessageFormat.format(
                "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{
                    decl.getTargetNamespace(), decl.getName(),
                    additionalAtts});
        SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
        this.currNode.add(newNode);
    }
}
 
Example #16
Source File: BIProperty.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSAttributeUse src ) {
    // customizations for an attribute use should include those defined in the local attribute.
    // this is so that the schema like:
    //
    // <xs:attribute name="foo" type="xs:int">
    //   <xs:annotation><xs:appinfo>
    //     <hyperjaxb:... />
    //
    // would be picked up
    if(src.getDecl().isLocal())
        return getCustomizations(src,src.getDecl());
    else
        return getCustomizations((XSComponent)src);
}
 
Example #17
Source File: BIProperty.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSAttributeUse src ) {
    // customizations for an attribute use should include those defined in the local attribute.
    // this is so that the schema like:
    //
    // <xs:attribute name="foo" type="xs:int">
    //   <xs:annotation><xs:appinfo>
    //     <hyperjaxb:... />
    //
    // would be picked up
    if(src.getDecl().isLocal())
        return getCustomizations(src,src.getDecl());
    else
        return getCustomizations((XSComponent)src);
}
 
Example #18
Source File: AttributesHolder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #19
Source File: SchemaTreeTraverser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void attributeUse(XSAttributeUse use) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts = "";

    if (use.isRequired()) {
        additionalAtts += " use=\"required\"";
    }
    if (use.getFixedValue() != null
            && use.getDecl().getFixedValue() == null) {
        additionalAtts += " fixed=\"" + use.getFixedValue() + "\"";
    }
    if (use.getDefaultValue() != null
            && use.getDecl().getDefaultValue() == null) {
        additionalAtts += " default=\"" + use.getDefaultValue() + "\"";
    }

    if (decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl, additionalAtts);
    }
    else {
        // reference to a global one
        String str = MessageFormat.format(
                "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{
                    decl.getTargetNamespace(), decl.getName(),
                    additionalAtts});
        SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
        this.currNode.add(newNode);
    }
}
 
Example #20
Source File: SchemaWriter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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,"");
}
 
Example #21
Source File: AttGroupDeclImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
    UName name = new UName(nsURI,localName);
    XSAttributeUse o=null;

    Iterator itr = iterateAttGroups();
    while(itr.hasNext() && o==null)
        o = ((XSAttGroupDecl)itr.next()).getAttributeUse(nsURI,localName);

    if(o==null)     o = attributes.get(name);

    return o;
}
 
Example #22
Source File: Axis.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private Iterator<XSAttributeDecl> attributeHolder(final XSAttContainer atts) {
    // TODO: check spec. is this correct?
    return new Iterators.Adapter<XSAttributeDecl,XSAttributeUse>(atts.iterateAttributeUses()) {
        protected XSAttributeDecl filter(XSAttributeUse u) {
            return u.getDecl();
        }
    };
}
 
Example #23
Source File: SchemaTreeTraverser.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void attributeUse(XSAttributeUse use) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts = "";

    if (use.isRequired()) {
        additionalAtts += " use=\"required\"";
    }
    if (use.getFixedValue() != null
            && use.getDecl().getFixedValue() == null) {
        additionalAtts += " fixed=\"" + use.getFixedValue() + "\"";
    }
    if (use.getDefaultValue() != null
            && use.getDecl().getDefaultValue() == null) {
        additionalAtts += " default=\"" + use.getDefaultValue() + "\"";
    }

    if (decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl, additionalAtts);
    }
    else {
        // reference to a global one
        String str = MessageFormat.format(
                "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{
                    decl.getTargetNamespace(), decl.getName(),
                    additionalAtts});
        SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
        this.currNode.add(newNode);
    }
}
 
Example #24
Source File: SchemaWriter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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,"");
}
 
Example #25
Source File: SchemaTreeTraverser.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates node for complex type.
 *
 * @param type Complex type.
 */
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());
    }
}
 
Example #26
Source File: SchemaTreeTraverser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates node for complex type.
 *
 * @param type Complex type.
 */
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());
    }
}
 
Example #27
Source File: SchemaTreeTraverser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void attributeUse(XSAttributeUse use) {
    XSAttributeDecl decl = use.getDecl();

    String additionalAtts = "";

    if (use.isRequired()) {
        additionalAtts += " use=\"required\"";
    }
    if (use.getFixedValue() != null
            && use.getDecl().getFixedValue() == null) {
        additionalAtts += " fixed=\"" + use.getFixedValue() + "\"";
    }
    if (use.getDefaultValue() != null
            && use.getDecl().getDefaultValue() == null) {
        additionalAtts += " default=\"" + use.getDefaultValue() + "\"";
    }

    if (decl.isLocal()) {
        // this is anonymous attribute use
        dump(decl, additionalAtts);
    }
    else {
        // reference to a global one
        String str = MessageFormat.format(
                "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{
                    decl.getTargetNamespace(), decl.getName(),
                    additionalAtts});
        SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
        this.currNode.add(newNode);
    }
}
 
Example #28
Source File: BIProperty.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private CCustomizations getCustomizations( XSAttributeUse src ) {
    // customizations for an attribute use should include those defined in the local attribute.
    // this is so that the schema like:
    //
    // <xs:attribute name="foo" type="xs:int">
    //   <xs:annotation><xs:appinfo>
    //     <hyperjaxb:... />
    //
    // would be picked up
    if(src.getDecl().isLocal())
        return getCustomizations(src,src.getDecl());
    else
        return getCustomizations((XSComponent)src);
}
 
Example #29
Source File: BindGreen.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void attContainer(XSAttContainer cont) {
    // inline
    Iterator itr = cont.iterateDeclaredAttributeUses();
    while(itr.hasNext())
        builder.ying((XSAttributeUse)itr.next(),cont);
    itr = cont.iterateAttGroups();
    while(itr.hasNext())
        builder.ying((XSAttGroupDecl)itr.next(),cont);

    XSWildcard w = cont.getAttributeWildcard();
    if(w!=null)
        builder.ying(w,cont);
}
 
Example #30
Source File: SchemaTreeTraverser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates node for complex type.
 *
 * @param type Complex type.
 */
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());
    }
}