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

comments stops parsing text string in default case #13

Open
jmgnc opened this issue Feb 8, 2018 · 1 comment
Open

comments stops parsing text string in default case #13

jmgnc opened this issue Feb 8, 2018 · 1 comment

Comments

@jmgnc
Copy link

jmgnc commented Feb 8, 2018

If you use the following input:

<root>\"
<!-- &#x8; -->
<!-- &#xc; -->
&#xd;
&#x9;
</root>

and run the following:

java -cp lib/saxon/saxon9.jar net.sf.saxon.Transform t.xml conf/xml-to-json.xsl

You'll get:

{
    "root": [
        "\\\"\n",
        {
            "": null
        },
        {
            "": null
        }
    ]
}

where as if you move the comments to after the character entities, you'll get:

    "root": [
        "\\\"\n\r\n\t\n",
        {
            "": null
        },
        {
            "": null
        }
    ]
}

With the CR and HT both properly in the output.

@javadev
Copy link

javadev commented Jul 2, 2021

It may be converted to this JSON

{
  "root": {
    "#text": "\\\"\n",
    "#comment": " &#x8; ",
    "#comment1": " &#xc; "
  },
  "#omit-xml-declaration": "yes"
}

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

No branches or pull requests

2 participants