From: Andrew Fawcett [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 8:56 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Create Instance from Schema using Xerces
The XML Schema parser is part of this functionality, you can use it standalone like so...then starting from a given element object from Schema object recurse down to create your empty XML instance?This is an example....
// Parser XML Schema
SchemaUnmarshaller schemaHandler = new SchemaUnmarshaller();
Parser parser = ParserFactory.makeParser();
parser.setDocumentHandler(schemaHandler);
parser.parse("file:"+inputFile);
Schema schema = schemaHandler.getSchema();
... = schema.getComplexTypes()
... = schema.getElementDecls()
-----Original Message-----
From: Wang, Changzhou [mailto:[EMAIL PROTECTED]
Sent: 19 April 2001 15:48
To: '[EMAIL PROTECTED]'
Subject: RE: Create Instance from Schema using XercesThank you, Andrew. But the library there generates a set of Java Class for each XML Schema. In order to generate instances, we probably need to modify each generated Java Class to generate a piece of text. Though useful in many situations, it does not fit our needs. We want a general way to generate instance from Schema without additional programming effort (aren't we lazy ;-).Chang-----Original Message-----
From: Andrew Fawcett [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 19, 2001 8:30 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Create Instance from Schema using XercesThe http://castor.exolab.org/ library has a great API and object model for parsing XML Schemas in it's org.exolab.castor.xml.schema package. You might want to try this.... ;-)
-----Original Message-----
From: Wang, Changzhou [mailto:[EMAIL PROTECTED]]
Sent: 19 April 2001 15:25
To: '[EMAIL PROTECTED]'
Subject: RE: Create Instance from Schema using Xerces
Correct me if I am wrong here:
To create an instance XML document from a schema, you need a lot of controlling parameters (refer to IBM XMLGenerator, which creates instances from DTD). I guess you probably have to decide the your own logic of the generation process.
On the other hand, since Xerces does support Schema validation, it surely parse the Schema somewhere. It looks to me that there is no open API for such a Schema parser and there is no standard data structure for representing Schema. I am wondering whether the Xerces development group can make an effort to provide such an API and documentation?
Anyway, Daniel, if you happen to know any other solution, would you please let me know ([EMAIL PROTECTED])? Thanks!
Chang
> -----Original Message-----
> From: Daniel Pfuhl [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 2:50 AM
> To: Xerces-List
> Subject: Create Instance from Schema using Xerces
>
>
> Hi
>
> is there anybody outside who has
> already done this??
> I would like to parse a schema and
> create an instance of this schema.
> Afterwards I would like to parse
> this instance for validity.
>
> Can someone tell me if this is in
> general possible with this version
> of Xerces? Don't hit me because I'm
> very new to Xerces itself. I only
> used it in Cocoon for serving XML-
> based Websites.
>
> But now I want to go deeper into
> it. So it would be very kind of
> you helping me with some
> trend-setting (for my foggy
> thoughts only)information using
> Xerces.
>
> BTW: I decided to use DOM for my
> final goal. Is this the right
> decision or should I use SAX?
>
> Thanx for pointing me in the right
> direction....
>
> daniel
>
> ----------------------------------
> Daniel Pfuhl
> mailto:[EMAIL PROTECTED]
> ______________________________________________________________
> _________________
> Alles unter einem Dach: Informationen, Fun, E-Mails. Bei
> WEB.DE: http://web.de
> Die gro�e Welt der Kommunikation: E-Mail, Fax, SMS, WAP:
http://freemail.web.de
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
