Eric Scheidemantle wrote:
I'd like to use a set of RelaxNG documents to construct a validation API. The documents will be modular and combined using the externalRef and include tags. I will need a way to access the merged files as if they were one Russian-Doll style file.
uhm, just for clarity: you mean the XML tree of the merged RelaxNG file, right?
I see that etree.RelaxNG can be passed an ElementTree object.
or a filename alternatively.
I assume that etree.parse is not going to resolve RelaxNG references like , and .
Sorry, like what?
Does the object etree.RelaxNG return have methods to access the document as if it were built Russian-Doll style, or is it strictly limited to validation?
It does validation, nothing more.
Is there any access to the libxml function xmlRelaxNGDumpTree which I assume may do something like this, but to a file?
No, not currently. Should be easy to add, though. Just add a method (or property?) to the RelaxNG class that retrieves the in-memory tree. Maybe the XMLSchema class could do the same? I'd prefer a string result over writing to a file, BTW. It's easy to write a string to a file, but it's overhead to read in a file when all you wanted is a string.
Oh, and: I assume building an ElementTree from the internal RelaxNG schema is not a good idea, as it could interfere too much with the validation. Copying them first /might/ work, though.
Ditto for xmlRelaxNGParse?
That's the function used for parsing. What does the "ditto" refer to here?
You can look up the code in the file src/lxml/relaxng.pxi. It's pretty short and easy to read.