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:[EMAIL PROTECTED]/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 [EMAIL PROTECTED]: 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

 

_______________________________________________
XML-SIG maillist  -  XML-SIG@python.org
http://mail.python.org/mailman/listinfo/xml-sig

Reply via email to