Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help validating an XML file against its XSD file 1

Status
Not open for further replies.

varocho

Programmer
Dec 4, 2000
238
US
I need help validating an XML file against its associated XSD file. Here's the beginning of the XML file:

<?xml version="1.0" encoding="UTF-8"?>
<sps:Capabilities version="1.0.0"
updateSequence=""
xsi:schemaLocation=" spsGetCapabilities.xsd"
xmlns=" spsGetCapabilities.xsd"
xmlns:sps=" xmlns:xsi=" xmlns:eek:ws=" xmlns:gml=" xmlns:xlink="...

My code works fine when the application has an Internet connection, but it doesn't when no such connection is available. I do have copies of the XSD files, so my question is, what changes do I need to make to the XML file in order so it references the XSD files?
 
[1] If your application use xsi:schemaLocation attribute in the xml document for validation purpose, simply replace xsi:schemaLocation to point to the local file.
[1.1] If the xml file is on the local file system already, and that the xsd file is on the same directory of it, it should look exactly as what shown.
[1.2] If xml may not be on the local file system, and that you want xsd file on the local (d:\xyz directory) with the same name, you may specific it with something like this.
[tt] xsi:schemaLocation="[ignore][/ignore] [blue]file:///d:/xyz/spsGetCapabilities.xsd[/blue]" [/tt]
[1.2.1] It may or may not be acceptable without file:// protocol and/or local path with backslash. You better check on the application and the specific platform to be assured.

[2] In any case, the xsi:schemaLocation is there of nature being "suggestive", the spec makes no representation that application must follow it to be complied with the spec. It is up to the application. So I suppose the application has no provision to force its own schema to validate against the xml document.

[3] This is erroneous.
>xmlns="[ignore][/ignore] spsGetCapabilities.xsd"
It should simply read like this.
[tt]xmlns="[ignore][/ignore]"[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top