Problem Validating XForm Against Schema

Having trouble installing Oxygen? Got a bug to report? Post it all here.
bwinspur
Posts: 37
Joined: Tue Nov 25, 2003 3:31 am

Problem Validating XForm Against Schema

Post by bwinspur »

I have an xforms file which is failing validation for no
reason I can see. The first few lines of the file are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<xforms:model
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xs:schemaLocation="http://www.w3.org/2002/xforms
http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd"
> <!-- error diagnosed on this line -->
<xforms:instance>
<credit-card>
<type/>
..... etc.

The document was developed outside Oxygen, but I believe that it
is probably valid, and that the syntax errors are probably invalid.

---------------

The validation failure is diagnosed as follows

Severity 2
Description cvc-elt.1: Cannot find the declaration of element 'xforms:model'.
Resource xforms-credit-card-model.xml
In Folder vendorSite/webRoot/WEB-INF/resources/pagesets/checkout
Location line 7
Creation Time September 24, 2004 8:25:18 AM

------------

If anybody can tell me what am I doing to cause the above error, and
how I can get the document to to validate, I would appreciate it.

Bill.[/code]
Bill W.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Bill,

To associate a schema with a target namespace with an instance document you need to use the xsi:schemaLocation attribute from the http://www.w3.org/2001/XMLSchema-instance namespace like below:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xforms:model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2002/xforms http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd"
xmlns:xforms="http://www.w3.org/2002/xforms">
...
Best Regards,
George
bwinspur
Posts: 37
Joined: Tue Nov 25, 2003 3:31 am

Post by bwinspur »

Thanks George, that worked, Bill.
Bill W.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Bill,

I remember I wanted to add this to my previous post but I forgot...

If you start with a document like:

<?xml version="1.0" encoding="UTF-8"?>
<xforms:model xmlns:xforms="http://www.w3.org/2002/xforms">
...
</xforms:model>

and use the Associate schema action and provide http://www.w3.org/MarkUp/Forms/2002/XForms-Schema.xsd as the schema you will get the schema instance namespace binding to xsi and xsi:schemaLocation added automatically in your document.

Best Regards,
George
bwinspur
Posts: 37
Joined: Tue Nov 25, 2003 3:31 am

Post by bwinspur »

Thanks again George.

I realize that one has to specify home-grown schemas explicitly, but it would be a major help if the AssociateSchema function offered a list of the w3c standard schemas to choose from.

Bill.
Bill W.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Bill,

Yes, that is a nice feature. I added your request on our bugzilla.

Best Regards,
George
Post Reply