diff options
Diffstat (limited to 'test/XPath')
35 files changed, 465 insertions, 0 deletions
diff --git a/test/XPath/docs/chapters b/test/XPath/docs/chapters new file mode 100644 index 0000000..c48f65e --- /dev/null +++ b/test/XPath/docs/chapters @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<EXAMPLE prop1="gnome is great" prop2="& linux too"> + <head> + <title>Welcome to Gnome</title> + </head> + <chapter id="chapter1"> + <title>The Linux adventure</title> + <p>bla bla bla ...</p> + <image href="linus.gif"/> + <p>...</p> + </chapter> + <chapter id="chapter2"> + <title>Chapter 2</title> + <p>this is chapter 2 ...</p> + </chapter> + <chapter id="chapter3"> + <title>Chapter 3</title> + <p>this is chapter 3 ...</p> + </chapter> + <chapter id="chapter4"> + <title>Chapter 4</title> + <p>this is chapter 4 ...</p> + </chapter> + <chapter id="chapter5"> + <title>Chapter 5</title> + <p>this is chapter 5 ...</p> + </chapter> +</EXAMPLE> diff --git a/test/XPath/docs/id b/test/XPath/docs/id new file mode 100644 index 0000000..4b6659f --- /dev/null +++ b/test/XPath/docs/id @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<EXAMPLE id="root" prop1="gnome is great" prop2="& linux too"> + <head id="head"> + <title>Welcome to Gnome</title> + </head> + <chapter id="chapter1"> + <title>The Linux adventure</title> + <p>bla bla bla ...</p> + <image href="linus.gif"/> + <p>...</p> + </chapter> + <chapter id="chapter2"> + <title>Chapter 2</title> + <p>this is chapter 2 ...</p> + </chapter> + <chapter id="chapter3"> + <title>Chapter 3</title> + <p>this is chapter 3 ...</p> + </chapter> + <chapter id="chapter4"> + <title>Chapter 4</title> + <p>this is chapter 4 ...</p> + </chapter> + <chapter id="chapter5"> + <title>Chapter 5</title> + <p>this is chapter 5 ...</p> + </chapter> +</EXAMPLE> diff --git a/test/XPath/docs/lang b/test/XPath/docs/lang new file mode 100644 index 0000000..abfe1d6 --- /dev/null +++ b/test/XPath/docs/lang @@ -0,0 +1,13 @@ +<doc> + <x>1</x> + <b xml:lang="en"> + <x>en</x> + <x>3</x> + </b> + <x>4</x> + <para xml:lang="en"/> + <div xml:lang="en"><para/></div> + <para xml:lang="EN"/> + <para xml:lang="en-us"/> + <para xml:lang="EN-US"/> +</doc> diff --git a/test/XPath/docs/mixed b/test/XPath/docs/mixed new file mode 100644 index 0000000..3b457bc --- /dev/null +++ b/test/XPath/docs/mixed @@ -0,0 +1,10 @@ +<?xml version="1.0"?> +<root> + <s p="root"/> + <p1> + <s p="p1"/> + </p1> + <p2> + <s p="p2"/> + </p2> +</root> diff --git a/test/XPath/docs/nodes b/test/XPath/docs/nodes new file mode 100644 index 0000000..a863df0 --- /dev/null +++ b/test/XPath/docs/nodes @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +<root><foo>txt<!--hello--><![CDATA[data]]><?target data?><bar>txt<!--hello--><![CDATA[data]]><?target data?></bar></foo></root>
\ No newline at end of file diff --git a/test/XPath/docs/simple b/test/XPath/docs/simple new file mode 100644 index 0000000..ca665a2 --- /dev/null +++ b/test/XPath/docs/simple @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<EXAMPLE prop1="gnome is great" prop2="& linux too"> + <head> + <title>Welcome to Gnome</title> + </head> + <chapter> + <title>The Linux adventure</title> + <p>bla bla bla ...</p> + <image href="linus.gif"/> + <p>...</p> + </chapter> +</EXAMPLE> diff --git a/test/XPath/docs/str b/test/XPath/docs/str new file mode 100644 index 0000000..547e54d --- /dev/null +++ b/test/XPath/docs/str @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<chapter> + <p>a simple test</p> + <p>multiple tests</p> + <p>a diff<em>i</em>cult one</p> + <p><p>a span</p>n<p>ing one</p></p> + <p><p>and an unbal</p><empty/>anced test</p> + <p>for empty string <seq>123</seq></p> +</chapter> diff --git a/test/XPath/docs/usr1 b/test/XPath/docs/usr1 new file mode 100644 index 0000000..44c7529 --- /dev/null +++ b/test/XPath/docs/usr1 @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<BODY> +<DECLARACION importador="123456789" fecha="08/09/2000" +monto_factura="100.09"> +<ITEM monto="50.12" divisa="DOL"> +<SUFIJO codigo="NL34" valor="negro"/> +<SUFIJO codigo="AS34" valor="grande"/> +</ITEM> +</DECLARACION> +<FIRMA>N</FIRMA> +</BODY> + diff --git a/test/XPath/docs/vid b/test/XPath/docs/vid new file mode 100644 index 0000000..cdb7437 --- /dev/null +++ b/test/XPath/docs/vid @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!DOCTYPE iddemo [ +<!ELEMENT iddemo (head?, (chapter)*)> +<!ATTLIST iddemo id ID #IMPLIED> +<!ELEMENT head (title?, (p)*)> +<!ATTLIST head id ID #IMPLIED> +<!ELEMENT chapter (title?, (p | image)*)> +<!ATTLIST chapter id ID #IMPLIED> +<!ELEMENT image EMPTY> +<!ATTLIST image href CDATA #IMPLIED> +<!ELEMENT title (#PCDATA)> +<!ELEMENT p (#PCDATA)> +]> + +<iddemo> + <head> + <title>Welcome to Gnome</title> + </head> + <chapter id="chapter1"> + <title>The Linux adventure</title> + <p>bla bla bla ...</p> + <image href="linus.gif"/> + <p>...</p> + <p>third p</p> + <p>fourth p</p> + </chapter> + <chapter id="chapter2"> + <title>Chapter 2</title> + <p>this is chapter 2 ...</p> + </chapter> + <chapter id="chapter3"> + <title>Chapter 3</title> + <p>this is chapter 3 ...</p> + </chapter> + <chapter id="chapter4"> + <title>Chapter 4</title> + <p>this is chapter 4 ...</p> + </chapter> + <chapter id="chapter5"> + <title>Chapter 5</title> + <p>this is chapter 5 ...</p> + </chapter> +</iddemo> diff --git a/test/XPath/expr/base b/test/XPath/expr/base new file mode 100644 index 0000000..9aaed4f --- /dev/null +++ b/test/XPath/expr/base @@ -0,0 +1,5 @@ +1 +1+2 +2*3 +1+2*3+4 +(1+2)*(3+4) diff --git a/test/XPath/expr/compare b/test/XPath/expr/compare new file mode 100644 index 0000000..2d52eaf --- /dev/null +++ b/test/XPath/expr/compare @@ -0,0 +1,46 @@ +0<0 +0<=0 +0>0 +0>=0 +0<1 +0<=1 +0>1 +0>=1 +1<0 +1<=0 +1>0 +1>=0 +1<1 +1<=1 +1>1 +1>=1 +'0'<1 +'0'<=1 +'0'>1 +'0'>=1 +0<'1.2' +0<='1.2' +0>'1.2' +0>='1.2' +0<'-0.2' +0<='-0.2' +0>'-0.2' +0>='-0.2' +false()<1 +false()<=1 +0>true() +0>=true() +'a' > 'a' +'a' > 'b' +'b' > 'a' +'a' < 'a' +'a' < 'b' +'b' < 'a' +'a' >= 'a' +'a' >= 'b' +'b' >= 'a' +'a' <= 'a' +'a' <= 'b' +'b' <= 'a' +'a' > '0.0' +'a' < '0.0' diff --git a/test/XPath/expr/equality b/test/XPath/expr/equality new file mode 100644 index 0000000..7982173 --- /dev/null +++ b/test/XPath/expr/equality @@ -0,0 +1,26 @@ +1=1 +1!=1 +1=0 +1!=0 +true()=true() +true()!=true() +true()=false() +false()!=true() +'test'='test' +'test'!='test' +'test2'='test' +'test2'!='test' +false()=0 +false()!=0 +false()=1 +false()!=1 +0=true() +0!=true() +1=true() +1!=true() +true()='test' +false()='test' +'test'!=true() +'test'!=false() +'a'=0.0 +'a'!=0.0 diff --git a/test/XPath/expr/floats b/test/XPath/expr/floats new file mode 100644 index 0000000..96c10d1 --- /dev/null +++ b/test/XPath/expr/floats @@ -0,0 +1,61 @@ +1 +123 +1.23 +0.123 +4. +.4 +1.23e3 +1.23e-3 +1 div 0 +-1 div 0 +0 div 0 +1 div -0 +(1 div 0) > 0 +(1 div 0) < 0 +(-1 div 0) > 0 +(-1 div 0) < 0 +(0 div 0) > 0 +(0 div 0) < 0 +(1 div -0) > 0 +(1 div -0) < 0 +0 div 0 = 0 div 0 +0 div 0 != 0 div 0 +0 div 0 > 0 div 0 +0 div 0 < 0 div 0 +0 div 0 >= 0 div 0 +0 div 0 <= 0 div 0 +1 div 0 = -1 div 0 +1 div 0 != -1 div 0 +1 div 0 > -1 div 0 +1 div 0 < -1 div 0 +1 div 0 >= -1 div 0 +1 div 0 <= -1 div 0 +1 div 0 = 1 div 0 +1 div 0 != 1 div 0 +1 div 0 > 1 div 0 +1 div 0 < 1 div 0 +1 div 0 >= -1 div 0 +1 div 0 <= -1 div 0 +-2 div 0 = -1 div 0 +1 div floor(0.1) +1 div floor(-0.1) +1 div floor(-0) +1 div floor(0) +1 div ceiling(0.1) +1 div ceiling(-0.1) +1 div ceiling(-0) +1 div ceiling(0) +1 div round(0.1) +1 div round(-0.1) +1 div round(-0) +1 div round(0) +1 div number('f') +number('f') div 1 +1 div (1 div 0) +(1 div 0) div 1 +-(1 div 0) div 1 +5 mod 2 +5 mod -2 +-5 mod 2 +-5 mod -2 +8 mod 3 = 2 diff --git a/test/XPath/expr/functions b/test/XPath/expr/functions new file mode 100644 index 0000000..d168b18 --- /dev/null +++ b/test/XPath/expr/functions @@ -0,0 +1,25 @@ +true() +false() +number("1.5") +number('abc') +-number('abc') +floor(0.1) +floor(-0.1) +floor(-0) +floor(0) +floor(5.2) +floor(-5.2) +ceiling(0.1) +ceiling(-0.1) +ceiling(-0) +ceiling(0) +ceiling(5.2) +ceiling(-5.2) +round(0.1) +round(5.2) +round(5.5) +round(5.6) +round(-0.1) +round(-5.2) +round(-5.5) +round(-5.6) diff --git a/test/XPath/expr/strings b/test/XPath/expr/strings new file mode 100644 index 0000000..849ca14 --- /dev/null +++ b/test/XPath/expr/strings @@ -0,0 +1,34 @@ +string(5) +string(0.5) +string(-0.5) +string(true()) +string(false()) +concat("titi","toto") +concat("titi","toto","tata") +concat("titi",'toto') +concat("titi",'toto',"tata","last") +starts-with("tititoto","titi") +starts-with("tititoto","to") +contains("tititototata","titi") +contains("tititototata","toto") +contains("tititototata","tata") +contains("tititototata","tita") +substring("12345",2,3) +substring("12345",2) +substring("12345",-4) +substring("12345",3.4) +substring("12345",3.6) +substring("12345",1.5,2.6) +substring("12345",2.2,2.2) +substring("12345",0,3) +substring("12345",-8,10) +substring("12345",4,-10) +substring("12345",0 div 0, 3) +substring("12345",1, 0 div 0) +substring("12345",1 div 0, 3) +substring("12345",3,-1 div 0) +substring("12345",-42, 1 div 0) +substring("12345",-1 div 0, 1 div 0) +substring("12345",-1 div 0,5) +string-length("") +string-length("titi") diff --git a/test/XPath/tests/chaptersbase b/test/XPath/tests/chaptersbase new file mode 100644 index 0000000..daa53b7 --- /dev/null +++ b/test/XPath/tests/chaptersbase @@ -0,0 +1,9 @@ +/child::EXAMPLE +/child::* +/child::EXAMPLE/child::head +/child::EXAMPLE/child::* +/child::EXAMPLE/child::head/child::title +/child::EXAMPLE/child::head/child::title/child::text() +/child::EXAMPLE/child::head/node() +/descendant::title +/descendant::p/ancestor::chapter diff --git a/test/XPath/tests/chaptersprefol b/test/XPath/tests/chaptersprefol new file mode 100644 index 0000000..8f1e65b --- /dev/null +++ b/test/XPath/tests/chaptersprefol @@ -0,0 +1,8 @@ +/following::* +/preceding::* +/child::EXAMPLE/preceding::* +/child::EXAMPLE/following::* +/child::EXAMPLE/child::chapter[3]/preceding::* +/child::EXAMPLE/child::chapter[3]/following::* +/child::EXAMPLE/child::chapter[1]/image/preceding::* +/child::EXAMPLE/child::chapter[1]/image/following::* diff --git a/test/XPath/tests/idsimple b/test/XPath/tests/idsimple new file mode 100644 index 0000000..2841ae9 --- /dev/null +++ b/test/XPath/tests/idsimple @@ -0,0 +1,3 @@ +//*[@id="root"] +//*[@id="chapter2"] +//*[@id="chapter5"] diff --git a/test/XPath/tests/langsimple b/test/XPath/tests/langsimple new file mode 100644 index 0000000..f71a321 --- /dev/null +++ b/test/XPath/tests/langsimple @@ -0,0 +1,5 @@ +//*[lang('en')] +//*[lang('en-us')] +//*[lang('en-gb')] +//*[lang('fr')] +//*[lang('')] diff --git a/test/XPath/tests/mixedpat b/test/XPath/tests/mixedpat new file mode 100644 index 0000000..c212f6c --- /dev/null +++ b/test/XPath/tests/mixedpat @@ -0,0 +1,7 @@ +s +s|p1/s +s|/root/p1/s +/root/p1/s|s +//s +//s|p1 +p1|//s diff --git a/test/XPath/tests/nodespat b/test/XPath/tests/nodespat new file mode 100644 index 0000000..c157a3e --- /dev/null +++ b/test/XPath/tests/nodespat @@ -0,0 +1,5 @@ +/. +//. +/root//. +//.//./././/. +/root//././/bar//.
\ No newline at end of file diff --git a/test/XPath/tests/simpleabbr b/test/XPath/tests/simpleabbr new file mode 100644 index 0000000..8de476f --- /dev/null +++ b/test/XPath/tests/simpleabbr @@ -0,0 +1,10 @@ +/EXAMPLE +/EXAMPLE/head +/EXAMPLE/chapter[1] +//p +//chapter/image +//p/text() +//p/text()[position()=1] +//p/text()[position()=last()] +(//p/text())[position()=1] +(//p/text())[position()=last()] diff --git a/test/XPath/tests/simplebase b/test/XPath/tests/simplebase new file mode 100644 index 0000000..7e4203a --- /dev/null +++ b/test/XPath/tests/simplebase @@ -0,0 +1,9 @@ +/child::* +/child::EXAMPLE +/child::EXAMPLE/child::head +/child::EXAMPLE/child::* +/child::EXAMPLE/child::head/child::title +/child::EXAMPLE/child::head/child::title/child::text() +/child::EXAMPLE/child::head/node() +/descendant::title +/descendant::p/ancestor::chapter diff --git a/test/XPath/tests/usr1check b/test/XPath/tests/usr1check new file mode 100644 index 0000000..c38d003 --- /dev/null +++ b/test/XPath/tests/usr1check @@ -0,0 +1 @@ +//ITEM[1] diff --git a/test/XPath/tests/vidbase b/test/XPath/tests/vidbase new file mode 100644 index 0000000..5cd79ac --- /dev/null +++ b/test/XPath/tests/vidbase @@ -0,0 +1,5 @@ +id('chapter1') +id('chapter3') +id('chapter1')/p +id('chapter1')//p +id('chapter1')/p[1] diff --git a/test/XPath/xptr/chapterschildseq b/test/XPath/xptr/chapterschildseq new file mode 100644 index 0000000..3b52f5f --- /dev/null +++ b/test/XPath/xptr/chapterschildseq @@ -0,0 +1,8 @@ +/1/2/3 +element(/1/2/3) +element(foo)element(/1/2/3) +element(/1/2/3)element(foo) +chapter1/3 +element(chapter1/3) +element(foo)element(chapter1/3) +element(chapter1/3)element(foo) diff --git a/test/XPath/xptr/chaptersparts b/test/XPath/xptr/chaptersparts new file mode 100644 index 0000000..aadc47c --- /dev/null +++ b/test/XPath/xptr/chaptersparts @@ -0,0 +1,6 @@ +xpointer(//chapitre[2]) +xpointer(//chapter[2]) +xpointer(//chapitre[2])xpointer(//chapter[2]) +xpointer(id("chapter1")) +xpointer(//*[@id="chapter1"]) +xpointer(id("chapter1"))xpointer(//*[@id="chapter1"]) diff --git a/test/XPath/xptr/chaptersrange b/test/XPath/xptr/chaptersrange new file mode 100644 index 0000000..4d7a55b --- /dev/null +++ b/test/XPath/xptr/chaptersrange @@ -0,0 +1,4 @@ +xpointer(//chapter[position() = 2]/range-to(following::chapter[1])) +xpointer(//chapter[position() <= 2]/range-to(following::chapter[1])) +xpointer(//chapter[position() = last()]/range-to(following::chapter[1])) +xpointer(//chapter[position() = 3]/range-to(/.//chapter[position() = 1])) diff --git a/test/XPath/xptr/strpoint b/test/XPath/xptr/strpoint new file mode 100644 index 0000000..0916ef1 --- /dev/null +++ b/test/XPath/xptr/strpoint @@ -0,0 +1,9 @@ +xpointer(start-point(string-range(//p,'multiple'))) +xpointer(end-point(string-range(//p,'multiple'))) +xpointer(start-point(string-range(//p,'test'))) +xpointer(end-point(string-range(//p,'test'))) +xpointer(start-point(string-range(//*,'multiple',1,0))) +xpointer(end-point(string-range(//*,'multiple',1,0))) +xpointer(start-point(string-range(//*,'multiple',1,1))) +xpointer(end-point(string-range(//*,'multiple',1,1))) +xpointer(start-point(string-range(//p,'test'))[1]) diff --git a/test/XPath/xptr/strrange b/test/XPath/xptr/strrange new file mode 100644 index 0000000..3231927 --- /dev/null +++ b/test/XPath/xptr/strrange @@ -0,0 +1,6 @@ +xpointer(string-range(//p, 'simple')) +xpointer(string-range(//p, 'test')) +xpointer(string-range(//p, 'difficult')) +xpointer(string-range(//p, 'spanning')) +xpointer(string-range(//p, 'unbalanced')) +xpointer(string-range(//seq, '')) diff --git a/test/XPath/xptr/strrange2 b/test/XPath/xptr/strrange2 new file mode 100644 index 0000000..5133547 --- /dev/null +++ b/test/XPath/xptr/strrange2 @@ -0,0 +1,3 @@ +xpointer(string-range(//p, 'test', 2)) +xpointer(string-range(//p, 'test', 2, 2)) +xpointer(string-range(//p, 'difficult', 1, 0)) diff --git a/test/XPath/xptr/strrange3 b/test/XPath/xptr/strrange3 new file mode 100644 index 0000000..aea5665 --- /dev/null +++ b/test/XPath/xptr/strrange3 @@ -0,0 +1,4 @@ +xpointer(string-range(//p, 'test', 1, 0)) +xpointer(string-range(//*, 'test', 1, 0)) +xpointer(string-range(//p, 'test', 1, 0)[2]) +xpointer(string-range(//*, 'test', 1, 0)[2]) diff --git a/test/XPath/xptr/vidbase b/test/XPath/xptr/vidbase new file mode 100644 index 0000000..b146383 --- /dev/null +++ b/test/XPath/xptr/vidbase @@ -0,0 +1,2 @@ +xpointer(id('chapter1')/p) +xpointer(id('chapter1')/p[1]/range-to(following-sibling::p[2])) diff --git a/test/XPath/xptr/vidchildseq b/test/XPath/xptr/vidchildseq new file mode 100644 index 0000000..fe205dc --- /dev/null +++ b/test/XPath/xptr/vidchildseq @@ -0,0 +1,4 @@ +/1/2/3 +element(/1/2/3) +chapter1/3 +element(chapter1/3) diff --git a/test/XPath/xptr/vidparts b/test/XPath/xptr/vidparts new file mode 100644 index 0000000..3afbbdd --- /dev/null +++ b/test/XPath/xptr/vidparts @@ -0,0 +1,3 @@ +xpointer(id("chapter1")) +xpointer(//*[@id="chapter1"]) +xpointer(id("chapter1"))xpointer(//*[@id="chapter1"]) |