Re: [xml] Inspecting a RelaxNG schema

On Fri, Oct 31, 2003 at 04:48:42PM +0100, Luigi Ballabio wrote:

Hi all,
      apologies if I missed any relevant FAQ or documentation entries. I'm using 
the Python bindings (specifically, the RelaxNG module API) to parse a 
RelaxNG schema. What I'm doing is:

 >>> from libxmlmods import libxml2mod
 >>> ctxt = libxml2mod.xmlRelaxNGNewParserCtxt('foo.rng')
 >>> schema = libxml2mod.xmlRelaxNGParse(ctxt)

which, I guess, is a fairly direct translation of the corresponding C code.

By the end of the last instruction, the RelaxNG module has made most of the 
work I'm interested in at the time. In particular, and if I'm not mistaken, 
it descended into any documents referenced by <include> nodes in order to 
build the full schema (well, it wanted the referenced files to be there, so 
I assumed it did read them.)


The problem is, the resulting xmlRelaxNGPtr is 
returned to Python as a very much opaque PyCObject pointer.


My question is, is there any exported function in the module which will 
allow me to inspect the created schema? Can it be converted to some less 
opaque structure? Or should I resort to coding in C <shudder>?

  It's opaque even at the C level, the structures are defined in the C module
not in the header and not exported.
  What do you need to know from those data structure ? Then an API might
be designed and added. Considering the level of complexity of the Relax-NG
structure, exposing the internals directly won't help you anyway ! Read
the relaxng.c module, see it in action under a debugger and you will see what
I mean, then you might be in a better position to sugest an API.


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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