Page 1 of 1

Document Won't Validate

Posted: Tue Oct 12, 2010 8:30 pm
by husker
Oxygen says this document is invalid:

Code: Select all

<get-request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://services.www.up.com/track/physical/get/1.0 get-track.xsd"
xmlns="http://services.www.up.com/track/physical/get/1.0">
<validate />
<system-number>1</system-number>
</get-request>
The error message is:

Code: Select all

SystemID: C:\Documents and Settings\ctxd222\workspace\TNS Services\config\schemas\get-track\1.0\Untitled2.xml
Engine name: Xerces
Severity: error
Description: cvc-complex-type.2.4.a: Invalid content was found starting with element 'validate'. One of '{validate, system-number}' is expected.
Start location: 4:6
End location: 4:14
URL: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type
I checked the schema & the schema it extends, & both use elementFormDefault="unqualified". The constraint I face is the corporate framework I use requires that my documents have a default namespace, so I can't use prefixes. I can get the document to validate if I use prefixes, but can't find a way to validate it with a default namespace.

I'd include the schemas, but they're long & I don't see a way to attach a file to a forum topic. Would be happy to e-mail them, though.

Re: Document Won't Validate

Posted: Tue Oct 12, 2010 9:04 pm
by husker
I did more fiddling, and found this form of the document will validate:

Code: Select all


<get-request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://services.www.up.com/track/physical/get/1.0 get-track.xsd"
xmlns="http://services.www.up.com/track/physical/get/1.0">
<validate xmlns="" />
<system-number xmlns="" >1</system-number>
</get-request>
But surely the caller shouldn't be forced to put xmls="" on every element? Is there a compact way to declare that every element is in no namespace?

Re: Document Won't Validate

Posted: Tue Oct 12, 2010 9:12 pm
by george
You can reset the default namespace only on an ancestor element. In your case that is the root element and you mentioned that you want to specify that with no prefix so it is not possible to have the default namespace for root and also the xmlns="" for the children.

Best Regards,
George