Validate partial schema locations

S

Susanne Wunsch

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
 
H

Henry S. Thompson

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
--
Henry S. Thompson, School of Informatics, University of Edinburgh
Half-time member of W3C Team
10 Crichton Street, Edinburgh EH8 9AB, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 651-1426, e-mail: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top