<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hallo Samuel,<br>
So I better count with something like this:<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><big><big><big>wpt_pos=grep(XmlDump,'<wpt');
wpt_n=length(wpt_pos);
<big><big>
</big></big>Thanks again, Jens
--------------------------------------------------
</big></big></big></pre>
<div class="moz-cite-prefix">Am 06.06.2017 22:25, schrieb Samuel
Gougeon:<br>
</div>
<blockquote cite="mid:f2282de9-ccce-4936-ab79-bfdff8860edf@free.fr"
type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Hello Jens,<br>
<br>
Le 05/06/2017 à 02:12, Jens Simon Strom a écrit :<br>
</div>
<blockquote cite="mid:5934A1E5.4030107@hslmg.de" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><big><big>Hi,
Ex. 0 and 2 are o.k.. But what I want is Ex. 1. What is wrong there?
//Ex. 0
doc = xmlRead(<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/2009/REC-xml-names-20091208/xml-names-10-3e.xml">"http://www.w3.org/TR/2009/REC-xml-names-20091208/xml-names-10-3e.xml"</a>);
<span style="font-style: italic;">// Count the nodes with name equal to </span><span style="font-style: italic;">"</span><span style="font-style: italic;">note</span><span style="font-style: italic;">"</span>
xp0 = xmlXPath(doc, "count(//note)")
xmlDelete(doc)
//Ex. 1
t=['<?xml version=""1.0"" encoding=""UTF-8"" standalone=""no""?>'+..
'<gpx xmlns:xsi="<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>" xmlns="<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://www.topografix.com/GPX/1/1">"http://www.topografix.com/GPX/1/1"</a>" creator=""WTracks"" version=""1.1"" xsi:schemaLocation="<a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd">"http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"</a>">'+..
'<wpt lat=""52.0"" lon=""8.0"">'+..
'<sym>City (Small)</sym>'+..
'</wpt>'+..
'</gpx>']
doc = xmlReadStr(t);
xmlDump(doc)
xp1 = xmlXPath(doc, "count(//wpt)")
xmlDelete(doc)</big></big></pre>
</blockquote>
<br>
Apparently, the xmlns attribute (alone) is not supported out of
the <?xml ?> initial header.<br>
When we remove it, tags are counted as expected:<br>
<br>
<font size="-1"><tt>t=['<?xml version=""1.0""
encoding=""UTF-8"" standalone=""no""?>'+..<br>
'<gpx xmlns:xsi="<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>"
creator=""WTracks"" version=""1.1"" '+..<br>
' xsi:schemaLocation="<a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="http://www.topografix.com/GPX/1/1http://www.topografix.com/GPX/1/1/gpx.xsd">"http://www.topografix.com/GPX/1/1
http://www.topografix.com/GPX/1/1/gpx.xsd"</a>">'+.. <br>
'<wpt lat=""52.0"" lon=""8.0"">'+..<br>
'<sym>City (Small)</sym>'+.. <br>
'</wpt>'+.. '</gpx>'];<br>
doc = xmlReadStr(t);<br>
xp1 = xmlXPath(doc, "count(//wpt)")<br>
xmlDelete(doc);</tt></font><br>
<tt> </tt><br>
<tt>--> xp1 = xmlXPath(doc, "count(//wpt)")</tt><tt><br>
</tt><tt> xp1 = </tt><tt><br>
</tt><tt> 1.</tt><tt><br>
</tt><br>
Since this attribute looks to be legal here (<a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://www.w3schools.com/xml/xml_namespaces.asp">https://www.w3schools.com/xml/xml_namespaces.asp</a>),
the wrong result is likely a bug: <br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab">http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab</a>
software&component=XML<br>
<br>
Best regards<br>
Samuel Gougeon<br>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>