Optional fields in XML

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

Optional fields in XML

islegmar
Hi:

This is a question more related with the Xform's spectification that with Orbeon, so sorry in advanced, but I would really appreciate if anybody could help me :-)

Is there any way to force that a field that DOES not appear in the XML, is shown in the Xform? 

So, I have an XML schema with an optional field. I create, related with this field, an <xf:input> control. When editing a certain XML instance, because this field is optional, the field DOES not appear in the XML. When rendering the Xform, I would expect that the input field will appear with empty content, so the user could fill in the field, but it is not shown. I was playing withe re 'relevant' attribute but it foes not help. 

Debuggin the HTML generated by Orbeo, I see the field is there but as disabled.

Thanks a lot

Isi





--
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
Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: Optional fields in XML

pappleby
Out of Office AutoReply: Optional fields in XML

I am out of the office until 19th April

***********************************************************************************************

This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.

 

Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.

 

Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.

***********************************************************************************************

The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG

 

Reply | Threaded
Open this post in threaded view
|

RE: Optional fields in XML

pfennell
In reply to this post by islegmar

Isi,

 

One of the plain and simple truths of XForms is that if there is nothing to bind to, then, the control that seeks to bind to it is irrelevant and should not be displayed. The control should bind to an element or an attribute node. However, if the node has no value, then, that is a different matter. In that case the control is bound to the node but the node has no value and therefore the control will be ‘empty’.

 

This also raises issues regarding optional attributes and the notion that the absence of an attribute implies some behavior or meaning that is the same as the default value for that attribute. A classic example being @font-weight = ‘normal’ implies the same as the absence of the attribute. When dealing with such situations, all attributes that have a default value must be present.

 

It seems like a heavy burden to carry to start with but it all makes a lot more sense in the long run because it makes you look more carefully at your data model and the business logic you need/require when manipulating instances of that model.

 

 

Regards

 

Philip Fennell

Consultant

 

Mark Logic Corporation

www.marklogic.com

 

E-mail: [hidden email]

Mobile: +44 (0)7824 830 866

 

UC2010

 

 

 

 

 

From: Legido Martínez, Isidoro [mailto:[hidden email]]
Sent: Thursday, April 15, 2010 5:13 PM
To: [hidden email]
Subject: [ops-users] Optional fields in XML

 

Hi:

 

This is a question more related with the Xform's spectification that with Orbeon, so sorry in advanced, but I would really appreciate if anybody could help me :-)

 

Is there any way to force that a field that DOES not appear in the XML, is shown in the Xform? 

 

So, I have an XML schema with an optional field. I create, related with this field, an <xf:input> control. When editing a certain XML instance, because this field is optional, the field DOES not appear in the XML. When rendering the Xform, I would expect that the input field will appear with empty content, so the user could fill in the field, but it is not shown. I was playing withe re 'relevant' attribute but it foes not help. 

 

Debuggin the HTML generated by Orbeo, I see the field is there but as disabled.

 

Thanks a lot

 

Isi

 

 

 



--
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
Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: Optional fields in XML

pappleby
Out of Office AutoReply: Optional fields in XML

I am out of the office until 19th April

***********************************************************************************************

This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.

 

Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.

 

Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.

***********************************************************************************************

The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG

 

Reply | Threaded
Open this post in threaded view
|

Re: RE: Optional fields in XML

islegmar
In reply to this post by pfennell
Hi Philip

Thanks for the reply. The problem I have is editing. So, suppose an XML like 

<parent>
  <child1/>
  <child2/>
  <child3/>
</parent>

where child1 is optional, according the schema. I write an XForm for editing this XML, with bindings to child1, child2 and child3. The form receives the following instance, that is valid: 

<parent>
  <child2>Value2</child2>
  <child3>Value3</child3>
</parent>

What I would expect is that the XForm shows the input field for 'child1', empty, so the user can write a value and then the child1 node is created. 

