This regular expression:

([0-9, -]*)

appears on third look to be invalid in XML's regular expression
syntax<http://www.w3.org/TR/xmlschema-2/#nt-charRange>.
A hyphen may only appear in first position in a character range, as is the
case in most other regular expression syntaxes, including Python's, which
PyXB tries to translate to (and fails).

You can work around this by moving the second hyphen to be first in the
character group:

([-0-9, ]*)

Peter

On Mon, Jan 9, 2012 at 7:21 PM, Karl Putland <k...@simplesignal.com> wrote:

> PyXB worked great for parsing XSDs for one project but is failing on this
> project.
>
> --Krl
>
>
>
> Karl-Putlands-MacBook-Pro:Schemas karl$ pyxbgen --binding-root src -m
> resources Resources.xsd urn:uuid:4e255b24-3b26-11e1-abe6-d8a25e94a1dc
> Exception generating bindings: At 9: Unexpected character ']'
> Traceback (most recent call last):
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/EGG-INFO/scripts/pyxbgen",
> line 71, in <module>
>     modules = generator.bindingModules()
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/generate.py",
> line 2445, in bindingModules
>     self.__bindingModules = self.__buildBindingModules()
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/generate.py",
> line 2311, in __buildBindingModules
>     pyxb.namespace.resolution.ResolveSiblingNamespaces(namespaces)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/namespace/resolution.py",
> line 313, in ResolveSiblingNamespaces
>     if not ns.resolveDefinitions(allow_unresolved=True):
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/namespace/resolution.py",
> line 231, in resolveDefinitions
>     resolvable._resolve()
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/xmlschema/structures.py",
> line 4445, in _resolve
>     self.__initializeFromRestriction(candidate, **kw)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/xmlschema/structures.py",
> line 4118, in __initializeFromRestriction
>      return self.__completeResolution(body, None, self._DA_restriction)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/xmlschema/structures.py",
> line 4379, in __completeResolution
>     self.__updateFacets(body)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/xmlschema/structures.py",
> line 4228, in __updateFacets
>     fi.setFromKeywords(**kw)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/facets.py",
> line 132, in setFromKeywords
>     return self._setFromKeywords_vb(**kw)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/facets.py",
> line 201, in _setFromKeywords_vb
>     rv = super_fn(**kw)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/facets.py",
> line 128, in _setFromKeywords_vb
>     return super_fn(**kw)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/facets.py",
> line 305, in _setFromKeywords_vb
>
> self.__items.append(self._CollectionFacet_itemType(facet_instance=self,
> **kw))
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/binding/facets.py",
> line 383, in __init__
>     self.__pythonExpression = pyxb.utils.xmlre.XMLToPython(pattern)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 307, in XMLToPython
>     cg = MaybeMatchCharacterClass(pattern, position)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 290, in MaybeMatchCharacterClass
>     return _MatchCharClassExpr(text, position)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 261, in _MatchCharClassExpr
>     (cps, np) = _MatchCharGroup(text, np)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 233, in _MatchCharGroup
>     (cps, np) = _MatchPosCharGroup(text, np)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 201, in _MatchPosCharGroup
>     (sc1, np) = _CharOrSCE(text, np)
>   File
> "/Library/Python/2.6/site-packages/PyXB-1.1.3-py2.6.egg/pyxb/utils/xmlre.py",
> line 156, in _CharOrSCE
>     raise RegularExpressionError(position, "Unexpected character '%s'" %
> (rc,))
> RegularExpressionError: At 9: Unexpected character ']'
>
>
>
>
> --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>
>
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> pyxb-users mailing list
> pyxb-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pyxb-users
>
>
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to