hi all;
this is the solution to my problem, thanks to the help of the xforms
groupe:
the problem was that i used the static instance document from
the xforms document.
I have to use the in-memory version that XForms maintains.
We can get this version by using this:
model.getInstanceDocument(id).
The new code :
<?xml version="1.0" encoding="UTF-8"?>
<xhtml:html xmlns="http://xforms.websynapsis.com"
xmlns:books="http://books.websynapsis.com"
xmlns

html="http://www.w3.org/1999/xhtml"
xmlns

forms="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns

sd="http://www.w3.org/2001/XMLSchema"
xmlns

si="http://www.w3.org/2001/XMLSchema-instance"
xmlns

s="http://www.w3.org/2001/XMLSchema">
<xhtml:head>
<xhtml:title>
Test case for primitive XML Schema types
</xhtml:title>
<xhtml:link rel="stylesheet" href="style.css" type="text/css"/>
<xforms:model id="myModel">
<xforms:instance id="myInstance" xmlns="">
<data>
<valid>
<string1 id="f1">Name</string1>
</valid>
</data>
</xforms:instance>
<xforms:bind nodeset="/data/valid/string1" type="xsd:string" />
</xforms:model>
<xhtml:script id="gtre" type="text/javascript">
function affiche()
{
var model = document.getElementById("myModel");
var instanceDoc = model.getInstanceDocument("myInstance");
if (typeof instanceDoc.evaluate != 'undefined') {
var element = instanceDoc.evaluate('//data/valid/string1',
instanceDoc, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
null).singleNodeValue;
if (element != null) {
alert(element.textContent);
}
else {
alert('No element found.');
}
}
}
</xhtml:script>
</xhtml:head>
<xhtml:body>
<xforms:group/>
<xforms:input ref="/data/valid/string1">
<xforms:label lang="en">Name :</xforms:label>
<xforms:action ev:event="xforms-valid">
</xforms:action>
</xforms:input>
<xforms:group/>
<xforms

utput ref="/data/valid/string1" id="label1">
<xforms:label id="label11">Name : </xforms:label>
</xforms

utput>
<xforms:group/>
<xhtml:input type="button" value="test" onclick="affiche();"/>
</xhtml:body>
</xhtml:html>
That's all