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?
You can create tags from scratch or load them from another source, such as an InDesign document, InCopy document, or DTD file. Use any of the following methods to create or load XML tags for your document: Create a tag with the New Tag command. Load tags from an XML file or another document.
The general rule for XML binding consists of using the full path and attribute name. However, this may result in multiple input objects in the JSP with the same name. Input objects with the same name are posted as an array of objects and are not posted to the API.
XML elements must follow these naming rules: Names can contain letters, numbers, and other characters. Names cannot start with a number or punctuation character.
To XML, there's no significance of a period in an element's name. a , a. , a.b , and a.b.c are all legal (and unique) element names.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With