Re: [xml] Clone the reader?



On Wed, Feb 10, 2010 at 04:58:05PM +0100, Csaba Raduly wrote:
Hi,
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">
  </xsd:union>
</xsd:simpleType>

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

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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