Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2716

Unable to create XML Attribute name multiple times with different values

X-Received by 10.224.36.66 with SMTP id s2mr25463460qad.6.1368697712515; Thu, 16 May 2013 02:48:32 -0700 (PDT)
X-Received by 10.50.147.98 with SMTP id tj2mr1842361igb.10.1368697712428; Thu, 16 May 2013 02:48:32 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!l3no8539612qak.0!news-out.google.com!y6ni48705qax.0!nntp.google.com!gj8no89041qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.help
Date Thu, 16 May 2013 02:48:32 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=61.16.248.238; posting-account=eM83YAoAAADtgIIlNvqs6o_v9sSK_mWE
NNTP-Posting-Host 61.16.248.238
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <5db372c3-217a-4b53-aaa5-15c55042e1e9@googlegroups.com> (permalink)
Subject Unable to create XML Attribute name multiple times with different values
From pradeep.p@halcyontek.com
Injection-Date Thu, 16 May 2013 09:48:32 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.help:2716

Show key headers only | View raw


I have to create XML from Excel selected columns. My Excel selected columns are as follows

My issue here is: if same tag with different attributes exists, they are not created in XML file.

  Column        Star XML Path                          Star Tag TC1-ECIN    --------------------------------------------------------------------------------
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd"  AddLine   ABC
Process:DataArea:Credit:IndividualApp:Address qualifier="HomeAdd"  AddLine   XYZ
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing"  AddLine   MNO
Process:DataArea:Credit:IndividualApp:Address qualifier="Billing"  AddLine   PQR
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage"   AddLine   123
Process:DataArea:Credit:IndividualApp:Address qualifier="Garage"   AddLine   789


Required output should be as follows:

<Process>
  <DataArea>
    <Credit>
       <IndividualApp>
         <Address qualifier="HomeAddress">
             <AddressLine>ABC</AddressLine>
             <AddressLine>XYZ</AddressLine>
          </Address>
          <Address qualifier="Billing">
           <AddressLine>MNO</AddressLine>
           <AddressLine>PQR</AddressLine>
         </Address>
         <Address qualifier="Garage">
           <AddressLine>123</AddressLine>
           <AddressLine>789</AddressLine>
         </Address>
       </IndividualApp>
     </Credit>
  </DataArea>
</Process>
</Address>

So far I have coded is creating the XML as below and skipping <Address qualifier="Billing"> and <Address qualifier="Garage">

<Process>
  <DataArea>
    <Credit>
       <IndividualApp>
         <Address qualifier="HomeAddress">
             <AddressLine>ABC</AddressLine>
             <AddressLine>XYZ</AddressLine>
          </Address>
        </IndividualApp>
     </Credit>
  </DataArea>
</Process>
</Address>

My code is lengthy to post here since I have coded
   1. Excel to read in Java 
   2. Finding Excel column index numbers and reading the contents
   3. Splitting Excel column value as

<Process>
  <DataArea>
    <Credit>
       <IndividualApp>
          <Address qualifier="HomeAdd">
            <AddLine>ABC</AddLine>
          </Address>
       </IndividualApp>
     </Credit>
  </DataArea>
</Process>

    4. setting levels to create the tags(root, parent, child, value,....

I have posted my issue in one of the Java social sites where I have placed my code. please refer this URL, and d help me

http://stackoverflow.com/questions/16581916/unable-to-create-xml-attribute-name-multiple-times-with-different-values

Back to comp.lang.java.help | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Unable to create XML Attribute name multiple times with different values pradeep.p@halcyontek.com - 2013-05-16 02:48 -0700
  Re: Unable to create XML Attribute name multiple times with different values "John B. Matthews" <nospam@nospam.invalid> - 2013-05-16 14:25 -0400

csiph-web