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

Scott Cantor updated XERCESC-2197:
----------------------------------
    Fix Version/s: 4.0.0
                       (was: 3.2.4)

> Key Identity Constraint error reporting
> ---------------------------------------
>
>                 Key: XERCESC-2197
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2197
>             Project: Xerces-C++
>          Issue Type: Improvement
>          Components: Validating Parser (XML Schema)
>            Reporter: Stefan de Konink
>            Priority: Major
>             Fix For: 4.0.0
>
>         Attachments: XERCESC-2197.patch
>
>
> The current Java version of Xerces has a significant better error reporting 
> on Identity Constraints, if compared with the C++ version. The primary issue 
> is that the the C++ version is only reporting the name of the element the key 
> identity constraint has been defined, the secondary issue is that the line 
> number reported is of the element closing the tag. A properly failing 
> document will therefore show oceans of duplicated lines in the output, while 
> in fact they are different elements tested, in different parts of the 
> document.
>  
> As example the following error is presented:
> Error at file /tmp/cxx.xml, line 5009571, char 24
>  Message: identity constraint key for element 'ServiceFrame' not found
> The expected error would be:
> Error at file /tmp/cxx.xml, line 1495133, char 51
> Key 'ToPointRef' with value 'CXX-ALL:RoutePoint:78210040' not found for 
> identity constraint of element 'ServiceFrame'.
>  
> Since the above is quite a difference I started to fiddle with GDB a bit:
>  
> {code:java}
> 302 {
> 303 FieldValueMap& valueMap = iter.nextElement();
> 304
> 305 if (!keyValueStore->contains(&valueMap) && fDoReportError) {
> 306
> 307 fScanner->getValidator()->emitError(XMLValid::IC_KeyNotFound,
> 308 fIdentityConstraint->getElementName());
> 309 }
> 310 }
> 311 }
> {code}
>  
>  
>  
> {code:java}
> p fIdentityConstraint.fIdentityConstraintName
> $34 = (XMLCh *) 0x590070 u"ToPointRef"
>  
> p fIdentityConstraint.fSelector.fXPath.fExpression
> $40 = (XMLCh *) 0x590390 u".//netex:ToPointRef"
>  
> p fIdentityConstraint.fFields.fElemList[0].fXPath.fExpression
> $32 = (XMLCh *) 0x590930 u"@ref"
>  
> p keyValueStore.fIdentityConstraint.fIdentityConstraintName
> $70 = (XMLCh *) 0x57cf10 u"ScheduledStopPointId"
>  
> p *valueMap.fValues.fElemList
> $41 = 0x8ce9d90 u"CXX-ALL:RoutePoint:78210040"
> p fIdentityConstraint->getElementName()
> $77 = (XMLCh *) 0x5902f0 u"ServiceFrame"
> {code}
>  
> So I would state that making this error on par with Java is quite trivial. 
> The only thing I did not find yet how to retrieve the line number for the 
> element that is currently being searched for. Would be nice to get a hand in 
> that direction for crafting a decent patch! 
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to