Re: [xml] validation fails for embedded RELAX NG schema



Jerzy Jalocha N schrieb:

I would like to use a RELAX NG schema that is embedded inside some
"outer" XML file:

<?xml version='1.0' encoding='UTF-8'?>
<wrapper xmlns='http://namespace.net/something'>
   <!-- Here would go a lot of stuff that belongs to the wrapper. -->
   <grammar xmlns='http://relaxng.org/ns/structure/1.0'>
      <start>

[...]

Sadly, xmllint (2.6.32) complains about an empty schema:

example-schema.xml:0: Relax-NG parser error : xmlRelaxNGParse:
example-schema.xml is empty
Relax-NG schema example-schema.xml failed to compile.

I'd be surprised to discover that embedding RNG schemas in arbitrary
documents is actually supported. What makes you think it is?

I know, that I could pre-process my "mixed" document, and extract the
schema with XSLT prior to validation. But this would make the whole
project quite a lot more complex, thus I'd like to avoid it, if
possible.

Extracting a subtree from a document doesn't seem too difficult, and
could probably be done using nothing but DOM.

I guess, that I am not doing anything illegal by using two
vocabularies side-by-side, as long as I use separate namespaces,
or am I wrong?

No, you're right. That's what namespaces are for.

Is this a known limitation of xmllint, or maybe a bug?

Again, what makes you think xmllint (or any other parser, for that
matter) should auto-detect embedded RNG schemas in arbitrary
documents?

Michael Ludwig



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]