Probably there is something that I understand wrong, but for me that should be the normal way. If this is not the case, the the XForm is useless, because I can not force to the XML instances to have an empty 'child1', because they are files generated by third party tools.

Thanks a lot

Isi

On 15 April 2010 22:30, Philip Fennell <[hidden email]> wrote:

Isi,

 

One of the plain and simple truths of XForms is that if there is nothing to bind to, then, the control that seeks to bind to it is irrelevant and should not be displayed. The control should bind to an element or an attribute node. However, if the node has no value, then, that is a different matter. In that case the control is bound to the node but the node has no value and therefore the control will be ‘empty’.

 

This also raises issues regarding optional attributes and the notion that the absence of an attribute implies some behavior or meaning that is the same as the default value for that attribute. A classic example being @font-weight = ‘normal’ implies the same as the absence of the attribute. When dealing with such situations, all attributes that have a default value must be present.

 

It seems like a heavy burden to carry to start with but it all makes a lot more sense in the long run because it makes you look more carefully at your data model and the business logic you need/require when manipulating instances of that model.

 

 

Regards

 

Philip Fennell

Consultant

 

Mark Logic Corporation

www.marklogic.com

 

E-mail: [hidden email]

Mobile: +44 (0)7824 830 866

 

UC2010

 

 

 

 

 

From: Legido Martínez, Isidoro [mailto:[hidden email]]
Sent: Thursday, April 15, 2010 5:13 PM
To: [hidden email]
Subject: [ops-users] Optional fields in XML

 

Hi:

 

This is a question more related with the Xform's spectification that with Orbeon, so sorry in advanced, but I would really appreciate if anybody could help me :-)

 

Is there any way to force that a field that DOES not appear in the XML, is shown in the Xform? 

 

So, I have an XML schema with an optional field. I create, related with this field, an <xf:input> control. When editing a certain XML instance, because this field is optional, the field DOES not appear in the XML. When rendering the Xform, I would expect that the input field will appear with empty content, so the user could fill in the field, but it is not shown. I was playing withe re 'relevant' attribute but it foes not help. 

 

Debuggin the HTML generated by Orbeo, I see the field is there but as disabled.

 

Thanks a lot

 

Isi

 

 

 




--
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
Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: Optional fields in XML

pappleby
Out of Office AutoReply: Optional fields in XML

I am out of the office until 19th April

***********************************************************************************************

This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.

 

Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.

 

Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.

***********************************************************************************************

The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG

 

Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: Optional fields in XML

pfennell
In reply to this post by islegmar

Isi,

 

If the node to which you are attempting to bind to is not there then it is illogical to assume that the control can have any meaning. The reason being is that how would the control know what to do when you enter a value. The expectation might be that it would somehow know which ancestors, and all there related nodes, needed to be created in order that the value would have a ‘valid’ parent node, and that would be impossible in the absence of a schema.

 

As the node is optional you need to provide a mechanism to insert that node into the instance. This can be done using a control that allows you to create an instance of an optional element which invokes an xf:insert action that create the node in question. Once the node is there then the control becomes relevant and it will appear.

 

This is not an unreasonable way of going about things as it reflects exactly what is required when dealing with option elements. You cannot create a child of an element without its parent being there.

 

 

I hope this helps.

 

 

Regards

 

Philip Fennell

Consultant

 

Mark Logic Corporation

www.marklogic.com

 

E-mail: [hidden email]

Mobile: +44 (0)7824 830 866

 

UC2010

 

 

 

From: Legido Martínez, Isidoro [mailto:[hidden email]]
Sent: Thursday, April 15, 2010 9:45 PM
To: [hidden email]
Subject: [ops-users] Re: RE: Optional fields in XML

 

Hi Philip

 

Thanks for the reply. The problem I have is editing. So, suppose an XML like 

 

<parent>

  <child1/>
  <child2/>
  <child3/>
</parent>

 

where child1 is optional, according the schema. I write an XForm for editing this XML, with bindings to child1, child2 and child3. The form receives the following instance, that is valid: 

 

