Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > XML parsing with xerces

Reply
Thread Tools

XML parsing with xerces

 
 
MBR
Guest
Posts: n/a
 
      10-10-2004
Help!

Does anybody know a simple example how to use xerces
(http://xml.apache.org) with C++ to parse a simple xml file, go from
node to node and read the data in the nodes?

Thanks,

Matthias
 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      10-10-2004
MBR wrote:
> Help!
>
> Does anybody know a simple example how to use xerces
> (http://xml.apache.org) with C++ to parse a simple xml file, go from
> node to node and read the data in the nodes?


I suggest you try the Xerces forums. They probably know alot more that
those answering questions in this NG. This question really is not
on-topic here. Read the FAQ. http://www.parashift.com/c++-faq-lite/

BTW - I've used libxml2 http://xmlsoft.org/ . It's simpler than Xerces
IMHO and has a C++ http://libxmlplusplus.sourceforge.net/ - although
it's pretty trivial to roll your own.

G
 
Reply With Quote
 
 
 
 
Rolf Magnus
Guest
Posts: n/a
 
      10-10-2004
MBR wrote:

> Help!
>
> Does anybody know a simple example how to use xerces
> (http://xml.apache.org) with C++ to parse a simple xml file, go from
> node to node and read the data in the nodes?


Uhm, what about the xerces code samples from ... well ... just the site you
mentioned?

 
Reply With Quote
 
MBR
Guest
Posts: n/a
 
      10-12-2004
Hi,

probably I was not specific enough.

I try the sample from the xerces homepage
http://xml.apache.org/xerces-c/program-dom.html, take the iterator and
step through the tree:

for (DOMNode* pCurrent = iterator->nextNode();pCurrent != 0; pCurrent
= iterator->nextNode())
{
string strValue = XMLString::transcode(pCurrent->getNodeValue());
std::cout << strValue << std::endl;
(...)
}

With that way I can retrieve the values from the tree. Now, how can I
get the element structure? How can I query the attribute?

Thanks,

Matthias


Gianni Mariani wrote:
>
> MBR wrote:
> > Help!
> >
> > Does anybody know a simple example how to use xerces
> > (http://xml.apache.org) with C++ to parse a simple xml file, go from
> > node to node and read the data in the nodes?

>
> I suggest you try the Xerces forums. They probably know alot more that
> those answering questions in this NG. This question really is not
> on-topic here. Read the FAQ. http://www.parashift.com/c++-faq-lite/
>
> BTW - I've used libxml2 http://xmlsoft.org/ . It's simpler than Xerces
> IMHO and has a C++ http://libxmlplusplus.sourceforge.net/ - although
> it's pretty trivial to roll your own.
>
> G

 
Reply With Quote
 
red floyd
Guest
Posts: n/a
 
      10-12-2004
MBR wrote:

> Hi,
>
> probably I was not specific enough.
>
> [redacted]
>
> With that way I can retrieve the values from the tree. Now, how can I
> get the element structure? How can I query the attribute?
>
> [redacted]


No, you were specific enough. The problem is that how to use Xerces (or
insert your favorite third party library here) is Off Topic for c.l.c++.
You might be better off in comp.text.xml, or on an apache specific forum.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XML Parsing Problems with SAX xerces John Smith Java 3 09-27-2005 05:50 AM
XML file parsing/validating with xerces-j Cigdem XML 2 03-17-2005 09:49 AM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
XML parsing with Xerces Kane XML 0 05-12-2004 03:26 AM
parsing XML to DOM, validating against a local DTD, using Xerces under JAXP? bugbear XML 0 08-28-2003 09:22 AM



Advertisments