Validate partial schema locations

Susanne Wunsch

Usenet Archive
Joined
Jan 13, 2010
Messages
5
Reaction score
0
Hi,

the attached XML file isn't bound to an XML Schema. It uses a "foreign element" from DC namespace which is declared and bound to an XSD.

I introduced a typo in order to check the validation process. But Xerces-J only says "Document is invalid: no grammar found.". It doesn't check the DC element with respect to the defined XSD.

Is the XML file valid according to W3C specification?

How to figure Xerces-J forcing it to validate the DC element?

Is there another validator which does the desired task?

XML file:

<?xml version="1.0" encoding="UTF-8"?>
<abc:AAA xmlns:abc="http://example.org/">
<abc:title>AAA title</abc:title>
<dc:tite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://purl.org/dc/elements/1.1/ http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd">Document title</dc:tite> </abc:AAA>

I use Xerces in the 'xmlvalidate' ant task:

<xmlvalidate file="${xml-file}.xml"
classname="org.apache.xerces.parsers.SAXParser"
failonerror="false">
<attribute name="http://xml.org/sax/features/validation" value="true"/> <attribute name="http://apache.org/xml/features/validation/schema" value="true"/> <attribute name="http://xml.org/sax/features/namespaces" value="true"/> <attribute name="http://xml.org/sax/features/namespace-prefixes" value="true"/> </xmlvalidate>

Any help would be approciated.

Susi
 

Henry S. Thompson

Usenet Archive
Joined
Jan 14, 2000
Messages
309
Reaction score
0
Different validators differ wrt whether they attend to xsi:schemaLoc, particularly if it's not on the document element -- some have switches to control this (XSV, for example), but not all. . .

You could try moving the schemaLoc to the doc. elt. . .

ht
 

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

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,244
Members
248,133
Latest member
DujonT

Latest Threads

Top