This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert multiple xml tags to single tag with attributes

 
prabhu peruka
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
I am trying to create a java program which will take an SOAP/XML input format and generate xml of my own format...

i am new to xml technologies so totally confused what to do...
I am trying to look for some sample code which does the same.

do i need to use any parsers like SAX / DOM ?

What i am actually looking at is :

when the user input comes to me as xml file, i want to capture each tag value and store it as attribute value in my output xml. i.e; in my output what i have is a single tag with many attributes

if sample input file:

<soap-env:Envelope
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
</soap-env:Header>
<soap-env:Body CLASS_TYPE="Request">
<Query>
<name>prabhu</name>
<Address1>#123</Address1>
<Address2></Address2>
<Address3></Address3>
<CityName>hyd</CityName>
<StateCode>ap</StateCode>
<StateName></StateName>
<CountryCode>IND</CountryCode>
<PostalCode>123456</PostalCode>
<CountryName>INDIA</CountryName>
<LastName></LastName>
<FirstName></FirstName>
</Query>
</soap-env:Body>
</soap-env:Envelope>

then, the sample output would be :

<user
name_1="prabhu"
address_1="#123"
address_2=""
address_3=""
city="hyd"
state_name=""
state_code="AP"
postal_code="123456"
ctry_name="India"
ctry_code="IND"

/>


Pls, help me on this ...
Thanks in advance.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic