Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 5, 2025

Summary

Modernizes the XDoc generator to use the Doxia Sink API instead of manually generating XDoc XML with XMLWriter, aligning with the approach used in other Maven plugins (similar to MPLUGIN-442).

Changes

Core Migration

  • Replaced XMLWriter and PrettyPrintXMLWriter with Doxia Sink API throughout XdocGenerator
  • Updated all document generation methods to use Sink's semantic methods (head(), body(), section1(), table(), etc.) instead of manual XML element writing
  • Removed dependency on plexus-utils XMLWriter classes
  • Added dependencies on doxia-sink-api and doxia-module-xdoc (version 2.0.0)

Output Format Upgrade

The generator now produces XDoc 2.0 format instead of XDoc 1.0:

  • Modern XML namespace declarations (xmlns="http://maven.apache.org/XDOC/2.0")
  • Uses <a id="..."> instead of <a name="..."> for anchors (XDoc 2.0 standard)
  • Maintains semantic equivalence with previous output

Technical Details

  • Implemented workaround for a Doxia Sink API issue where table() doesn't output the opening <table> tag - uses rawText() to inject tags manually
  • Updated test infrastructure to accept both XDoc 1.0 and 2.0 anchor formats for backward compatibility checking
  • Updated expected test output to match XDoc 2.0 format

Benefits

  • Modernization: Uses the standard Doxia API instead of legacy manual XML generation
  • Maintainability: Aligns with Maven ecosystem best practices
  • Future-proof: Leverages actively maintained Doxia framework for site documentation

Testing

All existing tests pass with updated expectations:

  • testXdocGenerator - validates generated structure and internal links
  • testHtmlToXml - validates HTML to XDoc conversion

Fixes #123

Original prompt

This section details on the original issue you should resolve

<issue_title>Generate site document via Doxia Sink API</issue_title>
<issue_description>Similar to https://issues.apache.org/jira/browse/MPLUGIN-442 the Site document should be generated with the help of the Doxia Sink API instead of using the (legacy) intermediate XDoc format.

</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #511

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits October 5, 2025 17:53
…in place

Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
…tput

Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Generate site document via Doxia Sink API Migrate XDoc generator from XMLWriter to Doxia Sink API Oct 5, 2025
@Copilot Copilot AI requested a review from slachiewicz October 5, 2025 18:02
Copilot finished work on behalf of slachiewicz October 5, 2025 18:02
@slachiewicz slachiewicz marked this pull request as ready for review October 5, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate site document via Doxia Sink API
2 participants