com.sun.xml.xsom.XSSchema Java Examples

The following examples show how to use com.sun.xml.xsom.XSSchema. 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: ElementDecl.java    From citygml4j with Apache License 2.0 6 votes vote down vote up
private boolean isDerivedFromComplexType(XSSchema schema, String localPart) {
	XSType base = schema.getType(localPart);
	if (base != null) {
		if (base.isSimpleType()) {
			typeFlag.add(TypeFlag.NO_ABSTRACT_GML);
			typeFlag.add(TypeFlag.NO_FEATURE);
			typeFlag.add(TypeFlag.NO_FEATURE_COLLECTION);
			typeFlag.add(TypeFlag.NO_CITY_OBJECT);
			typeFlag.add(TypeFlag.NO_GEOMETRY);
			typeFlag.add(TypeFlag.NO_FEATURE_PROPERTY);
			typeFlag.add(TypeFlag.NO_GEOMETRY_PROPERTY);

			return false;
		} else
			return element.getType().isDerivedFrom(base);
	} 

	return false;
}
 
Example #2
Source File: SoapProtocol.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
private XSSchemaSet getSchemaSet()
	throws IOException, SAXException {
	if( schemaSet == null ) {
		XSOMParser schemaParser = new XSOMParser();
		ValueVector vec = getParameterVector( "schema" );
		if( vec.size() > 0 ) {
			for( Value v : vec ) {
				schemaParser.parse( new File( v.strValue() ) );
			}
		}
		parseWSDLTypes( schemaParser );
		schemaSet = schemaParser.getResult();
		String nsPrefix = "jolie";
		int i = 1;
		for( XSSchema schema : schemaSet.getSchemas() ) {
			if( !schema.getTargetNamespace().equals( XMLConstants.W3C_XML_SCHEMA_NS_URI ) ) {
				namespacePrefixMap.put( schema.getTargetNamespace(), nsPrefix + i++ );
			}
		}
	}

	return schemaSet;
}
 
Example #3
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSNotation> iterateNotations() {
    return new Iterators.Map<XSNotation,XSSchema>(iterateSchema()) {
        protected Iterator<XSNotation> apply(XSSchema u) {
            return u.iterateNotations();
        }
    };
}
 
Example #4
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 #5
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public void visit( XSSchemaSet s ) {
	Iterator<XSSchema> itr =  s.iterateSchema();
	while(itr.hasNext()) {
		schema((XSSchema)itr.next());
		println();
	}
}
 
Example #6
Source File: SchemaHandler.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
private XSSchemaSet getXSSchemaSet(String namespaceURI) {
	for (XSSchemaSet schemaSet : schemaSets)
		for (XSSchema schema : schemaSet.getSchemas())
			if (schema.getTargetNamespace().equals(namespaceURI))
				return schemaSet;

	return null;
}
 
Example #7
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void visit( XSSchemaSet s ) {
    Iterator<XSSchema> itr =  s.iterateSchema();
    while(itr.hasNext()) {
        schema(itr.next());
        println();
    }
}
 
Example #8
Source File: Axis.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSSchema> iterator(Iterator<? extends XSComponent> contextNodes) {
    if(!contextNodes.hasNext())
        return Iterators.empty();
    else
        // this assumes that all current nodes belong to the same owner.
        return iterator(contextNodes.next());
}
 
Example #9
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void visit( XSSchemaSet s ) {
    Iterator itr =  s.iterateSchema();
    while(itr.hasNext()) {
        schema((XSSchema)itr.next());
        println();
    }
}
 
Example #10
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 #11
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSIdentityConstraint> iterateIdentityConstraints() {
    return new Iterators.Map<XSIdentityConstraint,XSSchema>(iterateSchema()) {
        protected Iterator<XSIdentityConstraint> apply(XSSchema u) {
            return u.getIdentityConstraints().values().iterator();
        }
    };
}
 
Example #12
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSComplexType> iterateComplexTypes() {
    return new Iterators.Map<XSComplexType,XSSchema>(iterateSchema()) {
        protected Iterator<XSComplexType> apply(XSSchema u) {
            return u.iterateComplexTypes();
        }
    };
}
 
