Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » XML Parsing
XML Parsing [message #31734] Tue, 22 March 2011 11:09 Go to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Is there a good doc or example explaining how to parse XML ?

I looked at the code in Core.cpp, and in examples XMLViewer and AddressBookXML, but not very easy to understand well how it works... I'd like to have some functions and methods description, but I was unable to find.

I already succeeded in parsing partially the XML result from ISBNdb. Here is an example :
<?xml version="1.0" encoding="UTF-8"?>

<ISBNdb server_time="2011-03-21T10:24:29Z">
<BookList total_results="1" page_size="10" page_number="1" shown_results="1">
<BookData book_id="diagnostic_histopathology_of_tumors_2_volume_set_with_cd_rom" isbn="0443074348" isbn13="9780443074349">
<Title>Diagnostic histopathology of tumors</Title>
<TitleLong></TitleLong>
<AuthorsText>edited by Christopher D. M. Fletcher</AuthorsText>
<PublisherText publisher_id="churchill_livingstone_else_a01">[Edinburgh] ; Philadelphia : Churchill Livingstone Elsevier, 2007.</PublisherText>
<Details change_time="2008-02-28T22:30:14Z" price_time="2011-03-02T01:11:15Z" edition_info="(set)" language="eng" physical_description_text="2 v. (x, 1883, 41 p.) : ill. (some col.) ; 29 cm. + 2 CD-ROMs." lcc_number="" dewey_decimal_normalized="616.99407583" dewey_decimal="616.99407583" />
</BookData>
</BookList>
</ISBNdb>


I'm able to retrieve the text for Title, Titlelong, AuthorsText and so on, but now, I want to retrieve the <Details> : change_time, price_time, edition_info, language and so on. Not yet found the right way to do that... Some help should be appreciated !

Thks.
Re: XML Parsing [message #31737 is a reply to message #31734] Tue, 22 March 2011 13:14 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3398
Registered: August 2008
Senior Veteran
Hello Jibe

You have other example in Bazaar/PainterSvg_demo that uses PainterSvg package to parse and show simple svg files. You can find .svg files in PainterSvg_demo folder.

Go to function ParseSVG() and choose for example SvgPaint_Line() to get the attributes of a line. This is an example:

<line x1="417" y1="75" x2="346" y2="133"
        style=" stroke-opacity: 1; ;stroke-width: 4;stroke:#ff8000"/>


Best regards
IƱaki
Re: XML Parsing [message #31738 is a reply to message #31734] Tue, 22 March 2011 13:52 Go to previous messageGo to next message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Thanks, Koldo Smile Seems very simple with an example ! I'll try it, but I'm sure that I'll be able to make it work.
Re: XML Parsing [message #31748 is a reply to message #31734] Wed, 23 March 2011 22:10 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14105
Registered: November 2005
Ultimate Member
jibe wrote on Tue, 22 March 2011 06:09

Hi,

Is there a good doc or example explaining how to parse XML ?

I looked at the code in Core.cpp, and in examples XMLViewer and AddressBookXML, but not very easy to understand well how it works... I'd like to have some functions and methods description, but I was unable to find.



Also try http://www.ultimatepp.org/reference$XML$en-us.html
Re: XML Parsing [message #31753 is a reply to message #31734] Thu, 24 March 2011 15:42 Go to previous message
jibe is currently offline  jibe
Messages: 294
Registered: February 2007
Location: France
Experienced Member
Hi,

Ok, thanks Smile

I succeeded to parse, working well now Cool
Previous Topic: HelloWork - undefined reference to symbol 'FT_New_Face'
Next Topic: httpclient : problem with some permanently redirected pages
Goto Forum:
  


Current Time: Fri Nov 01 00:41:00 CET 2024

Total time taken to generate the page: 0.03913 seconds