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

Some character reference formats not parsed correctly #568

Open
5 tasks done
Pharb opened this issue May 2, 2023 · 1 comment · May be fixed by #569
Open
5 tasks done

Some character reference formats not parsed correctly #568

Pharb opened this issue May 2, 2023 · 1 comment · May be fixed by #569

Comments

@Pharb
Copy link

Pharb commented May 2, 2023

  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

Description

According to this XML spec, character references can include leading zeros and lower-case letters in hexadecimal representation.

Personally I encountered this parsing issue by consuming XML provided by a proprietary third-party tool, which includes references in the style of <.

Input

<?xml version="1.0"?>
<tests>
  <test>&lt;</test>
  <test>&#60;</test>
  <test>&#060;</test>
  <test>&#0060;</test>
  <test>&#x3C;</test>
  <test>&#x03C;</test>
  <test>&#x003C;</test>
  <test>&#x3c;</test>
  <test>&#x03c;</test>
  <test>&#x003c;</test>
</tests>

Code

const parser = new XMLParser();
let result = parser.parse(xmlData, true);

Output

{
    "?xml": "",
    "tests": {
        "test": [
            "<",
            "<",
            "&#060;",
            "&#0060;",
            "<",
            "&#x03C;",
            "&#x003C;",
            "&#x3c;",
            "&#x03c;",
            "&#x003c;"
        ]
    }
}

expected data

{
    "?xml": "",
    "tests": {
        "test": [
            "<",
            "<",
            "<",
            "<",
            "<",
            "<",
            "<",
            "<",
            "<",
            "<",
        ]
    }
}

Would you like to work on this issue?

  • Yes

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

@github-actions
Copy link

github-actions bot commented May 2, 2023

We're glad you find this project helpful. We'll try to address this issue ASAP. You can vist https://solothought.com to know recent features. Don't forget to star this repo.

Pharb added a commit to Pharb/fast-xml-parser that referenced this issue May 2, 2023
Ignore leading zeros and case-insensitive hexadecimal characters.
Fixes: NaturalIntelligence#568
@Pharb Pharb linked a pull request May 2, 2023 that will close this issue
3 tasks
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 a pull request may close this issue.

1 participant