It's been a while since I've done anything with PyXB, so I may be rusty.
But what you're describing is supposed to just work.
PyXB maintains a registry of known namespaces, which is initialized when a
module is loaded. As a document is processed, the relevant namespace should
be resolved and its content model used.
Although each module contains helper functions CreateFromDocument and
CreateFromDOM, these should only provide a default namespace. You should be
able to process a document that has full namespace information by using any
of the CreateFromDOM functions. (The document must include the necessary
xmlns:foo="uri" namespace declarations to map the namespace qualifiers to
the actual namespaces which are URIs.)
If the document uses an absent namespace, then you have to use the
CreateFromDOM function from the correct module, or identify the correct
Namespace instance and provide it. (These functions also provide the option
of overriding the default namespace, though I see a potential bug in that
CreateFromDocument ignores it in favor of the module namespace.)
I thought I had some multiple namespace examples in the manual, but I don't
see them offhand. From the distribution, examples/xsdprimer shows an
example of a document that uses multiple namespaces, as would anything
involving the OGC schema.
If you continue to have problems, please provide a pointer to a set of
example schema and a document, along with the application code that isn't
doing what you think it should, and I'll take a look.
Peter
On Tue, Feb 22, 2011 at 6:19 AM, Jon Siddle <j...@corefiling.co.uk> wrote:
> I'm looking at using pyxb for providing an extension mechanism and could
> do with some guidance.
>
> Say I have a.xsd which provides a namespace containing the head of a
> substitution group, and b.xsd which provides a separate namespace
> and contains elements which can be substituted.
>
> I can generate module a and module b, and I can successfully parse an
> xml file using b.CreateFromDOM but not a.CreateFromDOM.
>
> My problem is that b.xsd (and later c.xsd) will be introduced long after
> a.xsd. So once I've added c.xsd (module c), how do
> I process a file which contains substitutions from both b and c?
>
> I don't think this is specific to substitution groups at all. More
> generally, if I have an XML file containing multiple namespaces; how do
> I parse
> it?
>
> Jon
>
>
> ------------------------------------------------------------------------------
> Index, Search & Analyze Logs and other IT data in Real-Time with Splunk
> Collect, index and harness all the fast moving IT data generated by your
> applications, servers and devices whether physical, virtual or in the
> cloud.
> Deliver compliance at lower cost and gain new business insights.
> Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> pyxb-users mailing list
> pyxb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyxb-users
>
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk
Collect, index and harness all the fast moving IT data generated by your
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights.
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users