RE: Question: Base64 Transform Nodeset Input

Hi Christian,

Yes, I know that the <comment> Element is not an XML Element 

<jb>Actually, <comment> is an element, which is why its text descendant
gets added to the string result.</jb>

The problem resulted in my understanding of what is an XPath 
node set and how I convert an input stream to a node set which is valid 
input for the transforms. Given a Document like:

<?xml version="1.0"?>
<!-- Comment 1 -->
<doc>Hello, world!<!-- Comment 2 --></doc>

Q: Does the xpath node set contain 2 nodes (the comment 1 and the <doc> 
element) or does it contain 4 nodes (both comments, the <doc> element
the text node?

<jb>An XPath node-set is capable of containing every node of the
document.  A node-set could contain just the two nodes or it could
contain all four nodes (both comments, <doc>, the text node).  In either
case, it also contains a special 'root' node as parent to <doc>.  The
root node is not an element, but it is needed to provide a single point
of entry to the parse tree.  The root node in your example above has two
children:  <doc> and Comment 1.

If you want c14n to write the whole document in your example above, then
the node-set has to include all of the nodes.  If you only included
<doc> and the 'Comment 1' node, then the c14n output would be:

<?xml version="1.0"?>
<!-- Comment 1 -->

John Boyer
Senior Product Architect, Software Development
Internet Commerce System (ICS) Team
PureEdge Solutions Inc. 
Trusted Digital Relationships
v: 250-708-8047  f: 250-708-8010
1-888-517-2675 <>  	


> The inserted <comment> element (which is not an XML comment, but
> an XML element like any other) would cause a problem for base-64
> decoding.  The behavior to mimic is XPath string(), which
> all descendant text nodes.
> -----Original Message-----
> From: Christian Geuer-Pollmann
> []
> Sent: Tuesday, July 31, 2001 5:55 AM
> To:
> Subject: Question: Base64 Transform Nodeset Input
> What does section "6.6.2 Base64" mean whan it states:
> "If an XPath node-set (or sufficiently functional alternative) is
> as
> input, then it is converted to an octet stream by performing
> logically equivalent to 1) applying an XPath transform with expression
> self::text(), then 2) taking the string-value of the node-set."
> Is the following fragment valid input which decodes to "The URI of the
> transform is"
> <BASE64>
> VGhlIFVSSSBvZiB0aGUgdHJhbn<comment>Inserting this comment should not
> change
> anything for processing</comment>
> Nmb3JtIGlzIGh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1s
> </BASE64>

Received on Tuesday, 31 July 2001 14:16:48 UTC