aspose file tools*
The moose likes XML and Related Technologies and the fly likes I need to get only simple tag names in response xml into Arraylist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "I need to get only simple tag names in response xml into Arraylist " Watch "I need to get only simple tag names in response xml into Arraylist " New topic
Author

I need to get only simple tag names in response xml into Arraylist

Suman Reddy
Greenhorn

Joined: Mar 03, 2009
Posts: 4
hi all
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

Suman Reddy wrote:thanks for reply but sorry to say


Suman, if you are referring to a reply here it would be polite to provide a link to it. Otherwise somebody who wanted to answer your question would have to spend (waste) some time searching for that reply.
Suman Reddy
Greenhorn

Joined: Mar 03, 2009
Posts: 4
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.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

Well, it seems like you're at the very beginning. So let me point you to a book online about Java and XML: Processing XML with Java. It's a little bit dated, but it should introduce you to the basics of XML in the Java world.
Suman Reddy
Greenhorn

Joined: Mar 03, 2009
Posts: 4
w
Suman Reddy
Greenhorn

Joined: Mar 03, 2009
Posts: 4
ff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need to get only simple tag names in response xml into Arraylist