tefra/xsdata-samples

Multiple namespace document

Closed this issue · 1 comments

hcw70 commented

I am currently trying to use two distinct XSDs, where one imports the other,
similair as:
https://xsdata.readthedocs.io/en/v20.3/tests/binding/chapter04.xml.html
(without the include but with the import).

However, after parsing i only see instances only from the "outer" xsd (the one importing the other, xmlns="http://example.org/ord" in that example).

When i try "by hand" (without my cooked classes and my class factory) i get:


import xsdata
import lxml
import msgdb
import msgdb.raw
from xsdata.formats.dataclass.parsers import XmlParser
from xsdata.formats.dataclass.parsers.config import ParserConfig
from xsdata.formats.dataclass.context import XmlContext
from xsdata.formats.dataclass.parsers.handlers import LxmlEventHandler
context = XmlContext()
config = ParserConfig()
parser = XmlParser(config=config, context=context, handler=LxmlEventHandler)
from lxml import etree

elements = etree.parse("doc/compliance-tests/packet-description-edtest-example-integrated.xml")
doc = parser.parse(elements, msgdb.raw.MessageDB)

Results in:


Traceback (most recent call last):
  File "/usr/lib/python3.8/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/home/hcw/work/Deuta/DeutaMessageDatabase-v2/venv/lib/python3.8/site-packages/xsdata/formats/dataclass/parsers/bases.py", line 53, in parse
    result = handler.parse(source)
  File "/home/hcw/work/Deuta/DeutaMessageDatabase-v2/venv/lib/python3.8/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py", line 47, in parse
    return self.process_context(ctx)
  File "/home/hcw/work/Deuta/DeutaMessageDatabase-v2/venv/lib/python3.8/site-packages/xsdata/formats/dataclass/parsers/handlers/lxml.py", line 53, in process_context
    self.parser.start(
  File "/home/hcw/work/Deuta/DeutaMessageDatabase-v2/venv/lib/python3.8/site-packages/xsdata/formats/dataclass/parsers/bases.py", line 87, in start
    child = item.child(qname, attrs, ns_map, len(objects))
  File "/home/hcw/work/Deuta/DeutaMessageDatabase-v2/venv/lib/python3.8/site-packages/xsdata/formats/dataclass/parsers/nodes/element.py", line 339, in child
    raise ParserError(f"Unknown property {self.meta.qname}:{qname}")
xsdata.exceptions.ParserError: Unknown property {http://deuta.de/config/DeutaMsgDatabase/v3}TIterator:{http://deuta.de/config/DeutaMsgDatabase/EncoderDecoderTest/v3}check

Any ideas on this?

Regards
Hauke

hcw70 commented

Ok, had a bad look at my debugger....
works as expected....