problem with Using SAX parser

Posted by moustafa on Stack Overflow See other posts from Stack Overflow or by moustafa
Published on 2010-05-19T08:25:29Z Indexed on 2010/05/19 8:30 UTC
Read the original article Hit count: 280

Filed under:

Hi guys i have this small class task that im having trouble with. I need to create a PHP file using SAX to generate the display shown below from an XML file. Im not sure how to Use | to represent its level, where the root element orders is at level zero. This is what the result should look like when i parse it through a SAX parser http://img13.imageshack.us/img13/6950/75914446.jpg This is the XML source code from which i need to generate the display:

<orders>
  <order>
    <count>37</count>
    <price>49.99</price>
    <book>
      <isbn>0130897930</isbn>
      <title>Core Web Programming Second Edition</title>
      <authors>
         <count>2</count>
        <author>Marty Hall</author>
        <author>Larry Brown</author>
      </authors>
    </book>
  </order>
  <order>
    <count>1</count>
    <price>9.95</price>
    <yacht>
      <manufacturer>Luxury Yachts, Inc.</manufacturer>
      <model>M-1</model>
      <standardFeatures oars="plastic" lifeVests="none">false</standardFeatures>
</yacht>
  </order>
  <order>
    <count>3</count>
    <price>22.22</price>
    <book>
      <isbn>B000059Z4H</isbn>
      <title>Harry Potter and the Order of the Phoenix</title>
      <authors>
         <count>1</count>
        <author>J.K. Rowling</author>
      </authors>
    </book>
  </order>

© Stack Overflow or respective owner

Related posts about Xml