Thanks. Will tr to use this as the base for a new HOW-TO.
Regards
Werner Guttmann
upino wrote:
HOW TO write an xml schema coping types from another xml Schema:
SchemaReader sr;
//Reads the schema
sr = new SchemaReader("file.xsd");
Schema schema = sr.read();
//the schema that i'll write
Schema mySchema = new Schema(prefix,namespace);
//add a complex type defined in the schema file.xsd
ComplexType ct = schema.getComplexType("typename");
ct.setSchema(mySchema);
mySchema.addComplexType(ct);
//add a simple type defined in the schema file.xsd
SimpleType st =schema.getSimpleType("typename");
st.setSchema(mySchema);
mySchema.addSimpleType(st);
//add a new element referred to a type previously added
ElementDecl ele =new ElementDecl(mySchema,"pippo");
ele.setTypeReference(st.getName());
mySchema.addElementDecl(ele);
FileWriter fw =new FileWriter("outputfile.xsd");
SchemaWriter sw = new SchemaWriter(fw);
sw.write(mySchema);
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email