M
Miel Bronneberg
Hi,
I've got a problem validating an xml document with both a dtd and
a schema. The problem seems to be about namespaces. What I want is a
well-formed, valid XML document, which also validates against a schema.
The following document validates ok at
http://www.stg.brown.edu/service/xmlvalid/ which doesn't check the schema.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE minim SYSTEM "http://www.cs.vu.nl/~embronne/XML/minim/minim.dtd">
<minim xmlns="http://www.cs.vu.nl/~embronne/XML/minim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cs.vu.nl/~embronne/XML/minim http://www.cs.vu.nl/~embronne/XML/minim/minim.xsd">
<lmnt>
Only one.
</lmnt>
</minim>
However, the xsv schema validator (http://www.w3.org/2001/03/webdata/xsv)
complains that: "element {http://www.cs.vu.nl/~embronne/XML/minim}:lmnt
not allowed here (1) in element
{http://www.cs.vu.nl/~embronne/XML/minim}:minim, expecting [{None}:lmnt]".
This can be fixed as follows:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE minim SYSTEM "http://www.cs.vu.nl/~embronne/XML/minim/minim.dtd">
<mnm:minim xmlns:mnm="http://www.cs.vu.nl/~embronne/XML/minim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cs.vu.nl/~embronne/XML/minim http://www.cs.vu.nl/~embronne/XML/minim/minim.xsd">
<lmnt>
Only one.
</lmnt>
</mnm:minim>
This seems to be unacceptable to the dtd-validator. If I want this to work
I'd have to modify the dtd and make "mnm:minim" the root element and add as
an attribute "xmlns:mnm". This I find an ugly solution. I was already
dissatisfied that I had to declare "xmlns:xsi" and "xsi:schemaLocation" as
attributes, but making "mnm:minim" the root element, while it should be
"minim" which just happens to be in the namespace "mnm" is really horrible.
Are there better solutions?
Regards, Miel.
I've got a problem validating an xml document with both a dtd and
a schema. The problem seems to be about namespaces. What I want is a
well-formed, valid XML document, which also validates against a schema.
The following document validates ok at
http://www.stg.brown.edu/service/xmlvalid/ which doesn't check the schema.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE minim SYSTEM "http://www.cs.vu.nl/~embronne/XML/minim/minim.dtd">
<minim xmlns="http://www.cs.vu.nl/~embronne/XML/minim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cs.vu.nl/~embronne/XML/minim http://www.cs.vu.nl/~embronne/XML/minim/minim.xsd">
<lmnt>
Only one.
</lmnt>
</minim>
However, the xsv schema validator (http://www.w3.org/2001/03/webdata/xsv)
complains that: "element {http://www.cs.vu.nl/~embronne/XML/minim}:lmnt
not allowed here (1) in element
{http://www.cs.vu.nl/~embronne/XML/minim}:minim, expecting [{None}:lmnt]".
This can be fixed as follows:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE minim SYSTEM "http://www.cs.vu.nl/~embronne/XML/minim/minim.dtd">
<mnm:minim xmlns:mnm="http://www.cs.vu.nl/~embronne/XML/minim"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.cs.vu.nl/~embronne/XML/minim http://www.cs.vu.nl/~embronne/XML/minim/minim.xsd">
<lmnt>
Only one.
</lmnt>
</mnm:minim>
This seems to be unacceptable to the dtd-validator. If I want this to work
I'd have to modify the dtd and make "mnm:minim" the root element and add as
an attribute "xmlns:mnm". This I find an ugly solution. I was already
dissatisfied that I had to declare "xmlns:xsi" and "xsi:schemaLocation" as
attributes, but making "mnm:minim" the root element, while it should be
"minim" which just happens to be in the namespace "mnm" is really horrible.
Are there better solutions?
Regards, Miel.