xueqingwell / py-dom-xpath Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/py-dom-xpath
Automatically exported from code.google.com/p/py-dom-xpath
This project appears to be all but completely dead, but for the benefit of
others:
The latest versions of pip will not install due to the following errors:
py-dom-xpath an externally hosted file and may be unreliable
py-dom-xpath is potentially insecure and unverifiable.
The installation can be forced with the following
pip install --allow-external py-dom-xpath --allow-unverified py-dom-xpath .
Original issue reported on code.google.com by [email protected]
on 4 Aug 2014 at 11:55
What steps will reproduce the problem?
1. Consider the document "<foo><text>hi</text></foo>"
2. The query "//text" will result in a syntax error, though it seems to be
valid.
What is the expected output? What do you see instead?
A list of one element.
What version of the product are you using? On what operating system?
version 0.1 on openSUSE 11.3
Please provide any additional information below.
I have tested query on a couple of online websites (like this one:
http://www.futurelab.ch/xmlkurs/xpath.en.html) and they work fine. It seems
that the library doesn't let "text" be part of a query because it is a keyword.
Original issue reported on code.google.com by [email protected]
on 22 Dec 2010 at 7:41
What steps will reproduce the problem?
1. Get a dom object
2. Use a xpath which contains "node" to find a node.
xpath.find("//node[@name='xxx']", element)
3. Get an Exception:
*** XPathParseError: Syntax error:
//node
------^
Why I can't use a xpath contains "node"?
Original issue reported on code.google.com by [email protected]
on 13 Jul 2012 at 8:07
CDATA-Sections are lost in the string_value function:
>>> str = '<asdf><![CDATA[lalaal<hallo>lasdfasdf]]></asdf>'
>>> import xml.dom.minidom as minidom
>>> doc = minidom.parseString(str)
>>> import xpath
>>> from xpath.expr import string_value
>>> string_value(doc.firstChild.firstChild)
>>>
>>> string_value(doc)
u''
>>>
I expected:
u'lalaal<hallo>lasdfasdf'
What version of the product are you using? On what operating system?
Python 2.5, Windows 7
Attached is a patch that checks for CDATA-Sections and inserts their content
into the string-value.
Original issue reported on code.google.com by [email protected]
on 2 Dec 2010 at 7:31
Attachments:
python2.7
import xpath
from xml.dom import minidom
xml =
minidom.parseString("<Rerservations><Rerservation><endDate>2011-03-15T11:00:00+0
8:00</endDate></Rerservation></Rerservations>")
xpath.find(xml,"/Reservations/endDate")
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
xpath.find(xml,"/Reservations/Reservation/endDate")
File "C:\Python27\lib\site-packages\xpath\__init__.py", line 23, in api_function
raise e
XPathParseError: Syntax error:
<xml.dom.minidom.Document instance at 0x014A53C8>
^
Original issue reported on code.google.com by [email protected]
on 14 Mar 2011 at 6:45
Python 2.6, py-dom-xpath from trunk
ERROR: test_string_number_nan (__main__.TestStringFunctions)
----------------------------------------------------------------------
Traceback (most recent call last):
File "functions.py", line 127, in test_string_number_nan
result = xpath.find('string(0 div 0)', self.doc)
File "/home/user/.local/lib/python2.6/site-packages/xpath/__init__.py",
line 21, in api_function
return f(*args, **kwargs)
File "/home/user/.local/lib/python2.6/site-packages/xpath/__init__.py",
line 150, in find
return XPath.get(expr).find(node, **kwargs)
File "/home/user/.local/lib/python2.6/site-packages/xpath/__init__.py",
line 21, in api_function
return f(*args, **kwargs)
File "/home/user/.local/lib/python2.6/site-packages/xpath/__init__.py",
line 113, in find
return self.expr.evaluate(node, 1, 1, context)
File "/home/user/.local/lib/python2.6/site-packages/xpath/expr.py", line
729, in evaluate
result = self.steps[0].evaluate(node, pos, size, context)
File "/home/user/.local/lib/python2.6/site-packages/xpath/expr.py", line
368, in new_f
args = [convert(x) for x in args]
File "/home/user/.local/lib/python2.6/site-packages/xpath/expr.py", line
104, in string
elif int(v) == v and v <= 0xffffffff:
ValueError: cannot convert float NaN to integer
----------------------------------------------------------------------
Ran 77 tests in 0.118s
FAILED (errors=1)
Original issue reported on code.google.com by Genotip7
on 3 Mar 2010 at 11:02
[Description]
Since XPathContext tries to retrieve the default namespace URI from the
document elements' xmlns attribute, it doesn't work in the following situation
where a) xmlns attribute is modified afterward b) the default namespace URI for
the document without namespace specifications is implied by the DOM parser.
I was stuck on this in the case (b) because I have a DOM implementation other
than minidom (actually backed by the WebKit DOM through PyObjC).
Patch attached.
[Code for reproduction]
from xml.dom.minidom import parseString
from xpath import XPathContext
doc = parseString('''
<foo xmlns="http://foo.example.com/">
<item>foo</item>
<item xmlns="http://bar.example.com/">bar</item>
</foo>
''')
doc.documentElement.setAttribute('xmlns', 'http://bar.example.com/')
assert doc.documentElement.namespaceURI == 'http://foo.example.com/'
assert doc.documentElement.getAttribute('xmlns') == 'http://bar.example.com/'
nodeset = XPathContext(doc).find('//item', doc)
assert len(nodeset) == 1
assert nodeset[0].namespaceURI == 'http://foo.example.com/' # boom!
[What version of the product are you using? On what operating system?]
SVN head
Original issue reported on code.google.com by [email protected]
on 6 Jan 2013 at 12:09
Attachments:
What steps will reproduce the problem?
1. search for //AAA/BBB/CCC-DDD
What is the expected output? What do you see instead?
I'd expect to get the count of element "CCC-DDD", but it's not found.
What version of the product are you using? On what operating system?
Running version py-dom-xpath-0.1.tar.gz with Python 2.7.2 under Debian 4.1.1-21.
Please provide any additional information below.
I'm not sure if the "-" is interpreted as an operator. I also tried to escape
it, but that didn't work either. I hope there's still someone watching this
project from time to time, so I can get a reply ;)
Original issue reported on code.google.com by [email protected]
on 14 Feb 2012 at 12:45
removed parentheses from declaration of class XPath on line 80. an empty paren
set doesn't work on Python 2.4, but everything else does. it would be too bad
to not have backward compatibility just for that.
Does it really change anything?
[email protected]
Original issue reported on code.google.com by [email protected]
on 28 Apr 2011 at 1:43
Attachments:
What steps will reproduce the problem?
1. find any attribute with regex
2. using [fn:matches(@* , "^a*")]
What is the expected output? What do you see instead?
I would like to see any node have attribute start with "a" if it dont use
start-with.
such as
<BBB type="aaa"/>
<BBB type="abb"/>
What version of the product are you using? On what operating system?
version 0.1
Windows XP
Please provide any additional information below.
I have xml content like this
<AAA>
<BBB type="aaa"/>
<BBB type="abb"/>
<BBB type="baa"/>
</AAA>
Original issue reported on code.google.com by anolpaisal
on 29 Mar 2010 at 6:33
What steps will reproduce the problem?
1. Find or create an XML file containing an element named 'text'.
2. Try to access that element's content via XPath via the findvalue() function
For example, I'm loading lexicon data from a LIFT file within the context of an
'entry' element. This line fails:
lexeme = context.findvalue('lexical-unit/form/text/descendant-or-self::text()',
entry)
xpath.exceptions.XPathParseError: Syntax error:
lexical-unit/form/text/descendant-or-self::text()
----------------------^
What is the expected output? What do you see instead?
I was hoping it could handle this kind of input file, since I think it's valid
XML. But apparently text (even without parentheses) is some kind of reserved
word, either in XPath or py-dom-xpath, I'm not sure.
What version of the product are you using? On what operating system?
Version 0.1, fron 2/22/2009, on WinXP SP3 under Python 2.7.
Please provide any additional information below.
Is there an alternate syntax for this kind of thing? Or is there an easier
workaround than what I've come up with? (I.e. making a copy of the source file,
renaming all of its text elements to textt, and writing my XPaths to match
that. Tedious.)
Original issue reported on code.google.com by [email protected]
on 1 May 2012 at 2:01
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.