Enable command-line argument for pretty printing XML output (#268)
Committer Notes
Fixes #268
This PR introduces a new command-line argument to enable pretty-printed XML output in the CLI tool.
Key Enhancements:
- ✅ Added a
--pretty-printCLI flag to toggle formatted XML output. - ✅ Integrated pretty-printing logic in the XML transformer flow.
- ✅ Replaced
FileOutputStreamwithFiles.newOutputStream(...)for PMD compliance. - ✅ Added unit tests verifying formatted vs non-formatted output.
- ✅ Verified behavior remains unchanged when the flag is not used.
Additional Notes:
- This is my first contribution to this project. Kindly review and consider accepting this PR. I would be honored to be recognized as a contributor to OSCAL CLI.
Submission Checklist:
- [x] Correct base branch selected.
- [x] Maintainers allowed to edit the PR.
- [x] Verified no conflicting open PRs.
- [x] Squashed non-relevant commits.
- [ ] All CI/CD checks passed.
Core Feature Checklist:
- [x] Explained what the change does and why.
- [x] Added relevant unit tests.
- [x] Updated help text or usage documentation.
@ermahesh - Thank you for your contributions. We will review the code and test the functionality.
@selenaxiao-nist @iMichaela : I see the build fails for a different reason , Should we fixing that as part of this PR ?
@ermahesh
- It appears that your
pom.xmlfile is not the one we have in thedevelopbranch, but rather the one from themainbranch.XMLresolverversion is defines in pom.xml - Build and test actions will continue to fail due to Sonatype Maven changes. The team will test locally the proposed changes, and temporary remove all Maven pre-release tests.
@selenaxiao-nist @iMichaela : I see the build fails for a different reason , Should we fixing that as part of this PR ?
Ideally - yes. Due to more recent policy on open-source, we might, for now, just temporarily remove the Maven release, and include guidance for users to build locally the liboscal-java and oscal-cli using the latest OSCAL release.
@iMichaela What can I do to ensure this code is merged ?
@iMichaela What can I do to ensure this code is merged ?
The PR cannot be merged as long as the tests performed by the CI/CD pipeline are not passing and the locally generated oscal-cli is tested. So far, the CI/CD pipeline has plenty of error which @selenaxiao-nist reproduced locally too when she tried to build the tool locally (without code release tests). She can provide more updates. You can work with her directly if you believe your code is not generating any errors when you build it locally. I am suggesting a v-meeting - please send an email to [email protected] to connect with our team.
@ermahesh Please change PrettyPrinter class to use SaxonTransformerFactory. Refer to XMLOperations class I made this change
@ermahesh Please change PrettyPrinter class to use SaxonTransformerFactory. Refer to XMLOperations class I made this change
Are you able to build this locally with no errors? Do your unit tests pass?
It appears that pretty printing only works for profile resolution. Is there a reason that the feature was only implemented in that code path, or am I misreading the PR?
It appears that pretty printing only works for profile resolution. Is there a reason that the feature was only implemented in that code path, or am I misreading the PR?
@rsherwood-nist This is my first contribution to the project — could you please help me understand if this fix needs to be applied in other parts of the codebase as well.