Example #13
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSSimpleType> iterateSimpleTypes() {
    return new Iterators.Map<XSSimpleType,XSSchema>(iterateSchema()) {
        protected Iterator<XSSimpleType> apply(XSSchema u) {
            return u.iterateSimpleTypes();
        }
    };
}
 
Example #14
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSModelGroupDecl> iterateModelGroupDecls() {
    return new Iterators.Map<XSModelGroupDecl,XSSchema>(iterateSchema()) {
        protected Iterator<XSModelGroupDecl> apply(XSSchema u) {
            return u.iterateModelGroupDecls();
        }
    };
}
 
Example #15
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 #16
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSAttributeDecl> iterateAttributeDecls() {
    return new Iterators.Map<XSAttributeDecl,XSSchema>(iterateSchema()) {
        protected Iterator<XSAttributeDecl> apply(XSSchema u) {
            return u.iterateAttributeDecls();
        }
    };
}
 
Example #17
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSElementDecl> iterateElementDecls() {
    return new Iterators.Map<XSElementDecl,XSSchema>(iterateSchema()) {
        protected Iterator<XSElementDecl> apply(XSSchema u) {
            return u.iterateElementDecls();
        }
    };
}
 
Example #18
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 5 votes vote down vote up
public Iterator<XSType> iterateTypes() {
    return new Iterators.Map<XSType,XSSchema>(iterateSchema()) {
        protected Iterator<XSType> apply(XSSchema u) {
            return u.iterateTypes();
        }
    };
}
 
Example #19
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSType getType(String ns, String localName) {
    XSSchema schema = getSchema(ns);
    if(schema==null)    return null;

    return schema.getType(localName);
}
 
Example #20
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSSchema getSchema(String targetNamespace) {
    return schemas.get(targetNamespace);
}
 
Example #21
Source File: Schema.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public XSSchema getXSSchema() {
	return schema;
}
 
Example #22
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSSchema getSchema(int idx) {
    return schemas2.get(idx);
}
 
Example #23
Source File: SchemaWalker.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void visit(XSSchema schema) {
	if (shouldWalk && visited.add(schema))
		schema(schema);
}
 
Example #24
Source File: SchemaWalker.java    From citygml4j with Apache License 2.0 4 votes vote down vote up
public void visit(XSSchemaSet schemas) {
	for (XSSchema schema : schemas.getSchemas())
		if (shouldWalk && visited.add(schema))
			schema(schema);
}
 
Example #25
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Iterator<XSSchema> iterateSchema() {
    return schemas2.iterator();
}
 
Example #26
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 #27
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public final Collection<XSSchema> getSchemas() {
    return readonlySchemaList;
}
 
Example #28
Source File: SimpleTypeAnalyzer.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public T schema(XSSchema arg0) {
	return null;
}
 
Example #29
Source File: XMLSchemaProcessor.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
private XSSimpleType parse ( SchemaSimpleType schemaSimpleType ) {

        ClassLoader cldr = this.getClass().getClassLoader();

        InputStream resourceXMLSchema = cldr.getResourceAsStream( schemaSimpleType.getSchemaFilePath() );

        File localXMLSchema = new File( schemaSimpleType.getTypeName() + ".xsd" );
        try {
            InputStream in = resourceXMLSchema;
            // Overwrite the file.
            OutputStream out = new FileOutputStream( localXMLSchema );

            while (in.available() > 0) {
                byte[] buf = new byte[1024];
                int len;
                while ((len = in.read( buf )) > 0) {
                    out.write( buf, 0, len );
                }
            }
            in.close();
            out.close();

        } catch (IOException iOException) {
        }


        XSSimpleType st = null;
        try {
            XSOMParser parser = new XSOMParser();
            parser.parse( localXMLSchema );
            XSSchemaSet schemaSet = parser.getResult();
            XSSchema xsSchema = schemaSet.getSchema( 1 );

            st = xsSchema.getSimpleType( schemaSimpleType.getTypeName() );

        } catch (Exception exp) {
            exp.printStackTrace( System.out );
        }

        localXMLSchema.delete();

        return st;
    }
 
Example #30
Source File: Axis.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Iterator<XSSchema> iterator(XSComponent contextNode) {
    return contextNode.getRoot().iterateSchema();
}