xsd validation - element with an attribute

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

xsd validation - element with an attribute

MarcinKula
Hi,

I have problem with using xml schema for validation.

At first I definied xsd file, where my element 'Name' has an attribute.
After this I attached xsd file to the model.

At the xform document I have two input fields.
The first one is connected with element value (I also used ref and bind),
the second with the attribute of this element.

There is no error ONLY when 'Name' input field is empty.
Otherwise I have error (an exclamation mark next to the input field)
because Orbeon thinks that my xml does not conform to the schema in my xforms page.
But XML with both 'Name' element and its attribute filled is a valid xml.

I searched at the ops forum, studied examples of xforms pages
but I haven't found any solution.
It looks like Orbeon validates this xml incorrectly.

I think that my xml schema is correct, maybe my xform has an error ?

I also attached my all files (page-flow and xml) in a zip archive.

Thank you in advance,
Marcin.

TEST.XSD
--------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.test.com/TEST"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        attributeFormDefault="unqualified" elementFormDefault="qualified"
        targetNamespace="http://www.test.com/TEST">
       
        <xsd:element name="Document" type="tDocument"></xsd:element>
       
        <xsd:complexType name="tDocument">
                <xsd:sequence>
                        <xsd:element name="Client" type="tClient"></xsd:element>
                </xsd:sequence>
        </xsd:complexType>
       
        <xsd:complexType name="tClient">
                <xsd:sequence>
                        <xsd:element name="Name" type="tClientName"></xsd:element>
                </xsd:sequence>
        </xsd:complexType>       
       
        <xsd:complexType name="tClientName">
                <xsd:simpleContent>
                        <xsd:extension base="xsd:string">
                                <xsd:attribute name="code" type="xsd:integer" use="required"/>
                        </xsd:extension>
                </xsd:simpleContent>
        </xsd:complexType>       
</xsd:schema>

TEST1.XHTML
-----------
<?xml version="1.0" encoding="UTF-8"?>

<html xmlns="http://www.w3.org/1999/xhtml"   
      xmlns:xf="http://www.w3.org/2002/xforms"
      xmlns:xi="http://www.w3.org/2001/XInclude"       
      xmlns:ts="http://www.test.com/TEST">
   
   <head>
        <xf:model id="model" schema="/apps/test/test.xsd">                               
                <xf:instance id="instance" xmlns="ts">
                    <xi:include href="input:instance"/>
                </xf:instance>                       
                       
                <xf:bind id="b-client" nodeset="ts:Client/ts:Name" />
                <xf:bind id="b-code" nodeset="ts:Client/ts:Name/@code" />
        </xf:model>               
   </head>

   <body>       
                  
                <xf:input id="i-Name" ref="ts:Client/ts:Name">
                <xf:label id="l-Name">Full first name</xf:label>                       
                        <xf:alert id="a-Name">Full first name</xf:alert>
                </xf:input>
                               
                <xf:input id="i-Code" ref="ts:Client/ts:Name/@code">
                        <xf:label id="l-Code">Client code</xf:label>                       
                        <xf:alert id="a-Code">Client code</xf:alert>                 
                </xf:input>
       
               
                <widget:xforms-instance-inspector xmlns:widget="http://orbeon.org/oxf/xml/widget"/>
       
           </body>
</html>

xsd_validation_element_with_an_attribute.zip
Reply | Threaded
Open this post in threaded view
|

Re: xsd validation - element with an attribute

Alessandro Vernet
Administrator
Marcin,

On Jan 9, 2008 3:35 AM, MarcinKula <[hidden email]> wrote:
> There is no error ONLY when 'Name' input field is empty.
> Otherwise I have error (an exclamation mark next to the input field)
> because Orbeon thinks that my xml does not conform to the schema in my
> xforms page.
> But XML with both 'Name' element and its attribute filled is a valid xml.

This looks like a bug in the schema validator we are using. I will
double check this and follow-up on this.

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
http://www.orbeon.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
Reply | Threaded
Open this post in threaded view
|

Re: xsd validation - element with an attribute

MarcinKula
Alex,

Did you double check this example ?

Best regards.

Alessandro Vernet wrote
Marcin,

On Jan 9, 2008 3:35 AM, MarcinKula <mkulazinski@sygnity.pl> wrote:
> There is no error ONLY when 'Name' input field is empty.
> Otherwise I have error (an exclamation mark next to the input field)
> because Orbeon thinks that my xml does not conform to the schema in my
> xforms page.
> But XML with both 'Name' element and its attribute filled is a valid xml.

This looks like a bug in the schema validator we are using. I will
double check this and follow-up on this.
Reply | Threaded
Open this post in threaded view
|

Re: xsd validation - element with an attribute

Alessandro Vernet
Administrator
Marcin,

On Jan 28, 2008 4:25 PM, MarcinKula <[hidden email]> wrote:
> Did you double check this example ?

Erik has been investigating this, and it *looks* like a bug in the
schema validator we are using. You can see Erik's comments in the bug
below. If you want to pursue this yourself, see his comments and let
us know if you want more pointers on how to debug this.

http://forge.objectweb.org/tracker/index.php?func=detail&aid=308399&group_id=168&atid=350207

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.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