Results 1 to 1 of 1
- 03-03-2009, 08:46 AM #1
Member
- Join Date
- Mar 2009
- Posts
- 1
- Rep Power
- 0
JAVA-SAX-Xml how to get simple tag element names to a list
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.
Similar Threads
-
Names pipes in java
By Zept in forum NetworkingReplies: 2Last Post: 08-06-2011, 08:20 PM -
A simple List question
By right2001 in forum New To JavaReplies: 2Last Post: 02-16-2009, 03:37 AM -
Java random names
By rsun in forum New To JavaReplies: 2Last Post: 01-15-2009, 09:17 PM -
Convert Linked List Object element to String
By CirKuT in forum New To JavaReplies: 2Last Post: 12-13-2008, 05:22 AM -
adding list to an array element
By Preethi in forum New To JavaReplies: 5Last Post: 09-25-2008, 04:23 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks