- Joined
- Mar 3, 2009
- Messages
- 1
- Reaction score
- 0
Hi all,
i have a xml file
<booK>
<name>book1</name>
<price>100</Price>
<author>
<aname>name1</aname>
<city>city1</city>
</author>
</book>
i need to get the simple tag names(here it is name,price,aname,city) in to a list i have heard about SAX parser event driven it walks throgh the xml step by step when a new tag occurs it will parse etc....
but i am unable to get the only sampletag names into a Arraylist
i have heard about a method getElementBytagName()
i dont want to write a code for particular xml because later on i have to retrive same simple tags from another xml say employee.xml
please provide a generic code which will retrive the simple tag names and stores into a Arraylist
the real xml i want to store only simple elements into array list
we are testers ,we have general idea about list, sax ,,,sample java programs ,please dont put this post in low priority please provide a links or sample programs,
the reason we are collecting only the simple tag names is the same names will be column names in DB but not the complex tag names .
we need to verify the response what we got is weather from DB or NOt,,
<ProvisionViewingCardprovisionViewingCar>
<orderId>1</orderId>
<numberOfCards>2</numberOfCards>
<customerSite>
<customerSiteSystemId>3</customerSiteSystemId>
<customerSiteID>4</customerSiteID>
<customerSiteState>5</customerSiteState>
<parentCustomerSiteID>6</parentCustomerSiteID>
<businessName>7</businessName>
<migratedCustomerID>8</migratedCustomerID>
<businessContactInformation>
<contactID>9</contactID>
<emailInfo>
<additionalEmailAddress>10</additionalEmailAddress>
<emailAddress>11</emailAddress>
</emailInfo>
<communicationPreference>12</communicationPreference>
<mobileNumber>13</mobileNumber>
<faxNumber>14</faxNumber>
<contactExceptions>15</contactExceptions>
<telephoneNumber>16</telephoneNumber>
</businessContactInformation>
<address>
<addressID>17</addressID>
<addressLine1>18</addressLine1>
<addressLine2>19</addressLine2>
<addressLine3>20</addressLine3>
<town>21</town>
<county>22</county>
<postCode>22_1</postCode>
<country>23</country>
</address>
<person>
<personID>24</personID>
<title>25</title>
<firstName>26</firstName>
<middleName>27</middleName>
<dataProtectionPreference>28</dataProtectionPreference>
<surname>29</surname>
<dateOfBirth>30</dateOfBirth>
<position>31</position>
<!--1 or more repetitions:-->
<authority>32</authority>
<address>
<addressID>33</addressID>
<addressLine1>34</addressLine1>
<addressLine2>35</addressLine2>
<addressLine3>36</addressLine3>
<town>37</town>
<county>38</county>
<postCode>39</postCode>
<country>40</country>
</address>
Regards/
Suman.
i have a xml file
<booK>
<name>book1</name>
<price>100</Price>
<author>
<aname>name1</aname>
<city>city1</city>
</author>
</book>
i need to get the simple tag names(here it is name,price,aname,city) in to a list i have heard about SAX parser event driven it walks throgh the xml step by step when a new tag occurs it will parse etc....
but i am unable to get the only sampletag names into a Arraylist
i have heard about a method getElementBytagName()
i dont want to write a code for particular xml because later on i have to retrive same simple tags from another xml say employee.xml
please provide a generic code which will retrive the simple tag names and stores into a Arraylist
the real xml i want to store only simple elements into array list
we are testers ,we have general idea about list, sax ,,,sample java programs ,please dont put this post in low priority please provide a links or sample programs,
the reason we are collecting only the simple tag names is the same names will be column names in DB but not the complex tag names .
we need to verify the response what we got is weather from DB or NOt,,
<ProvisionViewingCardprovisionViewingCar>
<orderId>1</orderId>
<numberOfCards>2</numberOfCards>
<customerSite>
<customerSiteSystemId>3</customerSiteSystemId>
<customerSiteID>4</customerSiteID>
<customerSiteState>5</customerSiteState>
<parentCustomerSiteID>6</parentCustomerSiteID>
<businessName>7</businessName>
<migratedCustomerID>8</migratedCustomerID>
<businessContactInformation>
<contactID>9</contactID>
<emailInfo>
<additionalEmailAddress>10</additionalEmailAddress>
<emailAddress>11</emailAddress>
</emailInfo>
<communicationPreference>12</communicationPreference>
<mobileNumber>13</mobileNumber>
<faxNumber>14</faxNumber>
<contactExceptions>15</contactExceptions>
<telephoneNumber>16</telephoneNumber>
</businessContactInformation>
<address>
<addressID>17</addressID>
<addressLine1>18</addressLine1>
<addressLine2>19</addressLine2>
<addressLine3>20</addressLine3>
<town>21</town>
<county>22</county>
<postCode>22_1</postCode>
<country>23</country>
</address>
<person>
<personID>24</personID>
<title>25</title>
<firstName>26</firstName>
<middleName>27</middleName>
<dataProtectionPreference>28</dataProtectionPreference>
<surname>29</surname>
<dateOfBirth>30</dateOfBirth>
<position>31</position>
<!--1 or more repetitions:-->
<authority>32</authority>
<address>
<addressID>33</addressID>
<addressLine1>34</addressLine1>
<addressLine2>35</addressLine2>
<addressLine3>36</addressLine3>
<town>37</town>
<county>38</county>
<postCode>39</postCode>
<country>40</country>
</address>
Regards/
Suman.
Last edited: