Daniel and all:
I'm writing on behalf of Brian West, Stefan Anca and myself. By merging
all our brains, we've come up with a candidate implementation of python
wrapper code for returning XPATH_POINT, XPATH_RANGE, XPATH_LOCATIONSET.
We've choosen to represent a POINT as a tuple of a node and an integer
offset into the content of the node. A RANGE then is a list of POINTs,
and a LOCATIONSET is a list of RANGEs.
I've attached a diff against CVS head (from repository at
anoncvs.gnome.org:/cvs/gnome/libxml2 ), with new files as separate
attachements.
There's a bit of impedance mis-match between xpointer's 1 based offsets
to points between characters, and python 0 based indexes into character
array-like strings. We chose not to attempt to adjust those.
The final hurdle was to fixup xpathObjectRet() to not assume any list
was a list of nodes (since we've got ints in there as well). This did
cause one change in the API from the python side: previously, tuples of
nodes were returned as a list. We preserve the tupleness of those now.
Looks like all other uses of python tuples are in error handlers or as
arguments to PyEval: none were passed to xpathObjectRet.
A student working with us even coded up some tests, which I've attached
as well: they need to be dropped in python/tests. They may need fixing
up to match your test machinery. Right now, they're a bit chatty.
Ross
--
Ross Reedstrom, Ph.D. [EMAIL PROTECTED]
Research Scientist phone: 713-348-6166
The Connexions Project http://cnx.org fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E F888 D3AE 810E 88F0 BEDE
Index: libxml.py
===================================================================
RCS file: /cvs/gnome/libxml2/python/libxml.py,v
retrieving revision 1.39
diff -u -r1.39 libxml.py
--- libxml.py 26 Jun 2006 18:25:39 -0000 1.39
+++ libxml.py 29 Sep 2006 22:31:21 -0000
@@ -552,10 +552,17 @@
return xmlNode(_obj=o)
def xpathObjectRet(o):
- if type(o) == type([]) or type(o) == type(()):
- ret = map(lambda x: nodeWrap(x), o)
+ otype = type(o)
+ if otype == type([]):
+ ret = map(xpathObjectRet, o)
return ret
- return o
+ elif otype == type(()):
+ ret = map(xpathObjectRet, o)
+ return tuple(ret)
+ elif otype == type('') or otype == type(0) or otype == type(0.0):
+ return o
+ else:
+ return nodeWrap(o)
#
# register an XPath function
Index: types.c
===================================================================
RCS file: /cvs/gnome/libxml2/python/types.c,v
retrieving revision 1.21
diff -u -r1.21 types.c
--- types.c 18 Jun 2006 17:40:53 -0000 1.21
+++ types.c 29 Sep 2006 22:31:21 -0000
@@ -395,8 +395,106 @@
ret = PyString_FromString((char *) obj->stringval);
break;
case XPATH_POINT:
+ {
+ PyObject *node;
+ PyObject *indexIntoNode;
+ PyObject *tuple;
+
+ node = libxml_xmlNodePtrWrap(obj->user);
+ indexIntoNode = PyInt_FromLong((long) obj->index);
+
+ tuple = PyTuple_New(2);
+ PyTuple_SetItem(tuple, 0, node);
+ PyTuple_SetItem(tuple, 1, indexIntoNode);
+
+ ret = tuple;
+ break;
+ }
case XPATH_RANGE:
+ {
+ unsigned short bCollapsedRange;
+
+ bCollapsedRange = ( (obj->user2 == NULL) ||
+ ((obj->user2 == obj->user) && (obj->index ==
obj->index2)) );
+ if ( bCollapsedRange ) {
+ PyObject *node;
+ PyObject *indexIntoNode;
+ PyObject *tuple;
+ PyObject *list;
+
+ list = PyList_New(1);
+
+ node = libxml_xmlNodePtrWrap(obj->user);
+ indexIntoNode = PyInt_FromLong((long) obj->index);
+
+ tuple = PyTuple_New(2);
+ PyTuple_SetItem(tuple, 0, node);
+ PyTuple_SetItem(tuple, 1, indexIntoNode);
+
+ PyList_SetItem(list, 0, tuple);
+
+ ret = list;
+ } else {
+ PyObject *node;
+ PyObject *indexIntoNode;
+ PyObject *tuple;
+ PyObject *list;
+
+ list = PyList_New(2);
+
+ node = libxml_xmlNodePtrWrap(obj->user);
+ indexIntoNode = PyInt_FromLong((long) obj->index);
+
+ tuple = PyTuple_New(2);
+ PyTuple_SetItem(tuple, 0, node);
+ PyTuple_SetItem(tuple, 1, indexIntoNode);
+
+ PyList_SetItem(list, 0, tuple);
+
+ node = libxml_xmlNodePtrWrap(obj->user2);
+ indexIntoNode = PyInt_FromLong((long) obj->index2);
+
+ tuple = PyTuple_New(2);
+ PyTuple_SetItem(tuple, 0, node);
+ PyTuple_SetItem(tuple, 1, indexIntoNode);
+
+ PyList_SetItem(list, 1, tuple);
+
+ ret = list;
+ }
+ break;
+ }
case XPATH_LOCATIONSET:
+ {
+ xmlLocationSetPtr set;
+
+ set = obj->user;
+ if ( set && set->locNr > 0 ) {
+ int i;
+ PyObject *list;
+
+ list = PyList_New(set->locNr);
+
+ for (i=0; i<set->locNr; i++) {
+ xmlXPathObjectPtr setobj;
+ PyObject *pyobj;
+
+ setobj = set->locTab[i]; /*xmlXPathObjectPtr setobj*/
+
+ pyobj = libxml_xmlXPathObjectPtrWrap(setobj);
+ /* xmlXPathFreeObject(setobj) is called */
+ set->locTab[i] = NULL;
+
+ PyList_SetItem(list, i, pyobj);
+ }
+ set->locNr = 0;
+ ret = list;
+ } else {
+ Py_INCREF(Py_None);
+ ret = Py_None;
+ }
+ break;
+ }
default:
#ifdef DEBUG
printf("Unable to convert XPath object type %d\n", obj->type);
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/gnome/libxml2/python/tests/Makefile.am,v
retrieving revision 1.43
diff -u -r1.43 Makefile.am
--- tests/Makefile.am 26 Jun 2006 18:25:40 -0000 1.43
+++ tests/Makefile.am 29 Sep 2006 22:31:21 -0000
@@ -5,6 +5,7 @@
attribs.py \
tst.py \
tstxpath.py \
+ tstxpointer.py \
xpathext.py \
push.py \
pushSAX.py \
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN"
"http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/"
id="m10035">
<name>Geometric Representation of Modulation Signals</name>
<metadata>
<md:version>2.13</md:version>
<md:created>2001/06/01</md:created>
<md:revised>2005/09/19 13:36:15.537 GMT-5</md:revised>
<md:authorlist>
<md:author id="aaz">
<md:firstname>Behnaam</md:firstname>
<md:surname>Aazhang</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:author>
</md:authorlist>
<md:maintainerlist>
<md:maintainer id="dinesh">
<md:firstname>Dinesh</md:firstname>
<md:surname>Rajan</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:maintainer>
<md:maintainer id="mohammad">
<md:firstname>Mohammad</md:firstname>
<md:othername>Jaber</md:othername>
<md:surname>Borran</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:maintainer>
<md:maintainer id="rha">
<md:firstname>Roy</md:firstname>
<md:surname>Ha</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:maintainer>
<md:maintainer id="mrshawn">
<md:firstname>Shawn</md:firstname>
<md:surname>Stewart</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:maintainer>
<md:maintainer id="aaz">
<md:firstname>Behnaam</md:firstname>
<md:surname>Aazhang</md:surname>
<md:email>[EMAIL PROTECTED]</md:email>
</md:maintainer>
</md:maintainerlist>
<md:keywordlist>
<md:keyword>bases</md:keyword>
<md:keyword>basis</md:keyword>
<md:keyword>geometric representation</md:keyword>
<md:keyword>orthogonal</md:keyword>
<md:keyword>signal</md:keyword>
</md:keywordlist>
<md:abstract>Geometric representation of signals provides a compact,
alternative characterization of signals.</md:abstract>
</metadata>
<content>
<para id="para1">
Geometric representation of signals can provide a compact
characterization of signals and can simplify analysis of their
performance as modulation signals.
</para>
<para id="para2">
Orthonormal bases are essential in geometry. Let
<m:math>
<m:set>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:ci>???</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>M</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:set>
</m:math>
be a set of signals.
</para>
<para id="para3">
Define
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
</m:math>.
</para>
<para id="para4">
Define
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:scalarproduct/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
</m:apply>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:times/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:conjugate/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
and
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:apply>
<m:divide/>
<m:cn>1</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mn>2</m:mn>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mn>2</m:mn>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</para>
<para id="para5">
In general
<equation id="eq01">
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>k</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:apply>
<m:divide/>
<m:cn>1</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mi>k</m:mi>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>k</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:sum/>
<m:bvar>
<m:ci>j</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>1</m:cn>
</m:lowlimit>
<m:uplimit>
<m:apply>
<m:minus/>
<m:ci>k</m:ci>
<m:cn>1</m:cn>
</m:apply>
</m:uplimit>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>kj</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>j</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mi>k</m:mi>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>k</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:sum/>
<m:bvar>
<m:ci>j</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>1</m:cn>
</m:lowlimit>
<m:uplimit>
<m:apply>
<m:minus/>
<m:ci>k</m:ci>
<m:cn>1</m:cn>
</m:apply>
</m:uplimit>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>kj</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>j</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
</m:math>.
</para>
<para id="para6">
The process continues until all of the <m:math><m:ci>M</m:ci>
</m:math> signals are exhausted. The results are
<m:math><m:ci>N</m:ci> </m:math> orthogonal signals with unit
energy,
<m:math>
<m:set>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:ci>???</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>N</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:set>
</m:math>
where
<m:math>
<m:apply>
<m:leq/>
<m:ci>N</m:ci>
<m:ci>M</m:ci>
</m:apply>
</m:math>.
If the signals
<m:math>
<m:set>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:ci>???</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>M</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:set>
</m:math>
are linearly independent, then
<m:math>
<m:apply>
<m:eq/>
<m:ci>N</m:ci>
<m:ci>M</m:ci>
</m:apply>
</m:math>.
</para>
<para id="para7">
The <m:math><m:ci>M</m:ci> </m:math> signals can be represented
as
<equation id="eq02">
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:sum/>
<m:bvar>
<m:ci>n</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>1</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>N</m:ci>
</m:uplimit>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>mn</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>n</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
with
<m:math>
<m:apply>
<m:in/>
<m:ci>m</m:ci>
<m:set>
<m:cn>1</m:cn>
<m:cn>2</m:cn>
<m:ci>???</m:ci>
<m:ci>M</m:ci>
</m:set>
</m:apply>
</m:math>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>mn</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:scalarproduct/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>??</m:mi>
<m:mi>n</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:math>
and
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:sum/>
<m:bvar>
<m:ci>n</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>1</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>N</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>mn</m:mi>
</m:msub>
</m:ci>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
</m:math>.
The signals can be represented by
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub></m:ci>
<m:vector>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mrow><m:mi>m</m:mi><m:mn>1</m:mn>
</m:mrow>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mrow><m:mi>m</m:mi><m:mn>2</m:mn>
</m:mrow>
</m:msub>
</m:ci>
<m:ci>???</m:ci>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>mN</m:mi>
</m:msub>
</m:ci>
</m:vector>
</m:apply>
</m:math>
</para>
<example id="example1">
<figure id="fig1">
<media type="image/png" src="Figure4-9_1.png"/>
</figure>
<para id="para8">
<equation id="eq03">
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:root/>
<m:apply>
<m:times/>
<m:apply>
<m:power/>
<m:ci>A</m:ci>
<m:cn>2</m:cn>
</m:apply>
<m:ci>T</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
<equation id="eq04">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>11</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:times/>
<m:ci>A</m:ci>
<m:apply>
<m:root/>
<m:ci>T</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
<equation id="eq05">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:minus/>
<m:apply>
<m:times/>
<m:ci>A</m:ci>
<m:apply>
<m:root/>
<m:ci>T</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
<equation id="eq06">
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:times/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
<m:apply>
<m:divide/>
<m:cn>1</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mn>2</m:mn>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
<m:apply>
<m:times/>
<m:apply>
<m:plus/>
<m:apply>
<m:minus/>
<m:ci>A</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:times/>
<m:ci>A</m:ci>
<m:apply>
<m:root/>
<m:ci>T</m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:root/>
<m:ci>T</m:ci>
</m:apply>
</m:apply>
</m:apply>
<m:apply>
<m:divide/>
<m:cn>1</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:mover>
<m:msub>
<m:mi>E</m:mi>
<m:mn>2</m:mn>
</m:msub>
<m:mo>^</m:mo>
</m:mover>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
<m:cn>0</m:cn>
</m:apply>
</m:math>
</equation>
</para>
<figure id="fig2">
<media type="image/png" src="Figure4-9_2.png"/>
</figure>
<para id="para9">
Dimension of the signal set is 1 with
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:power/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>11</m:mn>
</m:msub>
</m:ci>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:math>
and
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:power/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:math>.
</para>
</example>
<example id="example2">
<figure id="fig3">
<media type="image/png" src="Figure4-9_3.png"/>
</figure>
<para id="para10">
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:ci type="fn"><m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub></m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:times/>
<m:apply>
<m:power/>
<m:ci>A</m:ci>
<m:cn>2</m:cn>
</m:apply>
<m:ci>T</m:ci>
</m:apply>
<m:cn>4</m:cn>
</m:apply>
</m:apply>
</m:math>
</para>
<para id="para11">
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub></m:ci>
<m:vector>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
</m:vector>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub></m:ci>
<m:vector>
<m:cn>0</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
</m:vector>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>3</m:mn>
</m:msub></m:ci>
<m:vector>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
<m:cn>0</m:cn>
</m:vector>
</m:apply>
</m:math>, and
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>4</m:mn>
</m:msub></m:ci>
<m:vector>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
<m:cn>0</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:vector>
</m:apply>
</m:math>
<equation id="eq08">
<m:math>
<m:apply>
<m:forall/>
<m:bvar>
<m:ci>m</m:ci>
<m:ci>n</m:ci>
</m:bvar>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mi>mn</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:abs/>
<m:apply>
<m:minus/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub></m:ci>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mi>n</m:mi>
</m:msub></m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:root/>
<m:apply>
<m:sum/>
<m:bvar>
<m:ci>j</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>1</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>N</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:minus/>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>mj</m:mi>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>s</m:mi>
<m:mi>nj</m:mi>
</m:msub>
</m:ci>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
<m:apply>
<m:root/>
<m:apply>
<m:times/>
<m:cn>2</m:cn>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
is the Euclidean distance between signals.
</para>
</example>
<example id="example3">
<para id="para12">
Set of 4 equal energy biorthogonal signals.
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:ci type="fn">s</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:ci type="fn">
<m:msup>
<m:mi>s</m:mi>
<m:mo>???</m:mo>
</m:msup>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>3</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">s</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mn>4</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:minus/>
<m:apply>
<m:ci type="fn">
<m:msup>
<m:mi>s</m:mi>
<m:mo>???</m:mo>
</m:msup>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>.
</para>
<para id="para13">
The orthonormal basis
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>1</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:ci type="fn">s</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>??</m:mi>
<m:mn>2</m:mn>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:divide/>
<m:apply>
<m:ci type="fn">
<m:msup>
<m:mi>s</m:mi>
<m:mo>???</m:mo>
</m:msup>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
where
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:int/>
<m:bvar>
<m:ci>t</m:ci>
</m:bvar>
<m:lowlimit>
<m:cn>0</m:cn>
</m:lowlimit>
<m:uplimit>
<m:ci>T</m:ci>
</m:uplimit>
<m:apply>
<m:power/>
<m:apply>
<m:ci type="fn">
<m:msub>
<m:mi>s</m:mi>
<m:mi>m</m:mi>
</m:msub>
</m:ci>
<m:ci>t</m:ci>
</m:apply>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</para>
<para id="para14">
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub></m:ci>
<m:vector>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
<m:cn>0</m:cn>
</m:vector>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub></m:ci>
<m:vector>
<m:cn>0</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:vector>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>3</m:mn>
</m:msub></m:ci>
<m:vector>
<m:apply>
<m:minus/>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
<m:cn>0</m:cn>
</m:vector>
</m:apply>
</m:math>,
<m:math>
<m:apply>
<m:eq/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>4</m:mn>
</m:msub></m:ci>
<m:vector>
<m:cn>0</m:cn>
<m:apply>
<m:minus/>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:vector>
</m:apply>
</m:math>. The four signals can be geometrically represented using the
4-vector of projection coefficients
<m:math>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub></m:ci>
</m:math>,
<m:math>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub></m:ci>
</m:math>,
<m:math>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>3</m:mn>
</m:msub></m:ci>
</m:math>, and
<m:math>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>4</m:mn>
</m:msub></m:ci>
</m:math> as a set of constellation points.
</para>
<figure id="fig4">
<name>Signal constellation</name>
<media type="image/png" src="Figure4-11.png"/>
</figure>
<para id="para15">
<equation id="eq10">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>21</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:abs/>
<m:apply>
<m:minus/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>2</m:mn>
</m:msub></m:ci>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub></m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:root/>
<m:apply>
<m:times/>
<m:cn>2</m:cn>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
<equation id="eq11">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>12</m:mn>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>23</m:mn>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>34</m:mn>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>14</m:mn>
</m:msub>
</m:ci>
</m:apply>
</m:math>
</equation>
<equation id="eq12">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>13</m:mn>
</m:msub>
</m:ci>
<m:apply>
<m:abs/>
<m:apply>
<m:minus/>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>1</m:mn>
</m:msub></m:ci>
<m:ci type="vector"><m:msub>
<m:mi>s</m:mi>
<m:mn>3</m:mn>
</m:msub></m:ci>
</m:apply>
</m:apply>
<m:apply>
<m:times/>
<m:cn>2</m:cn>
<m:apply>
<m:root/>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</equation>
<equation id="eq13">
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>13</m:mn>
</m:msub>
</m:ci>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mn>24</m:mn>
</m:msub>
</m:ci>
</m:apply>
</m:math>
</equation>
Minimum distance
<m:math>
<m:apply>
<m:eq/>
<m:ci>
<m:msub>
<m:mi>d</m:mi>
<m:mi>min</m:mi>
</m:msub>
</m:ci>
<m:apply>
<m:root/>
<m:apply>
<m:times/>
<m:cn>2</m:cn>
<m:ci>
<m:msub>
<m:mi>E</m:mi>
<m:mi>s</m:mi>
</m:msub>
</m:ci>
</m:apply>
</m:apply>
</m:apply>
</m:math>
</para>
</example>
</content>
</document>
xpointer(string-range(id("para1"),"representation",1,9))
xpointer(id("para4"))
xmlns(def=http://cnx.rice.edu/cnxml)
xpointer(/child::def:document/child::def:metadata)
xmlns(m=http://www.w3.org/1998/Math/MathML) xpointer(id("para3")/m:math[2])
xmlns(def=http://cnx.rice.edu/cnxml) xmlns(bib=http://bibtexml.sf.net/)
xmlns(m=http://www.w3.org/1998/Math/MathML)
xmlns(md=http://cnx.rice.edu/mdml/0.4)
xpointer(string-range(id("para1"),"Geometric",1,6))
xmlns(def=http://cnx.rice.edu/cnxml) xmlns(bib=http://bibtexml.sf.net/)
xmlns(m=http://www.w3.org/1998/Math/MathML)
xmlns(md=http://cnx.rice.edu/mdml/0.4) xpointer(/def:document//def:para)
xmlns(m=http://www.w3.org/1998/Math/MathML) xpointer(id("para7")//m:math)
xmlns(m=http://www.w3.org/1998/Math/MathML)
xmlns(cnx=http://cnx.rice.edu/cnxml) xpointer(id('para7')/cnx:equation)
xmlns(m=http://www.w3.org/1998/Math/MathML)
xmlns(cnx=http://cnx.rice.edu/cnxml)xpointer(/descendant::m:math[position()=2]/ancestor::*[position()=1])
xmlns(m=http://www.w3.org/1998/Math/MathML)
xpointer(start-point(string-range(id('para2'),'Orthonormal')))
xmlns(m=http://www.w3.org/1998/Math/MathML)
xpointer(end-point(string-range(id('para2'),'Orthonormal')))
xpointer(end-point(string-range(id("para2"),"essential"))))
import libxml2
def Eval(ctx,xp):
for p in xp:
if p:
print "Searching for ",p
nodes = ctx.xpointerEval(p)
print "Found:\n",nodes,"\n"
if p.find("range") >=0:
if p.find("-point")>=0:
for tup in nodes:
print "'" + tup[0].get_content().replace(' ','X') + "'" + "\n"
else:
for result in nodes:
for tup in result:
print "'" + tup[0].get_content().replace(' ','X') + "'" + "\n"
def loadXML(XMLFile,QueryFile):
doc=libxml2.parseFile(XMLFile)
root=doc.getRootElement()
ctx=root.xpointerNewContext(doc,None)
doc.validateDocument(ctx)
xp = []
file = open(QueryFile,"r")
line = file.readline()
while line:
#print line
xp.append(line[:-1])
line = file.readline()
file.close()
return ctx,xp
#Testing:
print "Running tests to check the string-range case for xpointerEval().\nSpaces in the returned nodes are replaced by X's to see the exact number of characters.\n"
print "Loading xpointer queries from file 'tstXpointers' on xml 'm10035.cnxml'\n"
ctx,xp = loadXML('m10035.cnxml',"tstXpointers")
Eval(ctx,xp)
print "Loading xpointer queries from file 'strpoint' on xml 'str'\n"
ctx,xp = loadXML('../../test/XPath/docs/str','../../test/XPath/xptr/strpoint')
Eval(ctx,xp)
print "Loading xpointer queries from file 'strrange' on xml 'str'\n"
ctx,xp = loadXML('../../test/XPath/docs/str','../../test/XPath/xptr/strrange')
Eval(ctx,xp)
print "Loading xpointer queries from file 'strrange2' on xml 'str'\n"
ctx,xp = loadXML('../../test/XPath/docs/str','../../test/XPath/xptr/strrange2')
Eval(ctx,xp)
print "Loading xpointer queries from file 'strrange3' on xml 'str'\n"
ctx,xp = loadXML('../../test/XPath/docs/str','../../test/XPath/xptr/strrange3')
Eval(ctx,xp)
#Below tests don't work, since the xpointers use id(), and the document has no DTD to validate against
#print "Loading xpointer queries from file 'vidbase' on xml 'chapters'\n"
#ctx,xp = loadXML('../test/XPath/docs/chapters','../test/XPath/xptr/vidbase')
#ctx,xp = loadXML('../test/XPath/docs/chapters','vidbase2')
#node = ctx.xpointerEval('xpointer(/1)')
#print node[0]
#Eval(ctx,xp)
#print "Loading xpointer queries from file 'chaptersrange' on xml 'chapters'\n"
#ctx,xp = loadXML('../test/XPath/docs/chapters','../test/XPath/xptr/chaptersrange')
#Eval(ctx,xp)
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml