[lxml-dev] Resolve RelaxNG document
Lawrence Oluyede
l.oluyede at gmail.com
Thu Sep 6 16:36:16 CEST 2007
> I think the easiest way is to do it by hand, something like:
>
> resolve = etree.XPath("//rng:define[@name = $name]", namespaces=...)
> for ref in tree.iter("ref"):
> define = resolve(tree, name = ref.get("name"))
> if define:
> ref.getparent().replace(ref, define[0]) # or define[0][0] ?
>
Ok thanks anyway, I was doing it by hand. I hoped there was something
in the schema validator. How does the relaxng validator knows if a
document is valid if it doesn't expand references?
That was my thought
--
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair
More information about the lxml-dev
mailing list