Skip to content

Add a closing tag flag for XML output #748

Closed

Description

@derily

when JSONObject value is empty string,i need XML.toString output <name></name> not <name/>

Activity

  1. stleary commented on Jun 16, 2023

    @stleary
    Owner

    @derily Can you provide a sample input and the output that you want to get?

  2. derily commented on Jun 20, 2023

    @derily
    Author

    @derily Can you provide a sample input and the output that you want to get?

    input(JSONObject):
    { "name":"derily", "job":"" }
    output:
    <name>derily</name> <job/>
    expect(just not use self closing tag syntax):
    <name>derily</name> <job></job>

  3. stleary commented on Jun 23, 2023

    @stleary
    Owner

    @derily It might be possible to accommodate this with an XMLParserConfiguration option. If no one else picks this up, I will try to get something working this weekend.

  4. madhavgupta2011 commented on Jul 10, 2023

    @madhavgupta2011

    Hi, Can I take this up? I'm thinking of adding one more boolean parameter in toString() method of XML class and handle the string builder append as per the boolean parameter. Please let me know if this solution can be improved. I'm willing to take up on this issue.

  5. stleary commented on Jul 10, 2023

    @stleary
    Owner

    @madhavgupta2011 Thanks, yes you can work on this ticket - FYI you don't need to ask first. Please check whether you can use XMLParserConfiguration to trigger the new behavior.

  6. madhavgupta2011 commented on Jul 10, 2023

    @madhavgupta2011

    @stleary I have opened a pull request with my changes and added two unit test cases as well.
    Can you please review it?
    Link to PR

    I couldn't get my head around XMLParserConfiguration so I used the appropriate changes.

  7. stleary commented on Oct 1, 2023

    @stleary
    Owner

    Fix in progress - #754.

  8. stleary commented on Oct 5, 2023

    @stleary
    Owner

    Re-opening since the PR was not accepted

  9. reopened this on Oct 5, 2023
  10. changed the title [-]when transform json to xml ,i need control whether use self closing tag[/-] [+]Add a closing tag flag for XML output[/+] on Oct 5, 2023
  11. stleary commented on Oct 5, 2023

    @stleary
    Owner

    Please use XMLParserConfiguration for the implementation.

  12. added 2 commits that reference this issue on Oct 5, 2023
    fa49d83
    9989af8
  13. stleary commented on Oct 5, 2023

    @stleary
    Owner

    See comments in your repo.

  14. rudrajyotib commented on Oct 23, 2023

    @rudrajyotib
    Contributor

    @stleary - is this issue still open to be picked?

  15. rudrajyotib commented on Oct 24, 2023

    @rudrajyotib
    Contributor

    @stleary - if no one else is working on it, can you assign it to my name?

  16. stleary commented on Oct 24, 2023

    @stleary
    Owner

    @rudrajyotib You can work on this issue. The new behavior should be opt-in, by adding a new property to XMLParserConfiguration.

  17. rudrajyotib commented on Oct 24, 2023

    @rudrajyotib
    Contributor

    @stleary sure, I'll start working on it and share the design.

  18. rudrajyotib commented on Oct 25, 2023

    @rudrajyotib
    Contributor

    @stleary @johnjaylward - I am creating a configuration "explicitClosureOfEmptyTag" in XMLParserConfiguration. By default this value will be false, and an explicit end tag will not be created for tag with empty values.
    Do you see any issue with the name?

  19. stleary commented on Oct 25, 2023

    @stleary
    Owner

    @rudrajyotib Please use closeEmptyTag or something similar with fewer chars.

  20. added 3 commits that reference this issue on Oct 25, 2023
  21. stleary commented on Oct 28, 2023

    @stleary
    Owner

    Closing due to fixed in #820

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions