Re: [lxml-dev] getting back RelaxNG tree

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.
Certainly, a string is better than writing to a file.
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.
If the RelaxNG class returns a merged XML string, then that could be passed into the ElementTree parse method for navigation. That seems like an elegant solution.

Eric Scheidemantle wrote:
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.
If the RelaxNG class returns a merged XML string, then that could be passed into the ElementTree parse method for navigation. That seems like an elegant solution.
Especially since we are dealing with a rare case here. Most people use RNG just for validation and are not that interested in the actual XML tree representation that the schema is parsed into. Any chance you can come up with a patch? Stefan
participants (2)
-
Eric Scheidemantle
-
Stefan Behnel