- From: <Noah_Mendelsohn@lotus.com>
- Date: Thu, 15 Feb 2001 14:10:03 -0500
- To: "Michael Shapiro" <michael@creativescience.com>
- Cc: xmlschema-dev@w3.org, xmlschema-dev-request@w3.org
I thought the FAQ covered this case, but I checked and it does not do so
in detail [1]. Here's a bit more info:
Q. Can any global element serve as the root of your instance when you
validate?
A. Yes, as far as the schema language itself is concerned, but it is
intended that the application or processor could be parameterized to
check. For example, consider a perfectly reasonable processor that would
take a command line like:
validate -instance myinstance.xml -schema myschema.xsd
-rootElementName purchaseOrder
such a processor could provide the added service of checking the name of
the root element. There are at least two reasons that the schema language
does not take a more rigid view of roots (a) there are situations in which
you truly find it useful to have different element names serve as the root
of a document and (b) even if purchaseOrder is the root of the instance,
you may decide that you only want to validate the shippingAddress. So,
the root of the validation need not be the root of the instance document.
Hope this helps.
[1] http://redrice.com/schemavalid/faq/xml-schema.html#d3
------------------------------------------------------------------------
Noah Mendelsohn Voice: 1-617-693-4036
Lotus Development Corp. Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------
"Michael Shapiro" <michael@creativescience.com>
Sent by: xmlschema-dev-request@w3.org
02/13/2001 11:20 PM
To: <xmlschema-dev@w3.org>
cc: (bcc: Noah Mendelsohn/CAM/Lotus)
Subject: Root element
I'm learning the schema language and I have a question that I can't find
an
answer for.
Primer in http://www.w3.org/TR/xmlschema-0/ declares two elements in
http://www.example.com/PO1 namespace: <purchaseOrder/> and <comment/>
Does it mean that an instance document like
<?xml version="1.0"?>
<a:comment xmlns:a="http://www.example.com/PO1">
Hello
</a:comment>
is as http://www.example.com/PO1 schema valid as
the one with <purchaseOrder .../> root?
If it's the case then is the following document also schema-valid?
<?xml version="1.0"?>
<xsd:annotation xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
<xsd:documentation>Hello</xsd:documentation>
</xsd:annotation>
Or the identity constraints on the <schema/> element itself will make a
document with <annotation/> root schema-invalid? What am I missing here?
Thanks,
Michael
Received on Thursday, 15 February 2001 14:22:21 UTC