Instead of emailing examples like this to pyxb-users list, please do open a
trac ticket at https://sourceforge.net/apps/trac/pyxb/.  It's from those
tickets that I prioritize responses and form the regression tests that
validate the bug and its fix.

Peter

On Tue, Feb 7, 2012 at 11:52 AM, Karl Putland <k...@simplesignal.com> wrote:

>
> So... poking around a bit more.
>
> The response document
>
>
> '<?xml version="1.0" encoding="UTF-8"?>\n<
> BroadsoftDocument protocol="OCI" xmlns="C" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance";><sessionId
> xmlns="">d3cafbad</sessionId><command echo=""
> xsi:type="AuthenticationResponse"
> xmlns=""><userId>xxxxxx</userId><nonce>1328599257348</nonce><passwordAlgorithm>MD5</passwordAlgorithm></command></BroadsoftDocument>\n'
>
>
> <sessionId> and <command> contain xmlns=""
>
> This seems to be causing the  pyxb.exceptions_.SchemaValidationError:
> QName AuthenticationResponse with absent default namespace cannot be
> resolved
>
>
> If I remove the xmlns="" or set xmlns="C"
> then I get pyxb.exceptions_.BadDocumentError: No type binding for
> AuthenticationResponse
>
>
>
> generation of the modules is done via
> # pyxbgen --binding-root=src -m ocibase OCISchemaBASE.xsd -m bwas
> OCISchemaAS.xsd
>
> I've trimmed the Schema down to the bare minimum to support this example
> and attached it.
>
>
>
> The document generated by pyxb appears to be valid and is accepted
> Broadsoft as a response document is returned.
>
> Trying to round-trip the generated document produces the same error as
> attempting to parse the response document... so it is not necessary to
> interact with BS to reproduce the issue.
>
>
> >>> ar = ocibase.BroadsoftDocument(protocol="OCI", sessionId='d3cafbad',
> command=[bwas.AuthenticationRequest(userId='xxxxxx'),])>>>
> ar.toxml()u'<?xml version="1.0" ?><ns1:BroadsoftDocument protocol="OCI"
> xmlns:ns1="C" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><sessionId>d3cafbad</sessionId><command
> xsi:type="AuthenticationRequest"><userId>xxxxxx</userId></command></ns1:BroadsoftDocument>'
> >>>
> >>>
> >>> bd = ocibase.CreateFromDocument(ar.toxml())
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "ocibase.py", line 32, in CreateFromDocument
>     saxer.parse(StringIO.StringIO(xml_text))
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/expatreader.py",
> line 107, in parse
>     xmlreader.IncrementalParser.parse(self, source)
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/xmlreader.py",
> line 123, in parse
>     self.feed(buffer)
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/expatreader.py",
> line 207, in feed
>     self._parser.Parse(data, isFinal)
>   File
> "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/sax/expatreader.py",
> line 338, in start_element_ns
>     AttributesNSImpl(newattrs, qnames))
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/saxer.py",
> line 329, in startElementNS
>     (did_replace, type_class) =
> XSI._InterpretTypeAttribute(attrs.getValue(self.__XSITypeTuple), ns_ctx,
> None, type_class)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/namespace/builtin.py",
> line 103, in _InterpretTypeAttribute
>     type_en = ns_ctx.interpretQName(type_name,
> namespace=fallback_namespace)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/namespace/resolution.py",
> line 611, in interpretQName
>     raise pyxb.SchemaValidationError('QName %s with absent default
> namespace cannot be resolved' % (local_name,))
> pyxb.exceptions_.SchemaValidationError: QName AuthenticationRequest with
> absent default namespace cannot be resolved
> >>>
>
>
> Thanks,
>
>
>
> --Karl
>
> Karl Putland
> Senior VoIP Engineer
>
> *SimpleSignal*
> 3600 S Yosemite, Suite 150
> Denver, CO 80237
> One Number Rings All My Phones: 303-242-8608
>
> SimpleSignal.com <http://www.simplesignal.com/> | 
> Blog<http://www.simplesignal.com/blog>
>  | Facebook <http://www.facebook.com/SimpleSignal?ref=ts> | 
> Twitter<http://twitter.com/simplesignal>
>
>
>
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to