Re: [xml] Fwd: Value out of element?



Hi andrew,

when I call call xmlTextReaderReadString() i got a lof of \n in the buffer, indeed then the value I looking for but als
the value of the all the text elements ir presume :-(
So when the xml looks like
<Device>John Doe</Device>
<Xxxxxx>Hello</Xxxxx>
<Yyyyyy>Worl</Yyyyyy>

I get "\n(31 spaces)John Doe\nHello\nWorld\n"

This is not exactly what I wanted. :-(

Rob
> Date: Fri, 7 Oct 2011 13:35:02 +0300
> From: andrew w nosenko gmail com
> To: rcsaba gmail com
> CC: xml gnome org
> Subject: Re: [xml] Fwd: Value out of ellement?
>
> On Thu, Oct 6, 2011 at 18:13, Csaba Raduly <rcsaba gmail com> wrote:
> > Forward to the list too
> > ---------- Forwarded message ----------
> > From: Csaba Raduly <rcsaba gmail com>
> > Date: Thu, Oct 6, 2011 at 5:12 PM
> > Subject: Re: [xml] Value out of ellement?
> > To: Rob Eisink <reisreg hotmail com>
> >
> >
> > On Thu, Oct 6, 2011 at 5:03 PM, Rob Eisink  wrote:
> >> Let me more clear..
> >>
> >> The xml looks like <Device>JohnDoe</Device>
> >> I call name = xmlTextReaderName(reader);
> >>
> >> the name is Device
> >
> > That means you are on a XML_READER_TYPE_ELEMENT.
> >
> > When you use the xml reader, your xml line will appear as three nodes:
> > XML_READER_TYPE_ELEMENT          for <Device>
> > XML_TEXT_READER_TEXT                   for JohnDoe
> > XML_READER_TYPE_END_ELEMENT for </Device>
> >
> > You need to call xmlTextReaderRead to move to the XML_TEXT_READER_TEXT
> > node, then call xmlTextReaderValue
> >
>
> As slightly simpler alternative: just move Reader to the <Device> node
> and call xmlTextReaderReadString().
>
> --

> Date: Fri, 7 Oct 2011 13:35:02 +0300
> From: andrew w nosenko gmail com
> To: rcsaba gmail com
> CC: xml gnome org
> Subject: Re: [xml] Fwd: Value out of ellement?
>
> On Thu, Oct 6, 2011 at 18:13, Csaba Raduly <rcsaba gmail com> wrote:
> > Forward to the list too
> > ---------- Forwarded message ----------
> > From: Csaba Raduly <rcsaba gmail com>
> > Date: Thu, Oct 6, 2011 at 5:12 PM
> > Subject: Re: [xml] Value out of ellement?
> > To: Rob Eisink <reisreg hotmail com>
> >
> >
> > On Thu, Oct 6, 2011 at 5:03 PM, Rob Eisink  wrote:
> >> Let me more clear..
> >>
> >> The xml looks like <Device>JohnDoe</Device>
> >> I call name = xmlTextReaderName(reader);
> >>
> >> the name is Device
> >
> > That means you are on a XML_READER_TYPE_ELEMENT.
> >
> > When you use the xml reader, your xml line will appear as three nodes:
> > XML_READER_TYPE_ELEMENT          for <Device>
> > XML_TEXT_READER_TEXT                   for JohnDoe
> > XML_READER_TYPE_END_ELEMENT for </Device>
> >
> > You need to call xmlTextReaderRead to move to the XML_TEXT_READER_TEXT
> > node, then call xmlTextReaderValue
> >
>
> As slightly simpler alternative: just move Reader to the <Device> node
> and call xmlTextReaderReadString().
>
> --
> Andrew W. Nosenko <andrew w nosenko gmail com>
> _______________________________________________
> xml mailing list, project page http://xmlsoft.org/
> xml gnome org
> http://mail.gnome.org/mailman/listinfo/xml


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