Re: [xml] Clone the reader?

On Wed, Feb 10, 2010 at 04:58:05PM +0100, Csaba Raduly wrote:
I'm using the xmlreader interface to parse a document defined by a
schema. When there is a node defined by a union

<xsd:simpleType name="MyUnion3">
  <xsd:union memberTypes="xsd:string xsd:boolean xsd:decimal xsd:time
xsd:float xsd:double">

processing is supposed to try all alternatives (try to decode it as a
string, then as a boolean, etc) until one is successful. However, this
would require the reader to back up each time, which doesn't appear to
be possible. Is there a way to implement this, perhaps by cloning the
parser at that point for each alternative ?

  The reader is somehow a wrapper around a parser, and a parser can't be
"cloned". But in your case I really don't see why you would need to
roll back in parsing...that's not needed just check the value. Though I
really don't see how you're gonna be able to desambiguate between
options for example xsd:float and xsd:double ... That schemas makes no
sense to me...


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]