66
The following post asks how to indicate that an element is the root element in an XML schema:
Is it possible to define a root element in an XML Document using Schema?
I have followed the w3schools tutorial on XML Schema but something is still not clear.
Consider example schema 2 from https://www.w3schools.com/xml/schema_example.asp
(reproduced below for convenience). How does this code indicate that <shiporder>
is the root element? Isn't the example saying that all elements
are valid as root elements?
------------------ instance ----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</xample saying that all elements are valid as root elements?quantity>
<price>9.90</price>
</item>
</shiporder>
----------------------- schema ------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema&