[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    [jira] Resolved: (XERCESC-1246) SimpleContentModel reports wrong
From:       "Alberto Massari (JIRA)" <xerces-c-dev () xml ! apache ! org>
Date:       2009-07-30 9:07:14
Message-ID: 399511793.1248944834876.JavaMail.jira () brutus
[Download RAW message or body]


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

Alberto Massari resolved XERCESC-1246.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1.0

A fix is in SVN.

> SimpleContentModel reports wrong error position
> -----------------------------------------------
> 
> Key: XERCESC-1246
> URL: https://issues.apache.org/jira/browse/XERCESC-1246
> Project: Xerces-C++
> Issue Type: Bug
> Components: Validating Parser (DTD), Validating Parser (XML Schema)
> Affects Versions: 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0
> Environment: Windows XP
> Reporter: Andrew Fang
> Assignee: Alberto Massari
> Fix For: 3.1.0
> 
> 
> Given a DTD decl
> <!ELEMENT A (B, C)>
> When try to validate element <A><C/></A>, SimpleContentModel::validateContent() \
> return value 1. It should return 0 in this case. Understood this is an internal \
> function and is not meant to be called directly. But we need to call this function \
>                 to get the precise error location. Here is the original code in \
>                 SimpleContentModel:
> Line: 309
> if (childCount == 2) {
> if (fDTD) {
> if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) {
> return 0;
> }
> if (!XMLString::equals(children[1]->getRawName(), fSecondChild->getRawName())) {
> return 1;
> }
> }
> else {
> if ((children[0]->getURI() != fFirstChild->getURI()) ||
> !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) {
> return 0;
> }
> if ((children[1]->getURI() != fSecondChild->getURI()) ||
> !XMLString::equals(children[1]->getLocalPart(), fSecondChild->getLocalPart())) {
> return 1;
> }
> }
> }
> else {
> if (childCount > 2) {
> return 2;
> }
> return childCount;
> }
> break;
> In case where childCount == 1, it will always return 1 regardless the value of the \
> child. Here is a suggestion on the change: line 309:
> if (childCount == 1) {
> if (fDTD) {
> if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) {
> return 0;
> } else 
> 			return 1;
> }
> else {
> if ((children[0]->getURI() != fFirstChild->getURI()) ||
> !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) {
> return 0;
> } else
> 						return 1;
> }
> }
> else { // childcount >= 2
> if (fDTD) {
> if (!XMLString::equals(children[0]->getRawName(), fFirstChild->getRawName())) {
> return 0;
> }
> if (!XMLString::equals(children[1]->getRawName(), fSecondChild->getRawName())) {
> return 1;
> }
> 			return 2;
> }
> else {
> if ((children[0]->getURI() != fFirstChild->getURI()) ||
> !XMLString::equals(children[0]->getLocalPart(), fFirstChild->getLocalPart())) {
> return 0;
> }
> if ((children[1]->getURI() != fSecondChild->getURI()) ||
> !XMLString::equals(children[1]->getLocalPart(), fSecondChild->getLocalPart())) {
> return 1;
> }			
> 					return 2;
> }
> }
> break;
> It will report correct position where error occurs.

-- 
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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic