Community
    • Login

    XML - insert rows without nesting

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 210 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RichR
      Rich
      last edited by

      Hello,

      I am trying to insert some rows into an XML file; the text that I enter is copied from an Excel document (which I use to calculate values for some of the XML elements).

      The problem is, when I copy that text, the final existing tag is getting “Nested” within the inserted row (see screen shots). Is there a way to prevent this?

      Thank you for any tips you can provide!

      Before inserting the new rows:

      b35c2189-6d39-4a31-bb23-a929a3178bab-image.png

      After inserting the new rows:

      b66f373d-1e94-45c1-9f73-402ee8f25885-image.png

      How it looks when “collapsing” the final grouping:

      73305d2e-30b3-4057-859a-84ad8249daf9-image.png

      PeterJonesP 1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @Rich
        last edited by PeterJones

        @Rich ,

        I cannot replicate. My guess is you’ve got something unescaped in one of the attributes that you blacked out:

        If I start with this:

        <getRostersResponse>
            <roster crewID="1">
                <assignment>
                    <task activityType="A"/>
                </assignment>
            </roster>
        </getRostersResponse>
        

        e3770f52-e3d0-450f-bafb-7cb33c9d6435-image.png

        Then paste before line 7 to get

        <getRostersResponse>
            <roster crewID="1">
                <assignment>
                    <task activityType="A"/>
                </assignment>
            </roster>
            <roster crewID="2">
                <assignment>
                    <task activityType="B"/>
                </assignment>
            </roster>
        </getRostersResponse>
        

        711a2433-cf1e-4546-a595-72bd16fdfa22-image.png

        it does exactly what I expect, and </getRostersResponse> does not collapse as part of the line-7 <roster>:
        5b2d3c88-a06c-4e1f-97c2-00dfb3b615a3-image.png

        Try to narrow it down to the smallest bits of XML you can replicate the problem with. And make sure that you can obfuscate the data (so it doesn’t have private information) but still be able to paste the raw text (use the </> button in the forum, which is what I did for my text boxes in my reply). Chances are, in narrowing things down, trying to keep the error to occur, you will see the culprit in the narrowed-down XML, because it will be more obvious when it’s smaller amount of text… especially when you see that changing the attribute or value data to fake data might cause the problem to go away, in which case you know it’s in that attribute or value…

        RichR 1 Reply Last reply Reply Quote 0
        • RichR
          Rich @PeterJones
          last edited by

          @PeterJones thank you! Yup, I was missing a single “/”! Thanks for help!

          PeterJonesP 1 Reply Last reply Reply Quote 1
          • PeterJonesP
            PeterJones @Rich
            last edited by

            @Rich said in XML - insert rows without nesting:

            I was missing a single “/”

            I hate being bit by something so small but dangerous. :-)

            If you don’t already have it, XML Tools plugin can help with XML syntax check: it can be automatic or on-demand. (If you are using XML>10Mb, you might not want to automatically do the syntax and validation checks; you can turn on/off those options in the XML Tools menu). But I think it might have helped you find that problem.

            Thanks for help!

            Glad to help.

            1 Reply Last reply Reply Quote 3
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors