Skip to content

Conversation

@badpirogrammer2
Copy link

  1. Core Implementation Complete: Full functionality for converting XML documents to TOON format is implemented.

  2. New API Methods: Extended the main JToon.java class with new static methods for encoding:

    encodeXml(String xml) (Basic conversion)

    encodeXml(String xml, EncodeOptions options) (Conversion with custom options)

  3. Dedicated Normalizer: Created XmlNormalizer.java to handle XML parsing using Jackson's XmlMapper and convert it to an intermediate JsonNode object.

  4. Dependency Integration: Integrated the jackson-dataformat-xml dependency for robust XML parsing capabilities.

  5. Comprehensive Structure Support: The conversion successfully handles:

    Simple and nested XML elements (converted to TOON objects).

    XML attributes (included as additional TOON fields).

    XML arrays (converted to TOON arrays).

    Preserves element hierarchy and ordering.

  6. Full Options Support: The new methods support existing EncodeOptions for:

    Custom indentation levels.

    Different delimiters (comma, pipe, tab).

    Length markers for arrays.

  7. Robust Error Handling: Implemented checks to throw an IllegalArgumentException for:

    Null or empty XML strings.

    Malformed XML documents.

    Invalid XML structure.

  8. Extensive Testing:

    449 total tests are passing (BUILD SUCCESSFUL).

    Tests cover positive scenarios, negative/error handling, and complex edge cases (nested structures, attributes).

  9. Documentation: Added comprehensive JavaDoc documentation with clear signatures and usage examples.

Core Implementation Complete: Full functionality for converting XML documents to TOON format is implemented.

New API Methods: Extended the main JToon.java class with new static methods for encoding:

encodeXml(String xml) (Basic conversion)

encodeXml(String xml, EncodeOptions options) (Conversion with custom options)

Dedicated Normalizer: Created XmlNormalizer.java to handle XML parsing using Jackson's XmlMapper and convert it to an intermediate JsonNode object.

Dependency Integration: Integrated the jackson-dataformat-xml dependency for robust XML parsing capabilities.

Comprehensive Structure Support: The conversion successfully handles:

Simple and nested XML elements (converted to TOON objects).

XML attributes (included as additional TOON fields).

XML arrays (converted to TOON arrays).

Preserves element hierarchy and ordering.

Full Options Support: The new methods support existing EncodeOptions for:

Custom indentation levels.

Different delimiters (comma, pipe, tab).

Length markers for arrays.

Robust Error Handling: Implemented checks to throw an IllegalArgumentException for:

Null or empty XML strings.

Malformed XML documents.

Invalid XML structure.

Extensive Testing:

449 total tests are passing (BUILD SUCCESSFUL).

Tests cover positive scenarios, negative/error handling, and complex edge cases (nested structures, attributes).

Documentation: Added comprehensive JavaDoc documentation with clear signatures and usage examples.
@badpirogrammer2
Copy link
Author

@felipestanzani Please review and let me know if there are any more changes needed for different types.

Have a great day !!

build.gradle Outdated
dependencies {
implementation 'tools.jackson.core:jackson-databind:3.0.2'
implementation 'tools.jackson.module:jackson-module-afterburner:3.0.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.18.2'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the project standards. If we are currently using a library version, be sure to use the same version.

Copy link
Collaborator

@felipestanzani felipestanzani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of your changes will not be approved this way. This project follows standards that must be respected. To get the PR approved:

  • Remove the loose files.
  • Don't mess with the existing Unit Tests.
  • Create extensive unit tests for the classes you have created, using the same standards as the existing ones.
  • Don't mess with the Java version.
  • Use the same version of the libraries already used.
  • If you are adding new features to the library, make sure to document these features in README.md.

I really appreciate your effort to contribute. Read the comments and implement the requested changes.

build.gradle Outdated
dependencies {
implementation 'tools.jackson.core:jackson-databind:3.0.2'
implementation 'tools.jackson.module:jackson-module-afterburner:3.0.2'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.18.2'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the project standards. If we are currently using a library version, be sure to use the same version.

@badpirogrammer2
Copy link
Author

@felipestanzani requested changes have been completed.

@felipestanzani
Copy link
Collaborator

The project is serious and require following standards.

The idea of converting XML to toon can be good but you didn't changed all the things I asked for.

@badpirogrammer2
Copy link
Author

@felipestanzani please let me know what is missing exept the readme?

@felipestanzani
Copy link
Collaborator

Not only the README but consistent test cases. When you manage to add a new feature to a project you must observe the current implement ones and try to follow the same standards.

And: Toon is intended to pass data to LLMs. I don't see a real scenario where would be needed to convert XML to toon. What is the real case where it would be used?

@badpirogrammer2
Copy link
Author

badpirogrammer2 commented Nov 11, 2025

Why should we just limit it to LLM and reducing tokens? can think of n number of cases where TOON could be used for example reducing the size of packets, so that the latency can be reduced, processing could be fast. There are N number of factors I could think of if someone wants to implement TOON in their projects, what about the old projects old spring projects, if we take a dig at them and if we want to send that data to LLM's then do they have to convert to XML-->JSON-->TOON ? there wouldn't be a lot but there would atleast be few use cases, for which people have to write another library and its cumbersome.

@felipestanzani
Copy link
Collaborator

You changed Java version to 21 in your commits.

You don't have to parse anything to Json before converting to TOON, JToon can parse POJOs to TOON like a charm. Converting from Json String to TOON in this library is more a convenience for executing the conformance tests than for real life scenarios.

It is not about limiting the usage of TOON, but for simple API data exchange there is no real advantage in using it.

It is necessary to evaluate if it something that worth letting in or if is only a feature that will no be used. If you said that yourself would need it, I would try to understand your case, but you could not bring me a convincing real case.

If you real think this is an important feature, open a discussion poll.

@badpirogrammer2
Copy link
Author

opened with below points in discussion, Thanks for guiding!! Have a great day!!

Legacy System Integration: Converting XML APIs or data feeds from older systems to TOON for efficient LLM processing
Configuration Files: Transforming XML configuration files to TOON format for AI-assisted configuration analysis
Data Exchange: Converting XML data exchange formats to TOON for reduced token usage in AI conversations
Log Analysis: Processing XML-formatted logs and converting them to TOON for AI-powered log analysis
Web Services: Converting SOAP XML responses or REST XML payloads to TOON for AI interpretation

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.

3 participants