There is 1 update, 1 comment.
 
 
XWiki Commons / cid:jira-generated-image-avatar-6917d0e1-51b9-4f5f-9255-9783678883b4 XCOMMONS-2175 Open

Get rid of Xerces dependency

 
View issue   ยท   Add comment
 

1 update

 
cid:jira-generated-image-avatar-7fa380b4-5132-4930-9ca5-c46ffb25165f Changes by Thomas Mortagne on 13/Nov/26 20:33
 
Status: In Progress Open
 
 

1 comment

 
cid:jira-generated-image-avatar-7fa380b4-5132-4930-9ca5-c46ffb25165f Thomas Mortagne on 13/Nov/26 20:33
 

New attempt (2026-11-13), the work was pushed on the same branches, replacing the old ones (rebased on master, Xerces fully removed):

Still blocked: the XML parser of the JDK still corrupts some content, which is what XCOMMONS-1373 was about. FormatMojoTest#formatSpecialContentFailingWithXercesFromJDK8 fails without Xerces, and it's reproduced with the JDK parser alone (plain SAX and DOM, no dom4j involved) on Java 21.0.13 and 25.0.5: parsing the test resource XWikiSyntaxLinks.it.xml returns a <content> text in which part of the line containing ]]>>Space1.Page1 is duplicated (the line "Link ad un'immagine con parametri" appears 3 times instead of 2). Xerces 2.12.2 parses the same file correctly. This affects any XML parsed by XWiki (XAR import, filter streams, etc.), not only the XAR format mojo. No matching open OpenJDK bug found so far (the closest are the old buffer border issues JDK-8034087, JDK-8059327, JDK-8061550).

Other findings:

  • Performance: without Xerces there is no DTD grammar caching anymore, so each XHTML document with a DOCTYPE (XHTML parser: HTML macro, WYSIWYG conversions, etc.) reparses the XHTML DTD. Measured on a small XHTML document: Xerces with grammar cache ~0.92ms, Xerces without cache ~1.44ms, JDK parser ~1.5ms (~0.015ms when the external DTD is not loaded), so about +0.5ms per XHTML document whatever its size. Considered acceptable.
  • XML bomb and XXE protections still work with the JDK parser (only the error message and the serialization quotes change in XMLUtilsTest).
  • DefaultXMLReaderFactory must enable namespace awareness explicitly on the JAXP factory to keep the SAX2 defaults Xerces was using.