com.sun.xml.xsom.impl.Const Java Examples

The following examples show how to use com.sun.xml.xsom.impl.Const. 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: NGCCRuntimeEx.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static boolean ignorableDuplicateComponent(XSDeclaration c) {
    if(c.getTargetNamespace().equals(Const.schemaNamespace)) {
        if(c instanceof XSSimpleType)
            // hide artificial "double definitions" on simple types
            return true;
        if(c.isGlobal() && c.getName().equals("anyType"))
            return true; // ditto for anyType
    }
    return false;
}
 
Example #2
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 #3
Source File: SchemaTreeTraverser.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void restrictionSimpleType(XSRestrictionSimpleType type) {

        if (type.getBaseType() == null) {
            // don't print anySimpleType
            if (!type.getName().equals("anySimpleType")) {
                throw new InternalError();
            }
            if (!Const.schemaNamespace.equals(type.getTargetNamespace())) {
                throw new InternalError();
            }
            return;
        }

        XSSimpleType baseType = type.getSimpleBaseType();

        String str = MessageFormat.format("Restriction {0}",
                new Object[]{baseType.isLocal() ? "" : " base=\"{"
                + baseType.getTargetNamespace() + "}"
                + baseType.getName() + "\""});

        SchemaTreeNode newNode = new SchemaTreeNode(str, baseType.getLocator());
        this.currNode.add(newNode);
        this.currNode = newNode;

        if (baseType.isLocal()) {
            simpleType(baseType);
        }

        Iterator itr = type.iterateDeclaredFacets();
        while (itr.hasNext()) {
            facet((XSFacet) itr.next());
        }

        this.currNode = (SchemaTreeNode) this.currNode.getParent();
    }
 
Example #4
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void restrictionSimpleType( XSRestrictionSimpleType type ) {

        if(type.getBaseType()==null) {
            // don't print anySimpleType
            if(!type.getName().equals("anySimpleType"))
                throw new InternalError();
            if(!Const.schemaNamespace.equals(type.getTargetNamespace()))
                throw new InternalError();
            return;
        }

        XSSimpleType baseType = type.getSimpleBaseType();

        println(MessageFormat.format("<restriction{0}>",
            new Object[]{
                baseType.isLocal()?"":" base=\"{"+
                baseType.getTargetNamespace()+'}'+
                baseType.getName()+'\"'
            }));
        indent++;

        if(baseType.isLocal())
            simpleType(baseType);

        Iterator itr = type.iterateDeclaredFacets();
        while(itr.hasNext())
            facet( (XSFacet)itr.next() );

        indent--;
        println("</restriction>");
    }
 
Example #5
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void restrictionSimpleType( XSRestrictionSimpleType type ) {

        if(type.getBaseType()==null) {
            // don't print anySimpleType
            if(!type.getName().equals("anySimpleType"))
                throw new InternalError();
            if(!Const.schemaNamespace.equals(type.getTargetNamespace()))
                throw new InternalError();
            return;
        }

        XSSimpleType baseType = type.getSimpleBaseType();

        println(MessageFormat.format("<restriction{0}>",
            baseType.isLocal()?"":" base=\"{"+
            baseType.getTargetNamespace()+'}'+
            baseType.getName()+'\"'));
        indent++;

        if(baseType.isLocal())
            simpleType(baseType);

        Iterator<XSFacet> itr = type.iterateDeclaredFacets();
        while(itr.hasNext())
            facet( (XSFacet)itr.next() );

        indent--;
		if (baseType.isLocal())
			println("</restriction>");
    }
 
Example #6
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 #7
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public void restrictionSimpleType( XSRestrictionSimpleType type ) {

		if(type.getBaseType()==null) {
			// don't print anySimpleType
			if(!type.getName().equals("anySimpleType"))
				throw new InternalError();
			if(!Const.schemaNamespace.equals(type.getTargetNamespace()))
				throw new InternalError();
			return;
		}

		XSSimpleType baseType = type.getSimpleBaseType();

		println(MessageFormat.format("<restriction{0}>",
				baseType.isLocal()?"":" base=\"{"+
						baseType.getTargetNamespace()+'}'+
						baseType.getName()+'\"'));
		indent++;

		if(baseType.isLocal())
			simpleType(baseType);

		Iterator<XSFacet> itr = type.iterateDeclaredFacets();
		while(itr.hasNext())
			facet( (XSFacet)itr.next() );

		indent--;
		println("</restriction>");
	}
 
Example #8
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 4 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}\">",
            new Object[]{
                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 #9
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>");
	}
	//}

   
}