Dear BaseX people, I encounter a problem with validate:xsd-report(), more particular with using a schema importing the well-known xml.xsd. The imported attribute declaration (xml:base) is not found. I am pretty sure that it is my fault, but I just can't find my error - could you take a look? (1) Document: doc.xml <book xml:base="/a/b/c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd"> <author>xyz</author></book> (2) Schema: schema.xsd <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/> <xs:element name="book"> xs:complexType xs:sequence <xs:element name="author" type="xs:string"/> </xs:sequence> <xs:attribute ref="xml:base"/> </xs:complexType> </xs:element></xs:schema> (In the same folder, a downloaded copy of xml.xsd is stored - for a snippet, see PS) (3) Query: validate.xq let $doc := 'doc.xml'let $xsd := 'schema.xsd'return validate:xsd-report($doc, $xsd) (4) Result: basex validate.xq=><report> <status>invalid</status> <message level="Fatal" line="9" column="43" url="file:/C:/projects/d2type/jats/test-validation/schema.xsd">src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component. </message></report> I do not understand why the import seems to be ignored. Validating with oXygen works fine, but I suppose that oXygen ignores the @schemaLocation. If you see the reason, please let me know. Cheers,Hans-Jürgen PS: Snippet from xml.xsd, stored in the same folder: <?xml version='1.0'?><!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" ><xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema%22%C2%A0 xml:lang="en"> ... <xs:attribute name="base" type="xs:anyURI"> xs:annotation xs:documentationSee http://www.w3.org/TR/xmlbase/ for information about this attribute.</xs:documentation> </xs:annotation> </xs:attribute> ...</xs:schema>
Not sure why you have the doctype declaration in there... perhaps your parser is missing XMLSchema.dtd? In my xml.xsd there is no such declaration, I fetched it from https://www.w3.org/2001/xml.xsd
Best, Daniel
Von: BaseX-Talk basex-talk-bounces@mailman.uni-konstanz.de Im Auftrag von Hans-Juergen Rennau Gesendet: Mittwoch, 31. August 2022 21:21 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] Problem with validate:xsd-report
Dear BaseX people,
I encounter a problem with validate:xsd-report(), more particular with using a schema importing the well-known xml.xsd. The imported attribute declaration (xml:base) is not found.
I am pretty sure that it is my fault, but I just can't find my error - could you take a look?
(1) Document: doc.xml
<book xml:base="/a/b/c" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd"> <author>xyz</author> </book>
(2) Schema: schema.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/> <xs:element name="book"> xs:complexType xs:sequence <xs:element name="author" type="xs:string"/> </xs:sequence> <xs:attribute ref="xml:base"/> </xs:complexType> </xs:element> </xs:schema>
(In the same folder, a downloaded copy of xml.xsd is stored - for a snippet, see PS)
(3) Query: validate.xq
let $doc := 'doc.xml' let $xsd := 'schema.xsd' return validate:xsd-report($doc, $xsd)
(4) Result:
basex validate.xq => <report> <status>invalid</status> <message level="Fatal" line="9" column="43" url="file:/C:/projects/d2type/jats/test-validation/schema.xsd">src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component. </message> </report>
I do not understand why the import seems to be ignored. Validating with oXygen works fine, but I suppose that oXygen ignores the @schemaLocation.
If you see the reason, please let me know.
Cheers, Hans-Jürgen
PS: Snippet from xml.xsd, stored in the same folder:
<?xml version='1.0'?> <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" > <xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en"> ... <xs:attribute name="base" type="xs:anyURI"> xs:annotation xs:documentationSee http://www.w3.org/TR/xmlbase/ for information about this attribute.</xs:documentation> </xs:annotation> </xs:attribute> ... </xs:schema>
That's what I call a born trouble shooter. After removing the declaration, it works. THANK YOU, Daniel! Amazing - I had downloaded the XSD from https://www.w3.org/2001/03/xml.xsd%C2%A0(which was suggested by Google). Kind regards -Hans-Jürgen Am Donnerstag, 1. September 2022 um 10:00:39 MESZ hat Zimmel, Daniel d.zimmel@esvmedien.de Folgendes geschrieben:
<!--#yiv6938584912 _filtered {} _filtered {} _filtered {}#yiv6938584912 #yiv6938584912 p.yiv6938584912MsoNormal, #yiv6938584912 li.yiv6938584912MsoNormal, #yiv6938584912 div.yiv6938584912MsoNormal {margin:0cm;margin-bottom:.0001pt;font-size:11.0pt;font-family:"Calibri", sans-serif;}#yiv6938584912 a:link, #yiv6938584912 span.yiv6938584912MsoHyperlink {color:blue;text-decoration:underline;}#yiv6938584912 a:visited, #yiv6938584912 span.yiv6938584912MsoHyperlinkFollowed {color:purple;text-decoration:underline;}#yiv6938584912 p.yiv6938584912msonormal0, #yiv6938584912 li.yiv6938584912msonormal0, #yiv6938584912 div.yiv6938584912msonormal0 {margin-right:0cm;margin-left:0cm;font-size:11.0pt;font-family:"Calibri", sans-serif;}#yiv6938584912 span.yiv6938584912E-MailFormatvorlage19 {font-family:"Calibri", sans-serif;color:windowtext;}#yiv6938584912 .yiv6938584912MsoChpDefault {font-size:10.0pt;} _filtered {}#yiv6938584912 div.yiv6938584912WordSection1 {}--> Not sure why you have the doctype declaration in there... perhaps your parser is missing XMLSchema.dtd?
In my xml.xsd there is no such declaration, I fetched it fromhttps://www.w3.org/2001/xml.xsd
Best, Daniel
Von: BaseX-Talk basex-talk-bounces@mailman.uni-konstanz.deIm Auftrag von Hans-Juergen Rennau Gesendet: Mittwoch, 31. August 2022 21:21 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] Problem with validate:xsd-report
Dear BaseX people,
I encounter a problem withvalidate:xsd-report(), more particular with using a schema importing the well-knownxml.xsd. The imported attribute declaration (xml:base) is not found.
I am pretty sure that it is my fault, but I just can't find my error - could you take a look?
(1) Document: doc.xml
<book xml:base="/a/b/c"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
<author>xyz</author>
</book>
(2) Schema: schema.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xs:element name="book">
<xs:element name="author" type="xs:string"/>
</xs:sequence>
<xs:attribute ref="xml:base"/>
</xs:complexType>
</xs:element>
</xs:schema>
(In the same folder, a downloaded copy of xml.xsd is stored - for a snippet, see PS)
(3) Query: validate.xq
let $doc := 'doc.xml'
let $xsd := 'schema.xsd'
return validate:xsd-report($doc, $xsd)
(4) Result:
basex validate.xq
=>
<report>
<status>invalid</status>
<message level="Fatal" line="9" column="43" url="file:/C:/projects/d2type/jats/test-validation/schema.xsd">src-resolve:Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component.
</message>
</report>
I do not understand why the import seems to be ignored. Validating with oXygen works fine, but I suppose that oXygen ignores the @schemaLocation.
If you see the reason, please let me know.
Cheers,
Hans-Jürgen
PS: Snippet fromxml.xsd, stored in the same folder:
<?xml version='1.0'?>
<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" >
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema%22%C2%A0 xml:lang="en">
...
<xs:attribute name="base" type="xs:anyURI">
xs:documentationSeehttp://www.w3.org/TR/xmlbase/ for
information about this attribute.</xs:documentation>
</xs:annotation>
</xs:attribute>
...
</xs:schema>
basex-talk@mailman.uni-konstanz.de