Problem Validating xhtml against schema

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Guest

Problem Validating xhtml against schema

Post by Guest »

Validating the following document in Oxygen, shows what appear to be errors caused by parsing the processing instruction on line 1, and w3c xml... attribute values on lines 3 and 5, according to the XML schema instance specified in line 5. The errors diagnose '-' characters as invalid syntax.

Code: Select all

01 <?xml version="1.0" encoding="UTF-8"?>
02 <xhtml:html
03 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
04 xsi:schemaLocation="http://www.w3.org/1999/xhtml
05 http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd"
06 xmlns:xhtml="http://www.w3.org/1999/xhtml"
07 >
08 <xhtml:head><xhtml:title>Some title</xhtml:title></xhtml:head>
09 <xhtml:body>
10 <xhtml:p>Some text</xhtml:p>
11 </xhtml:body>
12 </xhtml:html>
1. On line 5, URL http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd is correctly de-referenced by a browser to the schema code.

2. However, oxygen flags three errors, similar to the following, for the above document.

Code: Select all

Severity        2
Description InvalidRegex: Pattern value '[-+]?(\d+|\d+(\.\d+)?%)'
is not a valid regular expression. The reported error
was: ''-' is an invalid character range. Write '\-'.'.
SystemID: http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd Line: 230
Resource xhtml-using-xforms.xml
In Folder vendorSite/webRoot/WEB-INF/resources/pagesets/checkout
Location line 1
Creation Time September 24, 2004 5:35:56 PM
3. Escaping the - in line 1 makes it impossible to store and validate the document.

4. Escaping the - in lines 3 or 5, prevents location of the schema, which prevents diagnosis of the '-' chars as bad syntax, but also prevents validation of the document with error

Code: Select all

Severity      2	
Description cvc-elt.1: Cannot find the declaration of element 'xhtml:html'.
Resource xhtml-using-xforms.xml
In Folder vendorSite/webRoot/WEB-INF/resources/pagesets/checkout
Location line 8
Creation Time September 25, 2004 8:21:29 AM
Questions
---------
a. Is there a workaround for validating xhtml ?

b. I have been composing the above 'form' presentation of errors manually in a text editor, by copy and paste from the Problems tab. Is there an automatic way of doing this in Oxygen?

Bill.

If I am totally off the wall here, I apologize in advance.
bwinspur
Posts: 37
Joined: Tue Nov 25, 2003 3:31 am

Post by bwinspur »

When I originally posted this, I'd forgotten to log in. Apologies.
Bill.
Bill W.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Bill,

The schema http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd is not valid. There are 4 places where - is used in pattern value without being escaped. You should corrent that and save the schema locally. Create then an XML catalog to resolve the http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd system ID to your corrected schema file and set it in oXygen. After that you should be able to validate your documents against the corrected schema although you specify the http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd in your schema document. For more details about the escaping of - in pattern values see the related topic:
http://www.oxygenxml.com/forum/ftopic581.html

You a string representation of the error in the Eclipse plugin if you use the Copy contextual menu action on the corresponding problem marker in the the Problems View. In the standalone version there is a Show message action also on the contextual menu of the, in this case, Errors view.

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

Post by bwinspur »

George,
I downloaded http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd,
to make a local copy in which to fix the pattern error. However, could not find the
pattern mentioned in your previous note to Yaakov Chalkin.

Code: Select all


 [\sa-zA-Z0-9-]*   -- to be changed to --     [\sa-zA-Z0-9\-]*
I also searched http://www.w3.org/2001/xml.xsd, which is imported
by http://www.w3.org/2002/08/xhtml/xhtml1-transitional.xsd

Obviously, I'm not looking at the right thing. In which document should I be making
the correction.
Bill W.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Bill,

Sorry, I should have been more explicit. I ment the problem was similar with the problem from that topic, a - was used in a pattern unescaped.

You should change
line 231 <xs:pattern value="[-+]?(\d+|\d+(\.\d+)?%)"/>
to
<xs:pattern value="[\-+]?(\d+|\d+(\.\d+)?%)"/>

line 242 <xs:pattern value="[-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*"/>
to
<xs:pattern value="[\-+]?(\d+|\d+(\.\d+)?%)|[1-9]?(\d+)?\*"/>

and

line 278 value="[-+]?(\d+|\d+(\.\d+)?%)(,\s*[-+]?(\d+|\d+(\.\d+)?%))*"/>
to
value="[\-+]?(\d+|\d+(\.\d+)?%)(,\s*[\-+]?(\d+|\d+(\.\d+)?%))*"/>

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

Post by bwinspur »

Thanks George,

That did it. XHTML is validating now.
Bill W.
Post Reply