RE: determine root element in the xml from schema

You are correct to say that both these instance documents are valid against
this schema.

The word "ambiguity" has a fairly technical meaning when discussing
grammars, and it's not considered an "ambiguity" that more than one instance
document should match the same schema. In fact, it's a rather essential
feature.

But it is sometimes a usability problem that you can't easily constrain what
the document element should be (it can be any element that is globally
declared).

Michael Kay

# -----Original Message-----
# From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org]
# On Behalf Of Lingzhi Zhang
# Sent: 06 March 2004 23:41
# To: dev xmlschema
# Subject: determine root element in the xml from schema
# 
# 
# 
# Hi,
# 
# I am confused of how to determine root element in the xml from a given
# schema. It seems to me there is "ambiguity".
# 
# Say if we have schema like:
# <schema ...>
#     <element name="A">
# 	<complexType>
# 	...
# 	    <element ref="B"/>
# 	...
# 	<complexType>
#     </element>
#     <element name="B"/>
# <schema>
# 
# Either xml:
# <A><B></B></A>
# 
# or xml:
# <B></B>
# 
# would be valid xml against the schema. So either A or B could be root
# element in the xml. By just looking at the schema without looking at xml,
# we can't tell which on would be root element in the xml. However, if a
# user defines that schema, he/she usually means that A is the root. Isn't
# it "ambiguous"?
# 
# Stephen

Received on Saturday, 6 March 2004 19:27:57 UTC