Document Won't Validate

Having trouble installing Oxygen? Got a bug to report? Post it all here.
husker
Posts: 5
Joined: Wed Nov 28, 2007 7:45 pm
Location: Omaha, Nebraska

Document Won't Validate

Post 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.
husker
Posts: 5
Joined: Wed Nov 28, 2007 7:45 pm
Location: Omaha, Nebraska

Re: Document Won't Validate

Post 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?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Document Won't Validate

Post 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
George Cristian Bina
Post Reply