Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: capability for XML's token #115

Closed
jkowalleck opened this issue Jun 24, 2024 · 3 comments · Fixed by #119
Closed

feat: capability for XML's token #115

jkowalleck opened this issue Jun 24, 2024 · 3 comments · Fixed by #119
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jkowalleck
Copy link
Collaborator

Feature request

Implement a capability (decorator) to mark class properties as normalizedString for XML.
Only when this marker is set:

  • on serializing to XML: replace special characters by space ( ), and collapse all spaces afterward
  • on deserializing to XML: replace special characters by space ( ), and collapse all spaces afterward

why both? Because the values should not have been in the XML in the first place!
so they must not appear after reading, and they must not appear after writing.

Background

XSD http://www.w3.org/2001/XMLSchema - which defines token as follows:

<xs:simpleType name="token" id="token">
  <xs:annotation>
    <xs:documentation source="http://www.w3.org/TR/xmlschema-2/#token"/>
  </xs:annotation>
  <xs:restriction base="xs:normalizedString">
    <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
  </xs:restriction>
</xs:simpleType>

token represents tokenized strings. The ·value space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The ·lexical space· of token is the set of strings that do not contain the carriage return (#xD), line feed (#xA) nor tab (#x9) characters, that have no leading or trailing spaces (#x20) and that have no internal sequences of two or more spaces. The ·base type· of token is normalizedString.

@jkowalleck jkowalleck added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 24, 2024
@jkowalleck
Copy link
Collaborator Author

similar to #114

@jkowalleck
Copy link
Collaborator Author

solution as done in TS?JS CycloneDX/cyclonedx-javascript-library#1116

@jkowalleck
Copy link
Collaborator Author

i started working on this, via #119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant