Re: [xml] xml Digest, Vol 64, Issue 2

Jerzy Jalocha N wrote:
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=''>
   <!-- Here would go a lot of stuff that belongs to the wrapper. -->
   <grammar xmlns=''>
         <element name='data'>
               <element name='entry'>

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.

Based on this:, your document does not seem to qualify as a valid RELAX NG schema (either as the full syntax (section 3) or the simple syntax (section 4)).

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

Unfortunately, you might have to do just that.
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?
I think you might be incorrect in your assumption. The spec lists two types of syntax for RELAX NG. From my understanding your document does not conform to either one (although it is valid XML). I'm not sure if xmllint supports the full syntax of RELAX NG (as outlined in section 3 of the document), so the safest bet, in my opinion, would be to pre-process the file so that the <grammar> element is the first element in your schema file.

Good luck!

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