What is wrong with this xml?

[quote]

[/quote]

When I try to initialize an xml document with this data I get and xml exception
I tried it pasting it in to and get the message:

XML Parsing Error: junk after document element Location: http://www.w3schools.com/xml/xml_validator.asp Line Number 7, Column 1: <Plugin ^

I believe XML documents must begin with

<?xml version="1.0" encoding="UTF-8"?>

I tried that… It just pushes the error down to line 8, but its the identical error.

You must have a root element (though it needn’t be named “root,” as described here :

"XML documents must contain one element that is the parent of all other elements. This element is called the root element."

So, try this:

<rootOrWhateverYouWantToCallIt> <Plugin name="log1 name" id="pluginID1" class="org.xxxx.yyy.stdplugins.AuditLog" root="root-directory1" /> <Plugin name="log2 name" id="pluginID2" class="org.xxxx.yyy.stdplugins.AuditLog" root="root-directory2" /> </rootOrWhateverYouWantToCallIt>

So that explains why it works if there is only one element, as it would be the root element.

I’m trying to graft in some elements into another xml document.
In my last version I was only trying to graft in one element now I’m trying to graft in two at a time.
So each must be a root element.

I

Can I create nodes from strings, and append them to an xml document?
something like:

[quote]
dim xnode1 as new XMLNode(":slight_smile:
dim xnode2 as new XMLNode(":slight_smile:
dim xdoc as new XMLDocument(" ")
xdoc.FirstChild.AppendChild(xnode1)
xdoc.FirstChild.AppendChild(xnode2)[/quote]

No. AFAIK, you cannot use a “normal” style (“NEW”) constructor to create elements. You must instead us one of the “.Create…” functions on the XMLDocument object itself. You could, of course, create a text representation of your XML document, and then use the “LoadXML” method of the XMLDocument, but that wouldn’t be very wise, I would think.

What are you trying to implement?

I have nodes within my config file that I’m trying to update…
Nodes come in groups of two. (now, before they were just single xml nodes, but I thought I could put the two nodes into one xml document and then append the elements in groups of two.)

So to better explain this:

Existing config file.

[quote]






[/quote]

I need to replace the two (or more) Group B with the two elements in the CfgTemplate.