root element's attributes' namespace

webmasterbeta

New Member
I'm using a schema with these attributes....

<schema targetNamespace="http://www.api.org/pidXML/v1.2" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:pidx="http://www.api.org/pidXML/v1.2" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.2">

and a root element defined as:

<element name="OrderCreate">
<complexType>
<sequence>
<element ref="pidx:OrderCreateProperties" />
<element ref="pidx:OrderCreateDetails" />
<element ref="pidx:OrderCreateSummary" />
</sequence>
<attribute ref="pidx:transactionPurposeIndicator" use="required" />
<attribute ref="pidx:version" use="required" />
</complexType>
</element>

I've got an XML with this root element...

<OrderCreate pidx:transactionPurposeIndicator="Original" pidx:version="1.2" xmlns:pidx="http://www.api.org/pidXML/v1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.api.org/pidXML/v1.2 X:/developers/lukecrouch/XSL_framework/miniOrderCreate.xsd" xmlns="http://www.api.org/pidXML/v1.2">


why is it that I have to include the 'pidx' namespace prefix before the root element's required attributes? if I take off the 'pidx' prefix, I get a validation message:

"Required attribute 'pidx:version' of parent element 'OrderCreate' exepected before the first child element."

should the version be fine since I'm declaring the default namespace of the XML file to be the same as the pidx namespace?
 
Back
Top