[XML-SIG] Bug in 0.8.3 ?
Matthias Kirst
matt at clondiag.com
Mon Sep 15 05:11:42 EDT 2003
Hi,
I'm using the PyXML Suite 0.8.3 with Python 2.3.
The error I'm describing did not occur with 0.7.1 on Python 2.2.
The expression:
xpath.Evaluate( '//SUBSTANCE_GROUP[not( contains( @name, "reverse" ) )]/SUBSTANCE', doc )
failed with:
'Expected node set from relative expression. Got ()'
for the doc from:
<?xml version="1.0"?>
<SUBSTANCE_GROUPS>
<SUBSTANCE_GROUP name="cyp2D6">
<SUBSTANCE name="cyp2D6_Oligo15" job="C188T" alias="C188T-WT" rank="1">
<REL_SUBSTANCE name="cyp2D6_Oligo20" alias="C188T-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo25" job="C1062A" alias="C1062A-WT" rank="2">
<REL_SUBSTANCE name="cyp2D6_Oligo26" alias="C1062A-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo35" job="A1072G" alias="A1072G-WT" rank="3">
<REL_SUBSTANCE name="cyp2D6_Oligo38" alias="A1072G-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo51" job="C1085G" alias="C1085G-WT" rank="4">
<REL_SUBSTANCE name="cyp2D6_Oligo52" alias="C1085G-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo141" job="C1127T" alias="C1127T-WT" rank="5">
<REL_SUBSTANCE name="cyp2D6_Oligo138" alias="C1127T-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo65" job="G1749C" alias="G1749C-WT" rank="6">
<REL_SUBSTANCE name="cyp2D6_Oligo70" alias="G1749C-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo77" job="dT1795" alias="dT1795-WT" rank="7">
<REL_SUBSTANCE name="cyp2D6_Oligo80" alias="dT1795-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo89" job="G1934" alias="G1934-WT" rank="8">
<REL_SUBSTANCE name="cyp2D6_Oligo84" alias="G1934-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo101" job="G2064A" alias="G2064A-WT" rank="9">
<REL_SUBSTANCE name="cyp2D6_Oligo96" alias="G2064A-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo109" job="" alias="dA2637-WT" rank="10">
<REL_SUBSTANCE name="cyp2D6_Oligo110" alias="dA2637-MUT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo115" alias="C2938T-WT" rank="11">
<SUBSTANCE name="cyp2D6_Oligo123" job="G4268C" alias="G4268C-WT" rank="12">
<REL_SUBSTANCE name="cyp2D6_Oligo130" alias="G4268C-MUT"/>
</SUBSTANCE>
<REL_SUBSTANCE name="cyp2D6_Oligo116" alias="C2938T-MUT"/>
</SUBSTANCE>
</SUBSTANCE_GROUP>
<SUBSTANCE_GROUP name="cyp2D6 - reverse">
<SUBSTANCE name="cyp2D6_Oligo20" alias="C188T-MUT" rank="1">
<REL_SUBSTANCE name="cyp2D6_Oligo15" alias="C188T-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo26" alias="C1062A-MUT" rank="2">
<REL_SUBSTANCE name="cyp2D6_Oligo25" alias="C1062A-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo38" alias="A1072G-MUT" rank="3">
<REL_SUBSTANCE name="cyp2D6_Oligo35" alias="A1072G-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo52" alias="C1085G-MUT" rank="4">
<REL_SUBSTANCE name="cyp2D6_Oligo51" alias="C1085G-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo138" alias="C1127T-MUT" rank="5">
<REL_SUBSTANCE name="cyp2D6_Oligo141" alias="C1127T-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo70" alias="G1749C-MUT" rank="6">
<REL_SUBSTANCE name="cyp2D6_Oligo65" alias="G1749C-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo80" alias="dT1795-MUT" rank="7">
<REL_SUBSTANCE name="cyp2D6_Oligo77" alias="dT1795-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo84" alias="G1934-MUT" rank="8">
<REL_SUBSTANCE name="cyp2D6_Oligo89" alias="G1934-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo96" alias="G2064A-MUT" rank="9">
<REL_SUBSTANCE name="cyp2D6_Oligo101" alias="G2064A-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo110" alias="dA2637-MUT" rank="10">
<REL_SUBSTANCE name="cyp2D6_Oligo109" alias="dA2637-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo116" alias="C2938T-MUT" rank="11">
<REL_SUBSTANCE name="cyp2D6_Oligo115" alias="C2938T-WT"/>
</SUBSTANCE>
<SUBSTANCE name="cyp2D6_Oligo130" alias="G4268C-MUT" rank="12">
<REL_SUBSTANCE name="cyp2D6_Oligo123" alias="G4268C-WT"/>
</SUBSTANCE>
</SUBSTANCE_GROUP>
</SUBSTANCE_GROUPS>
I traced down the position the evaluation failed on:
class ParsedRelativeLocationPath:
...
def evaluate(self, context):
rt = self._left.select(context)
if type(rt) != type([]):
raise Exception("Expected node set from relative expression. Got %s"%str(rt))
....
The method got an empty tuple from the self._left.select(context) call.
I added a statement in the class method below and every seems to work fine.
class ParsedChildAxisSpecifier(AxisSpecifier):
def select(self, context, nodeTest):
"""Select all of the children of the context node"""
rt = filter(lambda node, test=nodeTest, context=context, pt=self.principalType:
test(context, node, pt),
context.node.childNodes)
######## added line #########
rt = list( rt )
##########################
return (rt, 0)
My question is: Is there perhaps an error on my side?
Matthias Kirst
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20030915/9e9335a2/attachment.html
More information about the XML-SIG
mailing list