<parent>

  <child2>Value2</child2>
  <child3>Value3</child3>
</parent>

 

What I would expect is that the XForm shows the input field for 'child1', empty, so the user can write a value and then the child1 node is created. 

 

Probably there is something that I understand wrong, but for me that should be the normal way. If this is not the case, the the XForm is useless, because I can not force to the XML instances to have an empty 'child1', because they are files generated by third party tools.

 

Thanks a lot

 

Isi

 

On 15 April 2010 22:30, Philip Fennell <[hidden email]> wrote:

Isi,

 

One of the plain and simple truths of XForms is that if there is nothing to bind to, then, the control that seeks to bind to it is irrelevant and should not be displayed. The control should bind to an element or an attribute node. However, if the node has no value, then, that is a different matter. In that case the control is bound to the node but the node has no value and therefore the control will be ‘empty’.

 

This also raises issues regarding optional attributes and the notion that the absence of an attribute implies some behavior or meaning that is the same as the default value for that attribute. A classic example being @font-weight = ‘normal’ implies the same as the absence of the attribute. When dealing with such situations, all attributes that have a default value must be present.

 

It seems like a heavy burden to carry to start with but it all makes a lot more sense in the long run because it makes you look more carefully at your data model and the business logic you need/require when manipulating instances of that model.

 

 

Regards

 

Philip Fennell

Consultant

 

Mark Logic Corporation

www.marklogic.com

 

E-mail: [hidden email]

Mobile: +44 (0)7824 830 866

 

Error! Filename not specified.

 

 

 

 

 

From: Legido Martínez, Isidoro [mailto:[hidden email]]
Sent: Thursday, April 15, 2010 5:13 PM
To: [hidden email]
Subject: [ops-users] Optional fields in XML

 

Hi:

 

This is a question more related with the Xform's spectification that with Orbeon, so sorry in advanced, but I would really appreciate if anybody could help me :-)

 

Is there any way to force that a field that DOES not appear in the XML, is shown in the Xform? 

 

So, I have an XML schema with an optional field. I create, related with this field, an <xf:input> control. When editing a certain XML instance, because this field is optional, the field DOES not appear in the XML. When rendering the Xform, I would expect that the input field will appear with empty content, so the user could fill in the field, but it is not shown. I was playing withe re 'relevant' attribute but it foes not help. 

 

Debuggin the HTML generated by Orbeo, I see the field is there but as disabled.

 

Thanks a lot

 

Isi

 

 

 

 



--
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
Reply | Threaded
Open this post in threaded view
|

Out of Office AutoReply: RE: Optional fields in XML

pappleby
Out of Office AutoReply: RE: Optional fields in XML

I am out of the office until 19th April

***********************************************************************************************

This email, including any attachment, is confidential and may be legally privileged. If you are not the intended recipient or if you have received this email in error, please inform the sender immediately by reply and delete all copies from your system. Do not retain, copy, disclose, distribute or otherwise use any of its contents.

 

Whilst we have taken reasonable precautions to ensure that this email has been swept for computer viruses, we cannot guarantee that this email does not contain such material and we therefore advise you to carry out your own virus checks. We do not accept liability for any damage or losses sustained as a result of such material.

 

Please note that incoming and outgoing email communications passing through our IT systems may be monitored and/or intercepted by us solely to determine whether the content is business related and compliant with company standards.

***********************************************************************************************

The Stationery Office Limited is registered in England No. 3049649 at 10 Eastbourne Terrace, London, W2 6LG

 

Reply | Threaded
Open this post in threaded view
|

Re: Re: RE: Optional fields in XML

Alessandro  Vernet
Administrator
In reply to this post by islegmar
Isi,

