Validate partial schema locations

Discussion in 'XML' started by Susanne Wunsch, Mar 26, 2010.

  1. 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
     
    Susanne Wunsch, Mar 26, 2010
    #1
    1. Advertising

  2. 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:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Apr 2, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Billy
    Replies:
    2
    Views:
    510
    Billy
    Feb 1, 2006
  2. Markus
    Replies:
    1
    Views:
    1,541
    Markus
    Nov 23, 2005
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,265
    Stanimir Stamenkov
    Apr 25, 2005
  4. Thomas Heller
    Replies:
    13
    Views:
    862
    Michele Simionato
    Feb 8, 2007
  5. J. Clifford Dyer

    Re: Partial 1.0 - Partial classes for Python

    J. Clifford Dyer, Feb 8, 2007, in forum: Python
    Replies:
    0
    Views:
    525
    J. Clifford Dyer
    Feb 8, 2007
Loading...

Share This Page