question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline tag missed order and position

See original GitHub issue

Checklist

  • Have you asked your question on Stackoverflow or similar forum?
  • 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?

Input

Issue is inline tag in text will missed position and trim all spaces

Code

const xml = require('fast-xml-parser');

const data = '<p>Test string <emphasis> test</emphasis> second part of test string</p>'

const options = {
    ignoreAttributes: false
}

const result = xml.parse(data, options);

Output

{
  "p": {
    "#text": "Test stringsecond part of test string",
    "emphasis": "test"
  }
}

expected data

But it should keep “Array order”

{
  "p": [
    "Test string",
    { "emphasis": "test" },
    "second part of test string"
  ]
}

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
amitguptagwlcommented, Jul 27, 2019

This is not a bug but expected behavior. However, if you need to maintain the order as per your example, we can provide some property to do that.

0reactions
amitguptagwlcommented, Nov 17, 2021

check preserveOrder option with FXPv4 and let us know if it fulfill your purpose. Create a new issue if it doesn’t

Read more comments on GitHub >

github_iconTop Results From Across the Web

css - Is it possible to change order of inline elements without ...
Is it possible to change order of inline elements without changing HTML? · is the text always the same for the red part?...
Read more >
Inline elements - HTML: HyperText Markup Language | MDN
Inline elements are those which only occupy the space bounded by the tags defining the element, instead of breaking the flow of the...
Read more >
Insert, Remove, or Move Tags and Placeholders
Represents inline HTML in source content. Tags do not need to be translated, simply inserted into the correct place within the target. By...
Read more >
'script' tag, which is missing - WordPress.org
Hello,. I have a problem with AMP pages after update do WP 5.8, plugin update and Newspaper theme update. I read in one...
Read more >
HTML 4 Document Type Definition - W3C
HTML has two basic content models: %inline; character level elements and text ... position in tabbing order -- onfocus %Script; #IMPLIED -- the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found