473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XML parsing with xerces

MBR
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
Jul 22 '05 #1
4 4411
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
Jul 22 '05 #2
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?

Jul 22 '05 #3
MBR
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

Jul 22 '05 #4
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.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bugbear | last post by:
Subject pretty much says it all. I'd like to parse XML (duh!) using Xerces (because its fast, and reliable, and comprehensive, and supports lots of features). I'd like to conform to standards...
5
by: Aleksandar Matijaca | last post by:
Hi there, I am in some need of help. I am trying to parse using the apache sax parser a file that has vaid UTF-8 characters - I keep end up getting a sun.io.MalformedInputException error. ...
1
by: Hans Bijvoet | last post by:
Hello, I'm trying to parse a HTML document with the SAX parser from Xerces. The parser throws a fatal error when attribute values in the document are not surrounded by quotes? How can I prevent...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
3
by: Girish | last post by:
Hi All, I have written a component(ATL COM) that wraps Xerces C++ parser. I am firing necessary events for each of the notifications that I have handled for the Content and Error handler. The...
8
by: pradeepsarathy | last post by:
Hi all, Does the SAX parser has eventhandlers for parsing xml schema. Can we parse the xml schema the same way as we parse the xml document using SAX Parser. Thanks in advance. -pradeep
24
by: Marc Dubois | last post by:
hi, is it possible to parse an XML file in C so that i can fulfill these requirements : 1) replace all "<" and ">" signs inside the body of tag by a space, e.g. : Example 1: <fooblabla < bla...
0
by: jimmy Zhang | last post by:
VTD-XML (http://vtd-xml.sf.net) may also be interesting to you "Martin Honnen" <mahotrash@yahoo.dewrote in message news:47cd3ee6$0$25510$9b4e6d93@newsspool1.arcor-online.net...
1
by: Sidhartha | last post by:
Hi, I am facing a problem while parsing local language characters using sax parser. We use DOM to parse and SAX to read the source. But when our application parses strings with local language...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.