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


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

Unable to create XML Attribute name multiple times with different values

Started bypradeep.p@halcyontek.com
First post2013-05-16 02:48 -0700
Last post2013-05-16 14:25 -0400
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.help


Contents

  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

#2716 — Unable to create XML Attribute name multiple times with different values

Frompradeep.p@halcyontek.com
Date2013-05-16 02:48 -0700
SubjectUnable to create XML Attribute name multiple times with different values
Message-ID<5db372c3-217a-4b53-aaa5-15c55042e1e9@googlegroups.com>
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

[toc] | [next] | [standalone]


#2717

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-05-16 14:25 -0400
Message-ID<nospam-C19E6D.14253016052013@news.aioe.org>
In reply to#2716
In article <5db372c3-217a-4b53-aaa5-15c55042e1e9@googlegroups.com>,
 pradeep.p@halcyontek.com wrote:
[...]
> My code is lengthy to post here since I have coded...
[...]
> I have posted my issue in one of the Java social sites where I have 
> placed my code. Please refer this URL, and help me.
> 
> <http://stackoverflow.com/questions/16581916/>

Following the link produces this:

    Page Not Found
    This question was voluntarily removed by its author.
    ...

IIUC, you can restore your own question.

<http://meta.stackoverflow.com/a/43943>

Because your "code is lengthy," another approach might be to construct 
an sscce, <http://sscce.org/>, that focuses narrowly on the problem 
using the simplest possible test data.

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web