XML parsing with xerces

Discussion in 'C++' started by MBR, Oct 10, 2004.

  1. MBR

    MBR Guest

    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
     
    MBR, Oct 10, 2004
    #1
    1. Advertising

  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?


    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
     
    Gianni Mariani, Oct 10, 2004
    #2
    1. Advertising

  3. MBR

    Rolf Magnus Guest

    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?
     
    Rolf Magnus, Oct 10, 2004
    #3
  4. MBR

    MBR Guest

    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
     
    MBR, Oct 12, 2004
    #4
  5. MBR

    red floyd Guest

    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.
     
    red floyd, Oct 12, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Smith
    Replies:
    3
    Views:
    1,987
    Roedy Green
    Sep 27, 2005
  2. bugbear
    Replies:
    0
    Views:
    1,018
    bugbear
    Aug 28, 2003
  3. Kane

    XML parsing with Xerces

    Kane, May 12, 2004, in forum: XML
    Replies:
    0
    Views:
    472
  4. cvissy
    Replies:
    0
    Views:
    609
    cvissy
    Nov 16, 2004
  5. Cigdem
    Replies:
    2
    Views:
    3,493
    Cigdem Savaseri-Brackmann
    Mar 17, 2005
Loading...

Share This Page