You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Boris Kolpackov (JIRA)" <xe...@xml.apache.org> on 2009/02/12 15:14:00 UTC

[jira] Closed: (XERCESC-1838) Unexpected validation result when comment is present

     [ https://issues.apache.org/jira/browse/XERCESC-1838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Boris Kolpackov closed XERCESC-1838.
------------------------------------

    Resolution: Fixed
      Assignee: Boris Kolpackov

The actual fix is a bit more involved than what was proposed.

> Unexpected validation result when comment is present
> ----------------------------------------------------
>
>                 Key: XERCESC-1838
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1838
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (XML Schema)
>    Affects Versions: 2.8.0, 3.0.0
>            Reporter: Alexey Miroshnichenko
>            Assignee: Boris Kolpackov
>             Fix For: 3.0.1, 3.1.0
>
>         Attachments: test.xml, test.xsd
>
>
> Schema:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="http://www.openuri.org/mySchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.openuri.org/mySchema" elementFormDefault="qualified" version="1.0">
> 	<xsd:element name="root">
> 		<xsd:complexType>
> 			<xsd:sequence>
> 				<xsd:element name="test" type="MyType" maxOccurs="unbounded"/>
> 			</xsd:sequence>
> 		</xsd:complexType>
> 	</xsd:element>
> 	<xsd:complexType name="MyType">
> 		<xsd:simpleContent>
> 			<xsd:extension base="xsd:byte">
> 			</xsd:extension>
> 		</xsd:simpleContent>
> 	</xsd:complexType>
> </xsd:schema>
> document:
> <?xml version="1.0" encoding="UTF-8"?>
> <p1:root xmlns:p1="http://www.openuri.org/mySchema" 
>              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>              xsi:schemaLocation="http://www.openuri.org/mySchema schema.xsd">
> 	<p1:test><!-- text -->34</p1:test>
> 	<p1:test>
> <!-- text -->34</p1:test>
> 	<p1:test>
> 34</p1:test>
> 	<p1:test>34</p1:test>
> 	<p1:test>
> 			34
> </p1:test>
> </p1:root>
> SAX2Print output:
> <?xml version="1.0" encoding="LATIN1"?>
> <p1:root xsi:schemaLocation="http://www.openuri.org/mySchema schema.xsd">
>         <p1:test>34</p1:test>
>         <p1:test> 34
> Error at file Z:\eTools\bin\Debug/instance-1.xml, line 7, char 26
>   Message: Datatype error: Type:InvalidDatatypeValueException, Message:Value ' 34' does not match re
> gular expression facet '[+\-]?[0-9]+'.
> </p1:test>
>         <p1:test>34</p1:test>
>         <p1:test>34</p1:test>
>         <p1:test>34</p1:test>
> </p1:root>
> Note the difference between second and third 'test' element in the document: second has comment.
> Suggested fix - in SchemaValidator::normalizeWhiteSpace function last lines:
> was
>     if (fCurReader->isWhitespace(*(srcPtr-1)))
>         fTrailing = true;
>     else
>         fTrailing = false;
> now
> ...
>     if (0 != *(srcPtr) && fCurReader->isWhitespace(*(srcPtr-1)))
>         fTrailing = true;
>     else
>         fTrailing = false;
> }
> Idea: isWhitespace returns 'true' for empty string, but here 'empty string' does not mean whitepace.
> Please, review.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org