fix: preserve whitespace in XML text content - #198
Open
sueun-dev wants to merge 1 commit into
Open
Conversation
Signed-off-by: Sueun Cho <sueun.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
from_xml()strips leading and trailing whitespace from properties mapped to the node text withxml_name('.'), before applying the configured XML string handling. For example, a normalized-string value of" hello "is read as"hello", and a value containing only spaces becomes empty. This also changesProperty.valuewhen roundtripping a BOM through CycloneDX Python Library's XML output.Remove the unconditional
strip()and let the configured string handler decide normalization.TOKENstill collapses whitespace; plain strings andNORMALIZED_STRINGretain surrounding spaces. The tests cover both affected types, whitespace-only text, and token/tab/plain-text controls.Checked on Python 3.12/Linux arm64:
52cb3c94f023df887ac65a6125bce4d63ab7857e: 6,984 tests pass with the patched dependency, plus 120 generated JSON/XML BOM roundtrips checking component fields and dependency edges.The other Python/OS CI combinations were not run locally. AI assistance: OpenAI Codex produced the investigation, patch, tests, and this description; no human review is claimed.