-
Notifications
You must be signed in to change notification settings - Fork 74
XML without namespace not working. When/How to use default_namespace. #94
Comments
Assuming If
|
I see. |
I'm surprised that even works, because it was never intended that you be able to provide multiple schema files with one So yes, create an If not, attach a document that doesn't get recognized and show me how to reproduce the error. |
maybe the reason why it works is because all the provided XSD files are on the same namespace. I have created the index.xsd which looks like this:
I can now generate the module doing this:
which seems much nicer and appropriate. but unfortunately the problem still persists, if the incoming XML does not include the namespace, it will fail to instantiate the binding, the exception is:
|
I noticed that this does not work either:
|
Put xmlSample somewhere I can see it and reproduce the problem, or there's nothing I can do. |
Sure. I was trying to create a test to reproduce the issue: I have created a test in this branch: https://github.com/rvalle/pyxb/blob/issue-0094/tests/trac/test-issue-0094.py The issue happens without doing the import of the multiple XSDs. |
I'm afraid this is a situation where PyXB's focus on valid XML produces an unsatisfactory answer. PyXB has never supported a default namespace that isn't explicitly identified in the XML. What it does is handle a special case where the XML uses material defined in a schema that has no namespace, and six years ago when I added support for that I erroneously used "default namespace" in the API for that special case. Generally schema in XML RPC do not have a target namespace, and in that situation PyXB's special-case handling makes things work. But the XML RPC documents you're working with are not valid standalone, and for whatever reason the server producing them isn't identifying the associated namespace. PyXB relies on the parser to respect xmlns directives and provide the correct namespace name in the expanded names it produces, but the xml.sax parser doesn't provide a way to set an initial default namespace that isn't present in the XML. I'm not willing to override the expanded names it gives in a non-absent namespace situation because of the risk of accepting documents that should be diagnosed as invalid. For more information see the comment in the commit that closes this issue. Sorry. The workaround would be take the response from the server and insert an |
ok, thanks! |
Hi!
I have an XSD that defines a namespace:
However when making XML-RPC calls the namespace is omitted, and responses are typically
Instead of
I don't know how to get PyXB to work without somehow "patching" the namespace in the xml String before instantiating the binding.
By looking at the API I wishfully tried to do:
I cannot find information about how to use default_namespace or what is it for.
Is there anyway I can tell PyXB to assume that the XML is under a given name-space?
Is that a valid use case for the default_namespace parameter?
The text was updated successfully, but these errors were encountered: