I've got a schema file (four, actually - one includes the other three) and
am trying to create a 'sample' XML file from it.
I tried reading the .xsd files myself but the four of them combined add up
to more than 4000 lines - more than enough to put me to sleep.
I also tried some Java:
SchemaFactory sf =
SchemaFactory.n ewInstance(XMLC onstants.W3C_XM L_SCHEMA_NS_URI );
Schema schema = sf.newSchema(ne w File("/path/to/main/schema/file.xsd"));
DocumentBuilder Factory dbf = DocumentBuilder Factory.newInst ance();
dbf.setSchema(s chema);
dbf.setNamespac eAware(true);
dbf.setValidati ng(true);
dbf.setXInclude Aware(true);
DocumentBuilder db = dbf.newDocument Builder();
Document d = db.newDocument( );
which compiles & runs without incident when run from the directory with the
schema files, but produces an empty Document (zero child nodes).
I'm working on getting a sample XML document from the folks I got the schema
from, but that might take a while.
I've looked around in NetBeans and IntelliJ but haven't seen anything that
looks like it'll do what I want. They can both _validate_ an existing XML
file, but that's what I'm trying to create.
Is there a way to do this?
I realize it might not be possible - some of the nodes might be 'choose
exactly one of A or B', or 'if you have X you must also have Y but if not
then you must have Z' and I'd then need some way of saying which option(s)
to go with.
I really don't care what values the text/numeric fields have; empty (or
zero) would be fine - I can stuff 'realistic' data in afterward, once I've
got the structure of the document spelled out.
thanks!
--
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI 48104-5131
am trying to create a 'sample' XML file from it.
I tried reading the .xsd files myself but the four of them combined add up
to more than 4000 lines - more than enough to put me to sleep.
I also tried some Java:
SchemaFactory sf =
SchemaFactory.n ewInstance(XMLC onstants.W3C_XM L_SCHEMA_NS_URI );
Schema schema = sf.newSchema(ne w File("/path/to/main/schema/file.xsd"));
DocumentBuilder Factory dbf = DocumentBuilder Factory.newInst ance();
dbf.setSchema(s chema);
dbf.setNamespac eAware(true);
dbf.setValidati ng(true);
dbf.setXInclude Aware(true);
DocumentBuilder db = dbf.newDocument Builder();
Document d = db.newDocument( );
which compiles & runs without incident when run from the directory with the
schema files, but produces an empty Document (zero child nodes).
I'm working on getting a sample XML document from the folks I got the schema
from, but that might take a while.
I've looked around in NetBeans and IntelliJ but haven't seen anything that
looks like it'll do what I want. They can both _validate_ an existing XML
file, but that's what I'm trying to create.
Is there a way to do this?
I realize it might not be possible - some of the nodes might be 'choose
exactly one of A or B', or 'if you have X you must also have Y but if not
then you must have Z' and I'd then need some way of saying which option(s)
to go with.
I really don't care what values the text/numeric fields have; empty (or
zero) would be fine - I can stuff 'realistic' data in afterward, once I've
got the structure of the document spelled out.
thanks!
--
Al Dunstan, Software Engineer
OptiMetrics, Inc.
3115 Professional Drive
Ann Arbor, MI 48104-5131
Comment