This is a legitimate use case, but one that is not handled very well
by XForms. In fact Micah raised a similar problem in January on his
blog, and Philip and I also responded there (small world, isn't it?).
See:

http://dubinko.info/blog/2010/01/20/xforms-binding/

The workaround I suggest there deals with removing empty optional
element from the instance when you submit it. But it doesn't deal with
adding them when you get the instance. If you don't have too many of
those, when you load the instance, on xforms-submit-done, you could
run a series of action like:

<xforms:insert context="/person" if="empty(/person/middle-name)"
origin="xxforms:element('middle-name')"/>

If you don't have too many of those elements, and if the list doesn't
change too often, this might be an acceptable way to do it. Otherwise
you'll need something more sophisticated, like adding those elements
in XSLT based on schema.

And if you can, I would definitely design the schema so optional value
are represented by an empty element instead of no element.

Alex

2010/4/15 Legido Martínez, Isidoro <[hidden email]>

>
> Hi Philip
> Thanks for the reply. The problem I have is editing. So, suppose an XML like
> <parent>
>   <child1/>
>   <child2/>
>   <child3/>
> </parent>
> where child1 is optional, according the schema. I write an XForm for editing this XML, with bindings to child1, child2 and child3. The form receives the following instance, that is valid:
> <parent>
>   <child2>Value2</child2>
>   <child3>Value3</child3>
> </parent>
> What I would expect is that the XForm shows the input field for 'child1', empty, so the user can write a value and then the child1 node is created.
> Probably there is something that I understand wrong, but for me that should be the normal way. If this is not the case, the the XForm is useless, because I can not force to the XML instances to have an empty 'child1', because they are files generated by third party tools.
> Thanks a lot
> Isi
> On 15 April 2010 22:30, Philip Fennell <[hidden email]> wrote:
>>
>> Isi,
>>
>>
>>
>> One of the plain and simple truths of XForms is that if there is nothing to bind to, then, the control that seeks to bind to it is irrelevant and should not be displayed. The control should bind to an element or an attribute node. However, if the node has no value, then, that is a different matter. In that case the control is bound to the node but the node has no value and therefore the control will be ‘empty’.
>>
>>
>>
>> This also raises issues regarding optional attributes and the notion that the absence of an attribute implies some behavior or meaning that is the same as the default value for that attribute. A classic example being @font-weight = ‘normal’ implies the same as the absence of the attribute. When dealing with such situations, all attributes that have a default value must be present.
>>
>>
>>
>> It seems like a heavy burden to carry to start with but it all makes a lot more sense in the long run because it makes you look more carefully at your data model and the business logic you need/require when manipulating instances of that model.
>>
>>
>>
>>
>>
>> Regards
>>
>>
>>
>> Philip Fennell
>>
>> Consultant
>>
>>
>>
>> Mark Logic Corporation
>>
>> www.marklogic.com
>>
>>
>>
>> E-mail: [hidden email]
>>
>> Mobile: +44 (0)7824 830 866
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> From: Legido Martínez, Isidoro [mailto:[hidden email]]
>> Sent: Thursday, April 15, 2010 5:13 PM
>> To: [hidden email]
>> Subject: [ops-users] Optional fields in XML
>>
>>
>>
>> Hi:
>>
>>
>>
>> This is a question more related with the Xform's spectification that with Orbeon, so sorry in advanced, but I would really appreciate if anybody could help me :-)
>>
>>
>>
>> Is there any way to force that a field that DOES not appear in the XML, is shown in the Xform?
>>
>>
>>
>> So, I have an XML schema with an optional field. I create, related with this field, an <xf:input> control. When editing a certain XML instance, because this field is optional, the field DOES not appear in the XML. When rendering the Xform, I would expect that the input field will appear with empty content, so the user could fill in the field, but it is not shown. I was playing withe re 'relevant' attribute but it foes not help.
>>
>>
>>
>> Debuggin the HTML generated by Orbeo, I see the field is there but as disabled.
>>
>>
>>
>> Thanks a lot
>>
>>
>>
>> Isi
>>
>>
>>
>>
>>
>>
>
>
> --
> 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
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet