Q: xmerl 0.15 xpath fails to match the following - why?

Reto Kramer kramer@REDACTED
Wed Oct 17 07:31:01 CEST 2001


I'm using xmerl 0.15 and tried out the xpath matcher with the example below.

Unfortunately the xpath does not match and returns an empty list. The same
happens with e.g. /document.

D: {xmlElement,document, ...
    ... the long form of the xml tree ...
X: []
ok

Does anyone have a test-set for xmerl xpath, so I can mimic the successful
use of it?

cheers,
- Reto

foo2() ->
    D = xmerl_scan:string(string()),
    io:format("D :~p~n",[D]),
    X = xmerl_xpath:string("/document/section/section/table/row", D),
    io:format("X :~p~n",[X]).


string() ->
     "<document title=\"Doc Title\"
          author=\"Ulf Wiger\">
<section heading=\"heading1\">
<P>
This is a paragraph of text.
</P>
<section heading=\"heading2\">
<P>
This is another paragraph.
</P>
<table border=\"1\">
<heading>
<col>
head1
</col>
<col>
head2
</col>
</heading>
<row>
<col>
col11
</col>
<col>
col12
</col>
</row>
<row>
<col>
col21
</col>
<col>
col22
</col>
</row>
</table>
</section>
</section>
</document>
".




More information about the erlang-questions mailing list