Skip navigation
vin2k4u
Currently Being Moderated

Adding Childe Node to the XML

Dec 1, 2011 2:39 AM

Hello Geeks,

 

Need your help on solving the below issue.

 

Am using Adobe Livecycle Workbench ES2 for creating a Process.

 

The requirement is to Add a Child Node to the XML.

 

<helpUrls>
          <
HelpUrl>
               <
Name>BugReport</Name>
               <
url>C:\BugRep.exe</url>
          </
HelpUrl>
</
helpUrls>

Need to add Child Node

 

<helpUrls>
          <
HelpUrl>
               <
Name>BugReport</Name>
               <
url>C:\BugRep.exe</url>
          </
HelpUrl>

          <HelpUrl>
               <
Name>IssueReport</Name>
               <
url>C:\IssueRep.exe</url>
          </
HelpUrl>

</helpUrls>

 

The Schema Looks as below

<xs:element name="helpUrls">

<xs:complexType>

   <xs:sequence maxOccurs="unbounded">

    <xs:element name="HelpUrl">

     <xs:complexType>

      <xs:sequence maxOccurs="unbounded">

       <xs:element name="Name" type="xs:string" />

       <xs:element name="url" type="xs:string" />

      </xs:sequence>

     </xs:complexType>

   </xs:element>

  </xs:sequence>

</xs:complexType>

</xs:element>

 

Thanks in advance

 

Regards

Darsh

 
Replies
  • Currently Being Moderated
    Dec 5, 2011 1:00 AM   in reply to vin2k4u

    This you cannot do in a direct way.

     

    You can add the node <HelpUrl with a different name for example <TempUrl> and then rename the tag name into HelpUrl using XSLT activity. Otherwise the latest node will overwrite the existing HelpUrl node.

     

    Nith

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 5, 2011 7:52 AM   in reply to vin2k4u

    A Sample XM File after adding a <temp> tag would look like:

     

    <root><HelpUrl>some URL1</HelpUrl><HelpUrl>some URL2</HelpUrl><temp>New URL</temp></root>

    The XSL used to rename the above XML is as follows:

     

    <?xml version="1.0"?>

    <xsl:stylesheet version="1.0"

    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">

    <root>

          <xsl:for-each select="root/HelpUrl">

                        <HelpUrl>

                                  <xsl:value-of select="."/>

            </HelpUrl>

          </xsl:for-each>

          <xsl:for-each select="root/temp">

            <HelpUrl>

                        <xsl:value-of select="."/>

              </HelpUrl>

          </xsl:for-each>

    </root>

    </xsl:template>

    </xsl:stylesheet>

     

    I hope you can understand from the above example on how to rename a tag using XLST.

     

    Send me your email address so that I can send you the sample process I tried for you.

     

    Nith

    nith.igate@gmai.com

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points