This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Mozilla XML > October 2005 > One model, many instances, is it correct?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author One model, many instances, is it correct?
feroadro@lacotisce.it

2005-10-18, 6:34 pm

Hello, heve a look at this piece of code:

<head>
<title>Greenhouse Catalog Data Entry</title>
<link rel="stylesheet" type="text/css" href="greendb.css"/>
<xf:model id="model1">
<xf:instance src="dbview.xml" id="dbview" ></xf:instance>
<xf:instance src="session.xml" id="session" ></xf:instance>
<xf:instance src="workarea.xml" id="wka" ></xf:instance>
<xf:bind nodeset="/wka/full_name"
calculate='concat(/dbview/genus_name,"aaa ",/dbview/species_name)'/>
<xf:bind id="msg" nodeset="/wka/message" />
<xf:submission id="squery" ref="instance('dbview')"
method="form-data-post" action="query.php"/>
<xf:submission id="sinsert" ref="instance('dbview')"
method="put" replace="none" includenamespaceprefixes="#default"
action="submit.xml"/>
</xf:model>
</head>

I read specs carefully, nowhere this is forbidden, will it be supported
?
For one instance all works fine, for many those beyond the first become
"mute"
but no error messages. Can I plan the code this way ? (Note the
"calculate" among nodes of different instances)

Using Xforms preview 2 etc...

thanks
Luciano

l0b0

2005-10-18, 6:34 pm

Works for me. However, other bugs can easily halt your progress for no
apparent reason. Check out the XForms bugs at
https://bugzilla.mozilla.org/query.cgi (Product "Core", Component
"XForms") for more info.

Some working sample code:

<!-- Slots instance and bindings -->
<xf:instance id="slotsFile"
src="instances/magnetInterconnectSlots.xml"/>
<xf:bind id="slot-bind"
nodeset="instance('slotsFile')/slot:Slots/slot:Slot"
readonly="true()"/>

<!-- Job statuses instance and bindings -->
<xf:instance id="jobStatuses">
<statuses xmlns="">
<status>
<label>Pending</label>
<value>R</value>
</status>
<status>
<label>In Progress</label>
<value>RA</value>
</status>
<status>
<label>Done</label>
<value>T</value>
</status>
<status>
<label>Cancelled</label>
<value>TX</value>
</status>
</statuses>
</xf:instance>
<xf:bind id="job-statuses-bind" nodeset="instance('jobStatuses')"
readonly="true()"/>
....
<xf:instance id="jobsFile" src="jobs.xml"/>
<xf:bind id="job-instance-bind" nodeset="instance('jobsFile')"/>
....
<xf:repeat id="job-repeat"
nodeset="instance('jobsFile')/jobs:Jobs/jobs:Job[position()!=last()]">

Allan Beaufour

2005-10-19, 6:25 am

Tuesday 18 October 2005 17:21 skrev feroadro@lacotisce.it:
> <head>
> <title>Greenhouse Catalog Data Entry</title>
> <link rel="stylesheet" type="text/css" href="greendb.css"/>
> <xf:model id="model1">
> <xf:instance src="dbview.xml" id="dbview" ></xf:instance>
> <xf:instance src="session.xml" id="session" ></xf:instance>
> <xf:instance src="workarea.xml" id="wka" ></xf:instance>
> <xf:bind nodeset="/wka/full_name"
> calculate='concat(/dbview/genus_name,"aaa ",/dbview/species_name)'/>
> <xf:bind id="msg" nodeset="/wka/message" />
> <xf:submission id="squery" ref="instance('dbview')"
> method="form-data-post" action="query.php"/>
> <xf:submission id="sinsert" ref="instance('dbview')"
> method="put" replace="none" includenamespaceprefixes="#default"
> action="submit.xml"/>
> </xf:model>
> </head>
>
> I read specs carefully, nowhere this is forbidden, will it be supported
> ?


Yes it is supported. You can have as many instances as you like for each
model.

> For one instance all works fine, for many those beyond the first become
> "mute"
> but no error messages. Can I plan the code this way ? (Note the
> "calculate" among nodes of different instances)


if nodeset="/wka/full_name" should point to the wka instance, you should use
nodeset="instance('wka')/full_name", and the same for the calculate:
concat(instance('dbview')/genus_name,"aaa ",instance('dbview')/species_name)

--
Allan Beaufour
Linux Software Engineer

Novell, Inc.
Software for the Open Enterprise
www.novell.com/open
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews