ca guy

ca guy

  • NA
  • 13
  • 0

Serialize XM into Object..

Dec 2 2009 1:35 PM

Hi Guys,
             I am trying to read xml file into object, having difficult time to determine class structure, i am getting confused between attributes & nodes. Can anyone please help me how i should define class that match XML structure? Here is the structure of XML file
Thank you
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <item id="job1" type="test">
        <attr name="BOOK" type="string" value="TEST LOCATION"/>
        <attr name="ORIGIN" type="string" value="COPY"/>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="375"/>
        </childcomponent>
        <resources>
            <resource file="12532160239881.tiff"
                mime="image" type="ICMBASE"/>
        </resources>
    </item>
    <item id="job2" type="PROD">
        <attr name="BOOK" type="string" value="TEST LOCATION"/>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="375"/>
        </childcomponent>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="997105514"/>
        </childcomponent>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="997105509"/>
        </childcomponent>
        <resources>
            <resource file="12532160239882.tiff"
                mime="image" type="ICMBASE"/>
        </resources>
    </item>
    <item id="job3" type="PROD">
        <attr name="BOOK" type="string" value="TEST LOCATION"/>
        <attr name="ORIGIN" type="string" value="COPY"/>
        <attr name="COMMENT" type="string" value="BL - 5/16/05 - 1/1/06"/>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="375"/>
        </childcomponent>
        <resources>
            <resource file="12532160239883.tiff"
                mime="image" type="ICMBASE"/>
        </resources>
    </item>
    <item id="job4" type="PROD">
        <attr name="BOOK" type="string" value="NEW YORK CI IMAGING TEAM"/>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="377"/>
        </childcomponent>
        <resources>
            <resource file="12532160239884.tiff"
                mime="image" type="ICMBASE"/>
        </resources>
    </item>
    <item id="job5" type="PROD">
        <attr name="BOOK" type="string" value="TEST LOCATION"/>
        <attr name="ORIGIN" type="string" value="COPY"/>
        <attr name="COMMENT" type="string" value="Insurnace Information"/>
        <attr name="DATE" type="date" value="2005-06-17"/>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="375"/>
            <attr name="DESC" type="string" value="Evidence of Insurance"/>
        </childcomponent>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="997105514"/>
        </childcomponent>
        <childcomponent type="test">
            <attr name="CODE" type="string" value="997105509"/>
        </childcomponent>
        <resources>
            <resource file="12532160239885.tiff"
                mime="image" type="ICMBASE"/>
        </resources>
    </item>
</root>

Answers (1)