Smart Documents - XSD and Namespace

G

Guest

Hi, I'm evaluating the use of Excel Smart Documents for data entry systems
and have created an XSD for the data which I want to use both for Excel (to
describe the data) and in the Web service back-end for validation of the
same. However, when Excel attaches the XSD as a map, it assigns it own
namespace to it (typically ns1) which it then includes in the exported XML.
This means I can't verify it using the same XSD as the element namespaces no
longer match!!!

Is there a way around this or must I maintain 2 otherwise identical XSD's??
 
P

Peter Huang [MSFT]

Hi

Based on my research, the two schema should be compatible.
[Schema:SimpleSample]
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="SimpleSample"
targetNamespace="SimpleSample"
elementFormDefault="qualified">

<xsd:complexType name="exampleType">
<xsd:all>
<xsd:element name="textbox" type="xsd:string"/>
<xsd:element name="commandbutton" type="xsd:string"/>
<xsd:element name="help" type="xsd:string"/>
<xsd:element name="radiobutton" type="xsd:string"/>
<xsd:element name="checkbox" type="xsd:string"/>
<xsd:element name="listbox" type="xsd:string"/>
<xsd:element name="image" type="xsd:string"/>
<xsd:element name="documentfragment" type="xsd:string"/>
<xsd:element name="activex" type="xsd:string"/>
<xsd:element name="hyperlink" type="xsd:string"/>
</xsd:all>
</xsd:complexType>

<xsd:element name="example" type="exampleType"/>

</xsd:schema>

[Export xml]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <ns1:example xmlns:ns1="SimpleSample">
<ns1:textbox>1</ns1:textbox>
<ns1:commandbutton />
<ns1:help />
<ns1:radiobutton />
<ns1:checkbox />
<ns1:listbox />
<ns1:image />
<ns1:documentfragment />
<ns1:activex />
<ns1:hyperlink />
</ns1:example>

changed to
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns1:example xmlns:ns1="SimpleSample"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="SimpleSample C:\test\SimpleSample.xsd">
<ns1:textbox>1</ns1:textbox>
<ns1:commandbutton/>
<ns1:help/>
<ns1:radiobutton/>
<ns1:checkbox/>
<ns1:listbox/>
<ns1:image/>
<ns1:documentfragment/>
<ns1:activex/>
<ns1:hyperlink/>
</ns1:example>

We will find that we can use the SimpleSample.xsd to validate the exported
xml so they should be compatible. That is to say the webservice will
recognize the xml file.

If you have any concern, please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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