Re: [xml] where can i find a complex example?



On Wed, 2003-01-15 at 06:59, storein wrote:
hi everybody ,

 I can dispose simple xml file by libxml after I read 
http://www.xmlsoft.org/tutorial/index.html
 but I don't dispose complex xml file ,such as :
example.xml file
----------------------------------------------------------
  <?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE story SYSTEM "example.dtd">
<story>
      <storyinfo>
              <author>John Fleck</author>
              <datewritten> June 2, 2002</datewritten>
              <keyword>example keyword</keyword>
      </storyinfo>
      <body>
              <headline>This is the headline</headline>
              <para>This is the body text</para>
      </body>
</story>
---------------------------------------------------
example.dtd file
--------------------------------------
<?xml version="1.0" encoding="UTF-8"?>


<!ELEMENT story (storyinfo, body)>

<!ELEMENT storyinfo (author, datewritten, keyword)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT datewritten (#PCDATA)>
<!ELEMENT keyword (#PCDATA)>

<!ELEMENT body (headline, para)>
<!ELEMENT headline (#PCDATA)>
<!ELEMENT para (#PCDATA)>
------------------------------------
i don't know how to use program automatic to parse xml file,
not by struct define ,because I think if there are many xml file
and dtd file ,I will rewrite my program many times .It is not reality . 

So I want to find some example for exercising to use libxml ,
can you help me ?

thank you very much 

Dupengchao
 

I would like to try to help, but it is not clear what you are asking.
Parsing any xml file is a matter of opening the file, walking the tree
and looking at contents and attributes of each element, as shown in the
example. Perhaps you could explain in more detail the problem you are
trying to solve and then I could point you toward more examples.

Cheers,
John
-- 
John Fleck
jfleck inkstain net (h) jfleck abqjournal com (w)
http://www.inkstain.net http://www.abqjournal.com

"Sometimes, a diner is all about the mac and cheese." 
  - Zippy the Pinhead




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]