XSD Schema in Word2003, why all possible elements listed at top le

A

Arian

Hello all,
I am using a simple xsd file to test Word 2003's XML/XSD abilities.

When I associate a new xml document with that schema, the list of default
nodes i see on the right-hand list are basically all the nodes in the xsd
schema. Once you select one of them, then does it get smart about it and
choose nodes allowed under it. But once you go back to the top level (by
moving cursor or mouse there), all nodes are available again. Basically i
think it should only show the root node on the right side to choose when the
document is at that level. In fact some apps go 1 step ahead; XML-SPY creates
a new document and adds the required nodes it seems.

Anyone know if this is the schema's fault (maybe need to specify certain
element is the root node?)? or Word's? or those other apps are just guessing
what your document should look like?

I'd like it so the user does not have to know what node to choose at the top
level of the document, there should be only one.

Here is the xsd, borrowed from w3schools.com, the root node is <shiporder>:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple elements -->
<xs:element name="orderperson" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="address" type="xs:string"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string"/>
<xs:element name="quantity" type="xs:positiveInteger"/>
<xs:element name="price" type="xs:decimal"/>
<!-- definition of attributes -->
<xs:attribute name="orderid" type="xs:string"/>
<!-- definition of complex elements -->
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element ref="address"/>
<xs:element ref="city"/>
<xs:element ref="country"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item">
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="note" minOccurs="0"/>
<xs:element ref="quantity"/>
<xs:element ref="price"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="shiporder">
<xs:complexType>
<xs:sequence>
<xs:element ref="orderperson"/>
<xs:element ref="shipto"/>
<xs:element ref="item" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="orderid" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top