Reputation: 1070
Is the following an acceptable XML structure?
<Root>
<Child ID="1" Name="test">some inner text
<SecondChild ID="1" Name="test1">some text</SecondChild>
<SecondChild ID="2" Name="test2">some text 2</SecondChild>
</Child>
</Root>
I want to insert innertext() as well as child nodes to the <Child/>
node. Is this legal within XML?
Upvotes: 11
Views: 3417
Reputation: 134
It is legal, but not recommended, because:
What can be done:
if you get to this situation because you need to add new information to your element, you may either :
move the text part of your element to a child of this element, and add the new items as new children
add the new items as attributes to the existing tag
Upvotes: 1
Reputation: 4669
Normally, you don't have to insert some raw text in addition of childs elements in your tag ...
What are you trying to do please ?
anyway you can verify it here : http://www.w3schools.com/xml/xml_validator.asp
There is apparently no errors in your document so far.
Upvotes: 2