users@jaxb.java.net

Re: XML Schema questions

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 26 Mar 2003 16:22:15 -0800

> Is there a way to set the number of objects created, since some of my XML
> files can be very huge?

What you can do is to parse your document by a SAX parser, then from
your ContentHandler, once you hit <a>, you start forwarding SAX events
to JAXB. At </a>, you'll ask JAXB to give the object, and you can
process it, then throw it away.

Repeat this process until you process the entire document. This allows
you to just keep a small portion of data at any given time. And as a
result this is much more efficient.


> 2. Is there a way to specifiy the main node will be repeated? My following
> definition assumes there will be only one root element.
>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
> <xsd:element name="RootNode" type="XType"/>
>
> <xsd:complexType name="XType">
> <xsd:sequence>
> <xsd:element name="AccidentHeader" type ="AccidentHeaderType"
> minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
>
> </xsd:schema>
>
> Is there a way to specify the file will have multiple AccidentHeader nodes
> (no RootNodelevel)

I'm sorry, I don't understand what you mean. Why you need multiple
AccidentHeader class? Is this related to your first question?



regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com