Page 1 of 1

Xforms validation

Posted: Mon May 15, 2006 10:59 pm
by cberrymd
I have created two Xform files that are identical except for the <html ...> tag. This one followed the advice I found on this forum. It validates, but will not run.

<?xml version="1.0" ?>
<html xmlns= "http://www.w3.org/2002/06/xhtml2/"
xmlns:xf= "http://www.w3.org/2002/xforms"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xmlns:br= "http://www.BlueRidgeEMR.net/EMR"
xsi:schemaLocation= "http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd
http://www.w3.org/2002/xforms http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd" >

<head>
<link rel="stylesheet" type="text/css" href="xforms.css"/>
<script type="text/javascript" src="/opt/FormFaces/formfaces.js"></script>

This one was from a funcioning XForm example. It runs but will not validate.

<?xml version="1.0" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:br="http://www.BlueRidgeEMR.net/EMR"
xsi:schemaLocation= "http://www.w3.org/1999/xhtml XForms-Schema.xsd
http://www.w3.org/2002/xforms http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd">

<head>
<link rel="stylesheet" type="text/css" href="xforms.css"/>
<script type="text/javascript" src="/opt/FormFaces/formfaces.js"></script>

Can someone help me get a combination that will run and validate?

Posted: Tue May 16, 2006 3:28 pm
by george
Hello,

You get that behavior because the application you use to render that does not validate the document while oXygen validates it. In the first case you specified the schemas and the namespaces as declared in the schemas, however the rendering application does not handle the http://www.w3.org/2002/06/xhtml2/ namespace and your html. etc. elements are from this namespcace.
Your tool handles html, etc. elements from the http://www.w3.org/1999/xhtml namespace and that is what the second document uses. However in that case you specified a wrong schema for the http://www.w3.org/1999/xhtml namespace, see

xsi:schemaLocation= "http://www.w3.org/1999/xhtml XForms-Schema.xsd

thus the document is invalid. You need to have a schema for the http://www.w3.org/1999/xhtml namespace similar with the one that you have for the http://www.w3.org/2002/06/xhtml2/ namespace. You can eventually get the schema or schemas for the http://www.w3.org/2002/06/xhtml2/ namespace from the w3c website and edit them to change the target namespace to http://www.w3.org/1999/xhtml and use that in your second document.

Best Regards,
George

Posted: Tue May 16, 2006 5:20 pm
by cberrymd
Brilliant. All fixed.

Posted: Sun May 28, 2006 3:33 pm
by plonepaul
cberrymd wrote:Brilliant. All fixed.
I'm having a hard time getting any combination of XHTML and XForms to work.

I tried cberrymd's example listed at the top. It allowed me to type <xf:xxxx/> and still claim to be valid.

I have spent the day trying every combination of XHTML 1, XForms, XHTML 2, NRL, etc. that I can find, downloading RNG schemas etc. I haven't had much luck.

I'm trying to author XHTML+XForms + XML Events documents. I would like to validate them and preferably have autocompletion. At this stage, I'm not interested in custom XSD schemas in my XForms instances.

If anybody has a tarball I can download with a pile of stuff for oXygen 7.1 that works, I'd greatly appreciate it.

Posted: Mon May 29, 2006 5:41 pm
by george
Hi Paul,

That is because the xhtml2.xsd used in that example specifies only one element, html that can contain anything, without validation on its content, note the skip value for the processContents attribute.
If you change that schema for instance like below to enforce validation on other namespace elements then the validation will be performed on the XForms elements:

Code: Select all



<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3.org/2002/06/xhtml2/">

<xs:annotation>
<xs:documentation>
A minimal XML Schema for XHTML 2.0
$Id: xhtml2.xsd,v 1.4 2005/06/14 15:28:27 mimasa Exp $
</xs:documentation>
</xs:annotation>

<xs:element name="html">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:any namespace="##local" processContents="skip"/>
<xs:any namespace="##other" processContents="strict"
minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
<xs:anyAttribute namespace="##any" processContents="skip"/>
</xs:complexType>
</xs:element>
</xs:schema>
Best Regards,
George

Posted: Mon May 29, 2006 5:56 pm
by plonepaul
Err, now I realize that the schema listed at that URL doesn't actually do too much. :?

If I want to create XHTML 2.0 documents that do validation and autocompletion for XHTML, XForms, and XML Events elements, I guess I have some work to do.