Message: A new issue has been created in JIRA.
--------------------------------------------------------------------- View the issue: http://issues.apache.org/jira/browse/XERCESC-1246 Here is an overview of the issue: --------------------------------------------------------------------- Key: XERCESC-1246 Summary: SimpleContentModel reports wrong error position Type: Bug Status: Unassigned Priority: Major Project: Xerces-C++ Components: Validating Parser (DTD) Validating Parser (Schema) (Xerces 1.5 or up only) Versions: 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 Assignee: Reporter: Andrew Fang Created: Thu, 29 Jul 2004 10:58 AM Updated: Thu, 29 Jul 2004 10:58 AM Environment: Windows XP Description: 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. --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]