com.sun.xml.xsom.XSAttGroupDecl Java Examples

The following examples show how to use com.sun.xml.xsom.XSAttGroupDecl. 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: ComplexTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 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<XSAttGroupDecl> itr = iterateAttGroups();
        while(itr.hasNext() && o==null)
            o = itr.next().getAttributeUse(nsURI,localName);
    }
    
    if(o==null) {
        XSType base = getBaseType();
        if(base.asComplexType()!=null)
            o = base.asComplexType().getAttributeUse(nsURI,localName);
    }
    
    return o;
}
 
Example #2
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 6 votes vote down vote up
public void attGroupDecl( XSAttGroupDecl decl ) {
	Iterator<?> itr;

	println(MessageFormat.format("<attributeGroup 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("</attributeGroup>");
}
 
Example #3
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void attGroupDecl( XSAttGroupDecl decl ) {
    Iterator itr;

    println(MessageFormat.format("<attGroup name=\"{0}\">",
        new Object[]{ 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 #4
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 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 #5
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.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 #6
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.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 #7
Source File: ComplexTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public XSWildcard getAttributeWildcard() {
    WildcardImpl complete = localAttWildcard;
    
    Iterator<XSAttGroupDecl> itr = iterateAttGroups();
    while( itr.hasNext() ) {
        WildcardImpl w = (WildcardImpl)(itr.next().getAttributeWildcard());
        
        if(w==null)     continue;
        
        if(complete==null)
            complete = w;
        else
            // TODO: the spec says it's intersection,
            // but I think it has to be union.
            complete = complete.union(ownerDocument,w);
    }
    
    if( getDerivationMethod()==RESTRICTION )    return complete;
    
    WildcardImpl base=null;
    XSType baseType = getBaseType();
    if(baseType.asComplexType()!=null)
        base = (WildcardImpl)baseType.asComplexType().getAttributeWildcard();
    
    if(complete==null)  return base;
    if(base==null)      return complete;
    
    return complete.union(ownerDocument,base);
}
 
Example #8
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 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() );
}
 
Example #9
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 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 #10
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates node of attribute group decalration reference.
 *
 * @param decl Attribute group decalration reference.
 */
public void dumpRef(XSAttGroupDecl decl) {
    SchemaTreeNode newNode = new SchemaTreeNode("Attribute group ref \"{"
            + decl.getTargetNamespace() + "}" + decl.getName() + "\"", decl
            .getLocator());
    this.currNode.add(newNode);
}
 
Example #11
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
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);
    }
}
 
Example #12
Source File: AttGroupDeclImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
    UName name = new UName(nsURI,localName);
    XSAttributeUse o=null;
    
    Iterator<XSAttGroupDecl> itr = iterateAttGroups();
    while(itr.hasNext() && o==null)
        o = itr.next().getAttributeUse(nsURI,localName);
    
    if(o==null)     o = attributes.get(name);
    
    return o;
}
 
Example #13
Source File: GroupInterfaceGenerator.java    From jaxb2-rich-contract-plugin with MIT License 5 votes vote down vote up
private List<PropertyUse> findAttributeDecls(final XSAttGroupDecl attGroupDecl) {
	final List<PropertyUse> attributeDecls = new ArrayList<>();
	for (final XSAttributeUse child : attGroupDecl.getDeclaredAttributeUses()) {
		attributeDecls.add(new PropertyUse(child));
	}
	return attributeDecls;
}
 
Example #14
Source File: AttributesHolder.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSAttGroupDecl> iterateAttGroups() {
    return new Iterators.Adapter<XSAttGroupDecl,Ref.AttGroup>(attGroups.iterator()) {
        protected XSAttGroupDecl filter(AttGroup u) {
            return u.get();
        }
    };
}
 
Example #15
Source File: SchemaWriter.java    From citygml4j with Apache License 2.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 #16
Source File: AttributesHolder.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public List<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 #17
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSAttGroupDecl> iterateAttGroupDecls() {
    return new Iterators.Map<XSAttGroupDecl,XSSchema>(iterateSchema()) {
        protected Iterator<XSAttGroupDecl> apply(XSSchema u) {
            return u.iterateAttGroupDecls();
        }
    };
}
 
Example #18
Source File: AttributesHolder.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Set<XSAttGroupDecl> getAttGroups() {
    return new AbstractSet<XSAttGroupDecl>() {
        public Iterator<XSAttGroupDecl> iterator() {
            return iterateAttGroups();
        }

        public int size() {
            return attGroups.size();
        }
    };
}
 
Example #19
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
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>");
	}
 
Example #20
Source File: SchemaWalker.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
	for (XSAttributeUse u : decl.getAttributeUses())
		if (shouldWalk && visited.add(u))
			attributeUse(u);
}
 
Example #21
Source File: XmlFormBuilder.java    From dynaform with Artistic License 2.0 4 votes vote down vote up
public XmlForm attGroupDecl(XSAttGroupDecl decl) {
  if (log.isDebugEnabled())
    log.debug("Attribute Group Declaration: " + decl);

  return null;
}
 
Example #22
Source File: DefaultFunctionImpl.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public T attGroupDecl(XSAttGroupDecl decl) {
	return defaultValue(decl);
}
 
Example #23
Source File: FindXSElementDeclVisitor.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
}
 
Example #24
Source File: SimpleTypeVisitor.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
	todo("Attribute group declaration [" + decl.getName() + "].");
}
 
Example #25
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void dumpRef( XSAttGroupDecl decl ) {
	println(MessageFormat.format("<attributeGroup ref=\"'{'{0}'}'{1}\"/>", decl.getTargetNamespace(), decl.getName()));
}
 
Example #26
Source File: SimpleTypeAnalyzer.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public T attGroupDecl(XSAttGroupDecl arg0) {
	return null;
}
 
Example #27
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void schema( XSSchema s) {
	
	if(this.elementsMap.size() != 0){

	StringBuffer sb = new StringBuffer();
     
     for(String prefix : uriMapping.keySet()){
    	 
    	 String uri = uriMapping.get(prefix);
    	 if(Const.schemaNamespace.equalsIgnoreCase(uri)) rootPrefix = prefix+":";
    	 sb.append("xmlns:"+prefix+"=\""+uri+"\" " );
    	 
     }
     
     if(!s.getTargetNamespace().isEmpty()){
    	 println(MessageFormat.format("<schema {0} targetNamespace=\"{1}\">",sb.toString(),s.getTargetNamespace()));
     }else{
    	 println(MessageFormat.format("<schema {0} >",sb.toString()));
     }
     
      indent++;

      Iterator<XSAttGroupDecl> itrAGD = s.iterateAttGroupDecls();
      while (itrAGD.hasNext()) {
    	  attGroupDecl(itrAGD.next());
      }

      Iterator<XSAttributeDecl> itrAD = s.iterateAttributeDecls();
      while(itrAD.hasNext()) {
    	  attributeDecl(itrAD.next());
      }

      Iterator<XSComplexType> itrCT = s.iterateComplexTypes();
      while(itrCT.hasNext()) {
    	  complexType(itrCT.next());
      }
      
      Iterator<XSElementDecl> itrED = s.iterateElementDecls();
      while(itrED.hasNext()) {
    	  elementDecl(itrED.next());
      } 
      
      Iterator<XSModelGroupDecl> itrMGD = s.iterateModelGroupDecls();
      while(itrMGD.hasNext()) {
    	  modelGroupDecl(itrMGD.next()); 
      }

      Iterator<XSSimpleType> itrST = s.iterateSimpleTypes();
      while(itrST.hasNext()) {
    	  simpleType(itrST.next());
      }

      indent--;
      println("</schema>");
	}
	//}

   
}
 
Example #28
Source File: CollectSimpleTypeNamesVisitor.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
	// todo("Attribute group declaration [" + decl.getName() + "].");
}
 
Example #29
Source File: CollectEnumerationValuesVisitor.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void attGroupDecl(XSAttGroupDecl decl) {
	// todo("Attribute group declaration [" + decl.getName() + "].");
}
 
Example #30
Source File: GroupInterfaceGenerator.java    From jaxb2-rich-contract-plugin with MIT License 4 votes vote down vote up
private Map<QName, DefinedInterfaceOutline> generateGroupInterfaces(final Iterator<? extends XSDeclaration> groupIterator) throws SAXException {
	final Map<QName, DefinedInterfaceOutline> groupInterfaces = new HashMap<>();

	// create interface for each group
	while (groupIterator.hasNext()) {
		final XSDeclaration modelGroup = groupIterator.next();
		if (!getReferencedInterfaces().containsKey(PluginContext.getQName(modelGroup))) {
			final DefinedInterfaceOutline interfaceOutline = createInterfaceDeclaration(modelGroup);
			if (interfaceOutline != null) {
				groupInterfaces.put(interfaceOutline.getName(), interfaceOutline);
				if (this.episodeBuilder != null) {
					this.episodeBuilder.addInterface(interfaceOutline.getSchemaComponent(), interfaceOutline.getImplClass());
				}
			}
		}
	}

	// Associate interfaces with superinterfaces
	for (final DefinedInterfaceOutline typeDef : groupInterfaces.values()) {
		final XSDeclaration classComponent = typeDef.getSchemaComponent();
		final Collection<? extends XSDeclaration> groupRefs = (classComponent instanceof XSAttGroupDecl) ? ((XSAttGroupDecl) classComponent).getAttGroups() : findModelGroups(((XSModelGroupDecl) classComponent).getModelGroup());
		for (final XSDeclaration groupRef : groupRefs) {
			if (!PluginContext.getQName(groupRef).equals(typeDef.getName())) {
				InterfaceOutline superInterfaceOutline = groupInterfaces.get(PluginContext.getQName(groupRef));
				if (superInterfaceOutline == null) {
					superInterfaceOutline = getReferencedInterfaceOutline(PluginContext.getQName(groupRef));
				}
				if (superInterfaceOutline != null) {
					typeDef.addSuperInterface(superInterfaceOutline);
					typeDef.getImplClass()._implements(superInterfaceOutline.getImplClass());
					if(typeDef.getSupportInterface() != null) {
						typeDef.getSupportInterface()._implements(superInterfaceOutline.getSupportInterface());
					}
					putGroupInterfaceForClass(typeDef.getImplClass().fullName(), superInterfaceOutline);
				}
			}
		}
	}

	return groupInterfaces;
}