Hi,

Ok I made the changes to the XML file.
I think im going to use Dom, i read that it allows saving & creating XML
files. I need to use this eventually & because I have a short timeframe I
just want to get used to one method. IIs this Ok, will Dom Fufil my needs?

Also How would I start to impliment the Dom (for reading files)... dont see
a constructor anywhere in the docs...Is it createDOMBuilder ??

Cheers
Alex


Alberto Massari wrote:
> 
> At 16.15 14/12/2006 -0800, appleGuy wrote:
> 
>>Hi,
>>
>>This could be quite a long thread, so please bear with me.
>>Ok ive got Xerces installed & its compiling the example correctly.
>>
>>Now im totally new to XML let alone this parser. Ive contructed the
>>following xml file. I need the file to contain data that can be parsed &
>>values loaded into predefined variables within my application.. Firstly I
>>suppose I need to know if my XML file is ok: (the example uses place
holders
>>so author in a real file would be a persons name)
>>
>><?xml version="1.0" encoding="ISO-8859-1"?>
>><loopcardprj>
>>         <_prjsetup>
>>                 <title>untitled</title>
>>                 <author>author</author>
>>                 <subject>subject</subject>
>>                 <card>subject</card>
>>         </_prjsetup>
>>         <_questions>"What Is 5 x 3?","What Is 5 x 5?","What Is 5 x 
>> 5?"</_questions>
>>         <_answers>"15","25","10"</_answers>
>>         <_comment>This is an example of a file layout for the 
>> LoopCard Software By
>>Alex Curtis</_comment>
>></loopcardprj>
> 
> The XML is well-formed; but I would rather use this structure, in 
> order to avoid complex application logic to associate a question with 
> its answer:
> 
>          <_questions>
>                  <question>
>                          <q>What Is 5 x 3?</q>
>                           15 
>                  </question>
>                  <question>
>                          <q>What Is 5 x 5?</q>
>                           25 
>                  </question>
>                  <question>
>                          <q>What Is 5 + 5?</q>
>                           10 
>                  </question>
>          </_questions>
> 
>>(IF OK): I need to know how to use the parser to parse this file & dump
the
>>data into the correct variables. I read that DOMBuilder was the class to
>>use???
> 
> DOMBuilder will build a DOM tree that you will have to navigate 
> (DOMDocument->getDocumentElement() will give you the pointer to the 
> "loopcardprj" node; from there, getFirstChild()/getNextSibling() will 
> give you either text nodes containing whitespace or the 
> "_prjsetup"/"_questions" element; and so on.. until you will find 
> some text nodes containing the real data).
> Alternatively you can use a SAXParser or a SAX2XMLReader that will 
> convert the file into a sequence of callbacks (start "loopcardprj" 
> element; start "_prjsetup" element; start "title" element; found data 
> "untitled"; end "title" element...); if you just need to convert the 
> XML file into a C++ data structure, this would be the choice I would made.
> 
> Alberto
> 
> 
>>Please If you could help, im really new to this XML / Parsing Business...
>>
>>
>>Many Thanks
>>-Alex
>>--
>>View this message in context: 
>>http://www.nabble.com/Starting-To-Use-Xerces-tf2824403.html#a7884089
>>Sent from the Xerces - C - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Starting-To-Use-Xerces-tf2824403.html#a7891431
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to