Hi,
You really solved my problems.
I am currently playing with the generated bindings and didn't hit any
issues so far. The schemas are large and it will take time to test
everything but I think that it will be OK.
> CreateFromDOM/CreateFromDocument in each module are boilerplate that
simply defaults the namespace to the namespace of the
> contained module; if the input document references another namespace, it
should still work as long as that namespace has been registered
> (which is done by importing its schema).
This is correct. After importing all the public modules (that don't start
with _) I can deserialize objects from other namespaces.
Thanks for your help.
Regards,
Vladimir
On Thu, Feb 28, 2013 at 2:25 PM, Peter Bigot <big...@acm.org> wrote:
> PyXB does not provide a wrapper to attempt to process an unknown document
> in any of a set of possible schemas. I don't think the
> combine-into-one-schema process that you describe would work or is
> necessary.
>
> If you're getting modules with underscores, you either have schema that
> have mutual dependencies or you aren't fully factoring the dependencies
> out. You should be able to translate the schema separately into individual
> modules. You may need to first generate bindings for any schema that they
> all depend on. See http://pyxb.sourceforge.net/userref_pyxbgen.htmlwhich has
> several sections that apply to your situation.
>
> CreateFromDOM/CreateFromDocument in each module are boilerplate that
> simply defaults the namespace to the namespace of the contained module; if
> the input document references another namespace, it should still work as
> long as that namespace has been registered (which is done by importing its
> schema).
>
> Then your program would import the modules for the entrypoint (master)
> schemas, and you can use the CreateFromDocument() function from any one of
> them, or just do something like the boilerplate code does without selecting
> a default namespace.
>
> If the documents you're processing do not correctly identify their
> namespaces, you'll need to either do the iterative try/except approach you
> outline or infer that information from their content.
>
> If your master schema are for incompatible versions of the same namespace
> you will also have problems. See
> https://sourceforge.net/projects/pyxb/forums/forum/956708/topic/6653102for
> some discussion about that situation.
>
> Peter
>
> On Thu, Feb 28, 2013 at 4:06 AM, Vladimir Todorov <inspell...@gmail.com>wrote:
>
>> Hi,
>>
>> I have three master schemas that I have to use to deserialize the objects.
>> My question is: Is it possible to combine these schemas in one object so
>> I can use that object to deserialize all types of objects. In JAXB I can
>> define a Context that includes several namespaces and I can use that
>> Context to deserialize all types of objects.
>> But with pyxb I have several files that I need to import and use them
>> separately to deserialize different objects.
>> I could have something like:
>> import master1, master2
>>
>> try:
>> return master1.CreateFromDOM(domutils.StringToDOM(r))
>> except:
>> try:
>> return master2.CreateFromDOM(domutils.StringToDOM(r))
>> except:
>> return None
>>
>>
>> But I was wondering if I can just put everything in one big py file,
>> import it and use it.
>> Currently I run pyxbgen once to generate everything and I put my master
>> schemas first in the parameter list and then the rest of the schemas (-u
>> <path> -m <module>). The command generates several modules starting with _
>> and three other modules that start with a character (not _) - these three I
>> need to import and use.
>> Should I define my own schema that includes the three master schemas and
>> generate the bindings again to achieve what I need?
>>
>> Regards,
>> Vladimir
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_feb
>> _______________________________________________
>> pyxb-users mailing list
>> pyxb-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pyxb-users
>>
>>
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users