[xmlsec] selecting strart node from command line

Aleksey Sanin aleksey@aleksey.com
Wed, 24 Sep 2003 14:07:55 -0700


This is a multi-part message in MIME format.
--------------020801000807050707030602
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

No, it would not! You have default namespace defined in the
first <EnvioDTE/> node. /EnvioDTE could not match
<EnvioDTE xmlns="something">! Please, please, please, read
XPath spec about nodes names. And as an illustration see
example bellow (not that the only difference between a.xml and
b.xml is the default namespace declaration

[aleksey@lsh a]$ diff -u a.xml b.xml
--- a.xml       2003-09-24 14:04:16.000000000 -0700
+++ b.xml       2003-09-24 14:04:08.000000000 -0700
@@ -3,7 +3,7 @@
 <!ATTLIST SetDTE ID ID #IMPLIED>
 <!ATTLIST Documento ID ID #IMPLIED>
 ]>
-<EnvioDTE xmlns="http://www.sii.cl/SiiDte"
+<EnvioDTE
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sii.cl/SiiDte EnvioDTE_v03.xsd" 
version="0.3">
   <SetDTE ID="SetDoc">
     <Caratula version="1.0">
[aleksey@lsh a]$ xmllint --shell a.xml
/ > xpath /EnvioDTE
Object is a Node Set :
Set contains 0 nodes:
/ >
[aleksey@lsh a]$ xmllint --shell b.xml
/ > xpath /EnvioDTE
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT EnvioDTE
    namespace xsi href=http://www.w3.org/2001/XMLSchema-instanc...
    ATTRIBUTE schemaLocation
      TEXT
        content=http://www.sii.cl/SiiDte EnvioDTE_v03.xs...
    ATTRIBUTE version
      TEXT
        content=0.3
/ >


Aleksey

>
> <EnvioDTE xmlns="http://www.sii.cl/SiiDte" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
> xsi:schemaLocation="http://www.sii.cl/SiiDte EnvioDTE_v03.xsd" 
> version="0.3">
>
>

--------------020801000807050707030602
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
<tt>No, it would not! You have default namespace defined in the <br>
first <font size="2">&lt;EnvioDTE/&gt; node.</font></tt><tt><font
 size="2"> /EnvioDTE could not match <br>
&lt;EnvioDTE xmlns="something"&gt;! Please, please, please, read</font></tt><br>
<tt><font size="2">XPath spec about nodes names. And as an illustration
see <br>
example bellow (not that the only</font></tt> <tt><font size="2">difference
between a.xml and <br>
b.xml is the default namespace declaration</font></tt><br>
<br>
<tt>[aleksey@lsh a]$ diff -u a.xml b.xml</tt><br>
<tt>--- a.xml&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2003-09-24 14:04:16.000000000 -0700</tt><br>
<tt>+++ b.xml&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2003-09-24 14:04:08.000000000 -0700</tt><br>
<tt>@@ -3,7 +3,7 @@</tt><br>
<tt>&nbsp;&lt;!ATTLIST SetDTE ID ID #IMPLIED&gt;</tt><br>
<tt>&nbsp;&lt;!ATTLIST Documento ID ID #IMPLIED&gt;</tt><br>
<tt>&nbsp;]&gt;</tt><br>
<tt>-&lt;EnvioDTE xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.sii.cl/SiiDte">"http://www.sii.cl/SiiDte"</a></tt><br>
<tt>+&lt;EnvioDTE</tt><br>
<tt>&nbsp;xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
</tt><br>
<tt>xsi:schemaLocation=<a class="moz-txt-link-rfc2396E" href="http://www.sii.cl/SiiDteEnvioDTE_v03.xsd">"http://www.sii.cl/SiiDte EnvioDTE_v03.xsd"</a>
version="0.3"&gt;</tt><br>
<tt>&nbsp;&nbsp; &lt;SetDTE ID="SetDoc"&gt;</tt><br>
<tt>&nbsp;&nbsp;&nbsp;&nbsp; &lt;Caratula version="1.0"&gt;</tt><br>
<tt><font size="2">[aleksey@lsh a]$ xmllint --shell a.xml</font></tt><br>
<tt><font size="2">/ &gt; xpath /EnvioDTE</font></tt><br>
<tt><font size="2">Object is a Node Set :</font></tt><br>
<tt><font size="2">Set contains 0 nodes:</font></tt><br>
<tt><font size="2">/ &gt;</font></tt><br>
<tt><font size="2">[aleksey@lsh a]$ xmllint --shell b.xml</font></tt><br>
<tt><font size="2">/ &gt; xpath /EnvioDTE</font></tt><br>
<tt><font size="2">Object is a Node Set :</font></tt><br>
<tt><font size="2">Set contains 1 nodes:</font></tt><br>
<tt><font size="2">1&nbsp; ELEMENT EnvioDTE</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp; namespace xsi
href=<a class="moz-txt-link-freetext" href="http://www.w3.org/2001/XMLSchema-instanc">http://www.w3.org/2001/XMLSchema-instanc</a>...</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp; ATTRIBUTE schemaLocation</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEXT</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content=<a class="moz-txt-link-freetext" href="http://www.sii.cl/SiiDte">http://www.sii.cl/SiiDte</a>
EnvioDTE_v03.xs...</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp; ATTRIBUTE version</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TEXT</font></tt><br>
<tt><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content=0.3</font></tt><br>
<tt><font size="2">/ &gt;</font></tt><br>
<br>
<br>
Aleksey<br>
<br>
<blockquote type="cite"
 cite="midNPENKJNAFAOGCAEDEPEAIECPDCAA.jan-olof.andersson@blcc.biz"><br>
  <tt><font size="2">&lt;EnvioDTE xmlns="<a
 href="http://www.sii.cl/SiiDte" target="_blank">http://www.sii.cl/SiiDte</a>"
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance"
 target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"
xsi:schemaLocation="<a href="http://www.sii.cl/SiiDte" target="_blank">http://www.sii.cl/SiiDte</a>
EnvioDTE_v03.xsd" version="0.3"&gt;</font></tt><br>
  <tt></tt>
  <p><font size="2"></font><font size="2"><br>
  </font></p>
</blockquote>
</body>
</html>

--------------020801000807050707030602--