To append an XML stream as a chile in another XML stream

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santoshsri
    New Member
    • Jan 2007
    • 48

    To append an XML stream as a chile in another XML stream

    Hi ,

    Can anyone tell me how to add/append an XML stream as a child in existing XML stream ?


    Thanks in advance
    Santosh
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    ??
    Are you looking for something like an include statement, or simply adding text from one file to the next?

    What type of code are you using?

    Comment

    • santoshsri
      New Member
      • Jan 2007
      • 48

      #3
      Well, I have big XML file. Now I have another standalone XML file. I want to plug the standalone XML file as node into the Big one.

      Please let me know if it does not make sense to you.

      Comment

      • jkmyoung
        Recognized Expert Top Contributor
        • Mar 2006
        • 2057

        #4
        Sounds like it would be best done by a scripting language.
        Is the 2nd file to be appended near the end of the first file?

        Sounds like:
        1. Remove the last closing tag from the first file.
        2. Add all of the second file.
        3. Add the last closing tag.

        If you need to add it somewhere in the middle, it'd be something like:
        1. Copy the file until you reach the specified tag.
        2. Call a function which adds all of the second file.
        3. Copy the rest of the file.

        Eg, particular unix commands might be:

        sed '$s/ *\([^ ]* *\)$//' data1.file >> output.file
        cat data2.file >> output.file
        cata endtag.file >> output.file.

        Where endtag.file just contains the endtags, and your filenames are data1.file and data2.file.


        Comment

        Working...