How does Digest function work on an XML instance (MD5)

classic Classic list List threaded Threaded
3 messages Options
SD
Reply | Threaded
Open this post in threaded view
|

How does Digest function work on an XML instance (MD5)

SD
Hi,

I'm trying to understand as to how orbeon processes the digest function.
I have the following XML instance

<xforms:instance id="test">
	<root>
		<var1 id=""/>
		<var2 id=""/>
	</root>
</xforms:instance>

and the digest function as follows
<xforms:output value="digest(instance('test'),'MD5','hex')"/>

When I change var1 or var2 the digest updates. But on change of id (attribute of var1 and var2) the digest doesn't update

Why does orbeon ignore changes in attribure(s).

Please find sample code here

Regards,
--SD
Reply | Threaded
Open this post in threaded view
|

Re: How does Digest function work on an XML instance (MD5)

Erik Bruchez
Administrator
The digest() function is meant to work on a string. [1]

When you pass an element to the function, XPath converts the argument
to a string, by taking the string value of the node. The string value
only looks at text nodes, so changing the attributes doesn't change
the value that is digested.

What you probably want to do is first serialize the instance to text.
Something like:

<xforms:output value="digest(xxforms:serialize(instance('test'),
'xml'),'MD5','hex')"/>

-Erik

[1] http://www.w3.org/TR/xforms/#fn-digest

On Wed, May 2, 2012 at 1:09 PM, SD <[hidden email]> wrote:

> Hi,
>
> I'm trying to understand as to how orbeon processes the digest function.
> I have the following XML instance
>
>
>
> and the digest function as follows
>
> When I change var1 or var2 the digest updates. But on change of id
> (attribute of var1 and var2) the digest doesn't update
>
> Why does orbeon ignore changes in attribure(s).
>
> Please find sample code
> http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n4604326/test.xhtml
> here
>
> Regards,
> --SD
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/How-does-Digest-function-work-on-an-XML-instance-MD5-tp4604326.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
SD
Reply | Threaded
Open this post in threaded view
|

Re: How does Digest function work on an XML instance (MD5)

SD
Hi Erik,

Thanks for the input. It works like a charm.

Regards
--SD