You should always have root node with xml / xsd?

Looked at the tutorial and it has the following xml and xsd .:

http://yfrog.com/b9xsdandxmlj

What I was wondering, do you need to use the root node in this example? It seems that there is no xsd type definition that points to the "employeeS" node.

You should always have root node in xml or you can just

<xml version="1.0"> <employee><employee> <employee><employee> <employee><employee> 
+7
xml xsd
source share
5 answers

from the XML specification at http://www.w3.org/TR/REC-xml/ (fifth edition) chapter 2

It says

"Each XML document has both logical and physical structure. Physically, a document consists of units called objects. An entity can refer to other objects to cause them to be included in the document. The document begins with" root ", or the document object."

"[Definition: there is only one element, called the root or document element, no part of which appears in the contents of any other element.] For all other elements, if the start tag is in the content of another element, the end tag is in the content of the same element Simply put, elements bounded by start and end tags are correctly embedded in each other. "

Basically, yes, you always need one root element.

+9
source share

From a brief description of XML on Wikipedia , which summarizes several correctness rules from the official XML specification :

There is one โ€œrootโ€ element that contains all the other elements.

+2
source share

Yes, you should always have a root node. However, you may have a file containing a fragment of an XML document that is imported into another file as an object to be analyzed. The entire file that must be included must have this declaration in the DTD:

 <!ENTITY SomeName SYSTEM "/path/to/file.xml"> 

Then it can simply complete it as follows:

 <SomeOuterTag> &SomeName; </SomeOuterTag> 
+2
source share

The root node is required. It is also referred to as a โ€œdocument itemโ€ in the W3C nomenclature.

Definition There is exactly one element, called the root or document element, no part of which appears in the contents of any other element (ref: section 2.1 of the W3C XML specification )

+1
source share

Yes, you should have one and only one root root.

0
source share

All Articles