XML - insert rows without nesting
-
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:
After inserting the new rows:
How it looks when “collapsing” the final grouping:
-
@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>
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>
it does exactly what I expect, and
</getRostersResponse>
does not collapse as part of the line-7<roster>
:
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… -
@PeterJones thank you! Yup, I was missing a single “/”! Thanks for help!
-
@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.