[ 
http://issues.apache.org/jira/browse/XERCESC-1458?page=comments#action_12315701 
] 

Pawel Kwasow commented on XERCESC-1458:
---------------------------------------

The probably solution to this problem is to change method 
SchemaValidator::normalizeWhiteSpace. The variable fTrailing is not 'cleared' 
when a space char already been appended to the string. And it is appended also 
in next calls to this method.

In the 'NINGBO ARTS & CRAFTS IMP&EXP CO.LTD' example method is called 3 
times: with 'NINGBO ARTS ', '& CRAFTS IMP' and '&EXP CO.LTD'. In second and 
third call the space is appended to the value while it should be only in the 
second call.

I changed lines:

"
    if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing)
        toFill.append(chSpace);
"

to

"
    if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing)
    {
        toFill.append(chSpace);
        fTrailing = false;
    }
"

and the problem vanished.

But I'm not 100% sure that this is exactly what is needed to be done, so I 
don't post this change as a patch.

> error in SchemaValidator::normalizeWhiteSpace function
> ------------------------------------------------------
>
>          Key: XERCESC-1458
>          URL: http://issues.apache.org/jira/browse/XERCESC-1458
>      Project: Xerces-C++
>         Type: Bug
>   Components: Validating Parser (Schema) (Xerces 1.5 or up only)
>     Versions: 2.1.0, 2.6.0
>  Environment: any
>     Reporter: Pawel Kwasow

>
> Problem was encountered when we tried to validate xml contained node with 
> value: 
> 'NINGBO ARTS & CRAFTS IMP&EXP CO.LTD'.
> It was incorrectly resolved as 'NINGBO ARTS & CRAFTS IMP &EXP CO.LTD' instead 
> of 'NINGBO ARTS & CRAFTS IMP&EXP CO.LTD' (there should be NO space beetwen 
> 'IMP' and '&EXP').
> Validator reported error, because element maximum length is 35 and 'NINGBO 
> ARTS & CRAFTS IMP &EXP CO.LTD' has length of 36.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to