473,795 Members | 3,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4442
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();pCu rrent != 0; pCurrent
= iterator->nextNode())
{
string strValue = XMLString::tran scode(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
4273
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 as much as possible, so I'd like to call Xerces under the JAXP API. I'd like to validate the XML against a DTD, so that errors are flagged up to the user, and I can transcribe
5
14064
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. This is my code:
1
3824
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 this parser's behaviour? Greetings, Hans
2
3959
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 Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
3
3071
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 events can then I am able to parse XML input in the form of files. I also have provided support for parsing of XML content in the form of string data. I am able to do so by creating a MemBufInputSource object using the XML content provided to the...
8
2705
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
2507
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 </foo> becomes <fooblabla bla </foo>
0
1420
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
3504
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 especially czech,polish,turkish in place of local language character some other word is comming. Eg: Input string :ahoj, jak se máš Output string :ahoj, jak se m&aacute;š
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.