egelev
egelev

Reputation: 1205

Java API for XML Schema manipulation

I am familiar with JAXB, JAXP and DOM. I know JAXB provides java2xml and xml2java generation(and validation against XML Schema(XSD)). What I want is convenient way to produce XML schema programmatically from scratch. I do not want to produce XSD from java classes. I want to have an object representing the schema itself. For example:

XMLSchemaFactory factory = XMLSchemaFactory.newInstance();
XMLSchema schema = factory.newSchema();
schema.setTargetNameSpace("http://www.example.com");
...
schema.addComplexType(complexTypeElement);
...
schema.addElement(name, type);
...
schema.export(new File("mySchema.xsd"));

I know XML schema is itself XML, so I can use Document, Element, Node and other classes/interfaces from org.w3c.dom, but I wonder is there something more convenient ? Why I want this - I have some IDL, which I have to translate to WSDL. I have lexer/parser for the IDL and I have convenient representation of it as java objects. Now I want to produce the WSDL using this objects => a lot of XML schemas have to be generated !

Upvotes: 3

Views: 859

Answers (1)

ashokramcse
ashokramcse

Reputation: 2861

From my point use WSDL4J it would be pretty easier for your xml manipulations.

Refer this pdf for more details.

http://wsdl4j.sourceforge.net/downloads/JSR110_proposed_final_draft.pdf

Upvotes: 1

Related Questions