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

Failure to recognize xml attributes without whitespace (but with line breaks) #350

Closed
5 of 6 tasks
ttu-ttu opened this issue Jun 26, 2021 · 5 comments
Closed
5 of 6 tasks
Labels
Feature-Request New features suggested by users

Comments

@ttu-ttu
Copy link

ttu-ttu commented Jun 26, 2021

  • 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

fast-xml-parser does not treat attributes separated by (only) line breaks as attributes.

Input

<?xml version="1.0"?>
<abc
attrA="2"
>
value
</abc>

Code

parser.parse(`<?xml version="1.0"?>
<abc
attrA="2"
>
value
</abc>`, {
  ignoreAttributes: false,
});

Output

{
    "abc\nattrA=\"2\"\n": "value"
}

expected data

{
    "abc": {
        "#text": "value",
        "@_attrA": "2"
    }
}

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates.

@github-actions
Copy link

I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.

@amitguptagwl
Copy link
Member

You should have a space more than a \n between tag name and attribute to make it work. I don't see that case here. Please confirm.

@ttu-ttu
Copy link
Author

ttu-ttu commented Jun 26, 2021

Yeah the point of this issue is to point out that the parser doesn't support attributes that are separated using line breaks (as in it'll treat it as part of the tag)
e.g. <?xml version="1.0"?><abc\nattrA="2"\n>value</abc>

Which seem to work differently from some other parsers which accepts line breaks as a way of separation (tested on Java's XML parser, and some IDE's syntax highlights like IntelliJ and Visual Studio Code)

I personally am not sure if it's part of the specification to support this format, or those parsers are just being lenient about it.

Also, the above code is a simplified XML of what users may upload to my site, so technically I would have to manually fix their XML (or reject it), if it's formatted this way

@amitguptagwl
Copy link
Member

Thanks. @ttu-ttu . We can probably consider it as a feature request this time. and check later if this is really needed.

@amitguptagwl amitguptagwl added the Feature-Request New features suggested by users label Jun 27, 2021
@amitguptagwl
Copy link
Member

done in v4

yelly added a commit to yelly/salto that referenced this issue Jun 16, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 16, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 16, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 16, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 18, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 20, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to yelly/salto that referenced this issue Jun 23, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Also had to copy some code from the SF E2E utils to the UT utils to get the linter to stop complaining about the TS scope.
yelly added a commit to salto-io/salto that referenced this issue Jun 23, 2024
This is a major which required a bunch of changes. The reason for the bump is the fix for NaturalIntelligence/fast-xml-parser#350 which solves the bug, but there are also a lot of additional bugfixes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature-Request New features suggested by users
Projects
None yet
Development

No branches or pull requests

2 participants