[XML-SIG] How to parse an XPath containing resolve-QName

Bryan Ellis bellis at baldcom.net
Thu Oct 5 23:58:42 CEST 2006


Trying to execute the following xpath as defined by the w3c group in their
document:

XML Schema Patterns for Common Data Structures Version 1.0

http://www.w3.org/2002/ws/databinding/edcopy/basic/basic.html

 

 

Program:

-----

import xml.dom.minidom

from xml import xpath

 

sch = xml.dom.minidom.Document

sch =
xml.dom.minidom.parse("C:\Files\Python\GetInvType.xsd").documentElement

nsContext = xml.xpath.Context.Context(sch) 

nsContext.setNamespaces({"xs" : "http://www.w3.org/2001/XMLSchema"})

xPath ='''//xs:restriction[@base/resolve-QName(.,..) =
xs:QName('xs:decimal')]/xs:pattern'''

elem = xpath.Compile(xPath)

nodes = elem.evaluate(nsContext)

 

Error:

--------

xml.xpath.RuntimeException: There is an internal bug in 4XPath.  Please
report this error code to support at 4suite.org: Traceback (most recent call
last):

  File "C:\Python24\Lib\site-packages\_xmlplus\xpath\__init__.py", line 76,
in Compile

    return parser.new().parse(expr)

  File "C:\Python24\Lib\site-packages\_xmlplus\xpath\pyxpath.py", line 322,
in parse

    raise SyntaxError(e.pos, e.msg, str)

SyntaxError: SyntaxError[@ char 6: Could not match Step]

 

 

Traceback (innermost last):

 

File "c:\Files\Python\TestXPath.py", line 1, in ?

  import xml.dom.minidom

File "c:\Files\Python\TestXPath.py", line 9, in ?

  elem = xpath.Compile(xPath)

File "C:\Python24\Lib\site-packages\_xmlplus\xpath\__init__.py", line 83, in
Compile

  raise RuntimeException(RuntimeException.INTERNAL, stream.getvalue())

 

Any help?

Thanks!

.Bryan

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20061005/a8dfaf5b/attachment.htm 


More information about the XML-SIG mailing list