[ 
https://issues.apache.org/jira/browse/XERCESJ-1750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17581030#comment-17581030
 ] 

John Poole edited comment on XERCESJ-1750 at 8/17/22 9:34 PM:
--------------------------------------------------------------

Further, it looks like the only caller to XMLParseError is from the single line 
1725 in XIncludeHandler:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ find . -type f |xargs 
grep -in xmlparseerror
./build/src/org/apache/xerces/xinclude/XIncludeHandler.java:1725:               
 reportFatalError("XMLParseError", new Object[] { href });
./build/src/org/apache/xerces/impl/msg/XIncludeMessages_en.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./build/src/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
grep: ./build/classes/org/apache/xerces/xinclude/XIncludeHandler.class: binary 
file matches
./build/classes/org/apache/xerces/impl/msg/XIncludeMessages_en.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./build/classes/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./src/org/apache/xerces/xinclude/XIncludeHandler.java:1725:                
reportFatalError("XMLParseError", new Object[] { href });
./src/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError = 
Error attempting to parse XML file (href=''{0}'').
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 ${noformat}
 Here are my test results using some modified files from the b3.xml from Issue 
#1749.

h4. Missing Xpointer Attribute Case:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_missing_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_missing_xpointer.xml:11:33: Error attempting to parse XML file 
(href='a3.xml', xpointer='null').
{noformat}
h4. Empty Xpointer Value, xpointer="", Case:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_empty_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_empty_xpointer.xml:11:44: Error attempting to parse XML file 
(href='a3.xml', xpointer='').
{noformat}
h4. Invalid Xpointer Case;
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_invalid_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_invalid_xpointer.xml:11:49: Error attempting to parse XML file 
(href='a3.xml', xpointer='BOGUS').
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 ${noformat}


was (Author: JIRAUSER294551):
Further, it looks like the only caller to XMLParseError is from the single line 
1725 in XIncludeHandler:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ find . -type f |xargs 
grep -in xmlparseerror
./build/src/org/apache/xerces/xinclude/XIncludeHandler.java:1725:               
 reportFatalError("XMLParseError", new Object[] { href });
./build/src/org/apache/xerces/impl/msg/XIncludeMessages_en.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./build/src/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
grep: ./build/classes/org/apache/xerces/xinclude/XIncludeHandler.class: binary 
file matches
./build/classes/org/apache/xerces/impl/msg/XIncludeMessages_en.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./build/classes/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError
 = Error attempting to parse XML file (href=''{0}'').
./src/org/apache/xerces/xinclude/XIncludeHandler.java:1725:                
reportFatalError("XMLParseError", new Object[] { href });
./src/org/apache/xerces/impl/msg/XIncludeMessages.properties:37:XMLParseError = 
Error attempting to parse XML file (href=''{0}'').
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 ${noformat}
 Here are my test results using some modified files from the b3.xml from Issue 
#1749.
h4. Missing Xpointer Attribute Case:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_missing_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_missing_xpointer.xml:11:33: Error attempting to parse XML file 
(href='a3.xml', xpointer='null').{noformat}
h4. Empty Xpointer Value, xpointer="", Case:
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_empty_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_empty_xpointer.xml:11:44: Error attempting to parse XML file 
(href='a3.xml', xpointer='').{noformat}
h4. Invalid Xpointer Case;
{noformat}
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $  java dom.Writer -xi 
b3_invalid_xpointer.xml
[Fatal Error] a3.xml:1:1: Recursive include detected.  Document 
'file:///usr/local/src/xerces_2.12.2/xerces-2_12_2/a3.xml' was already 
processed.
[Fatal Error] a3.xml:11:53: Error attempting to parse XML file (href='a3.xml', 
xpointer='t1000').
[Fatal Error] b3_invalid_xpointer.xml:11:49: Error attempting to parse XML file 
(href='a3.xml', xpointer='BOGUS').
jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 ${noformat}

> XInclude error output to include xpointer values
> ------------------------------------------------
>
>                 Key: XERCESJ-1750
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1750
>             Project: Xerces2-J
>          Issue Type: Wish
>          Components: XInclude 1.0
>    Affects Versions: 2.12.2
>            Reporter: John Poole
>            Priority: Minor
>              Labels: XInclude
>
> Currently error output on failure of a resolution of an XIncludes only 
> provides the file, i.e. *href* value. It would be extremely helpful to have 
> the *xpointer* value bubble up in the error output so one would see both 
> *href* and *xpointer* values. For example, I have file A referencing file B 
> with many XIncludes pointing to different nodes and some resolve, and other 
> purportedly fail. Having the XMLParseError message include the *xpointer* 
> value would help debug problems, especially when some value resolve and 
> others fails. (And no, the target values are in the referenced file, I just 
> do not know at this time why there are some failures and successes and when 
> dealing with hundreds of files with thousands of XIncludes, it is a struggle 
> to segregate the failures.)
> I've been using Syncro Soft's Oxygen Author and made an enhancement request 
> and was told Author simply takes what Xerces gives it as an error message. So 
> here I am requesting Xerces provide one critical bit of information in the 
> error message.
> To that end I have suggested two modification, each only one line of 
> modification:
> {noformat}
> jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ diff 
> src/org/apache/xerces/impl/msg/XIncludeMessages.properties 
> ../xerces-2_12_2_work/src/org/apache/xerces/impl/msg/XIncludeMessages.properties
> 37c37
> < XMLParseError = Error attempting to parse XML file (href=''{0}'').
> ---
> > XMLParseError = Error attempting to parse XML file (href=''{0}'', 
> > xpointer=''{1}'').
> jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $ diff 
> src/org/apache/xerces/xinclude/XIncludeHandler.java 
> ../xerces-2_12_2_work/src/org/apache/xerces/xinclude/XIncludeHandler.java
> 1725c1725
> <                 reportFatalError("XMLParseError", new Object[] { href });
> ---
> >                 reportFatalError("XMLParseError", new Object[] { href, 
> > xpointer });
> jlpoole@ares /usr/local/src/xerces_2.12.2/xerces-2_12_2 $
> {noformat}
> I did some preliminary tests to see if the modifications above might break 
> something in conditions where 1) no xpointer is present, 2) xpointer = "", 
> and 3) xpointer is invalid, e.g. xpointer="TODO:FIXME".  And the results 
> looked encourage, but I thought I'd take it to this point and let someone 
> familiar with the code consider these possible modifications.



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

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

Reply via email to