-
-
Notifications
You must be signed in to change notification settings - Fork 328
Open
Description
- 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?
- Have you checked the docs for helpful APIs and examples?
Description
When using the for loop, there is an issue with parsing
Input
<script> function test() { for (let i = 0; i < 100000; i++) { console.log(i) } } </script>Code
const { XMLParser, XMLBuilder } = require('fast-xml-parser')
const fs = require('fs')
const _XMLParser = new XMLParser({ ignoreAttributes: false })
const _builder = new XMLBuilder({
ignoreAttributes: false,
processEntities: false,
format: true,
})
/**
*
- @param {string} filePath
- @returns jsonObj xmlObject
/
const xmlCodeToAST = filePath => {
const fileContent = fs.readFileSync(filePath, 'utf8')
return _XMLParser.parse(fileContent)
}
/* - @param {Object} xmlObj
- @returns xmlString
*/
const astToXmlCode = xmlObj => {
return _builder.build(xmlObj)
}
const ast = xmlCodeToAST('./test.mpx')
console.log(ast, 'ast')
const xml = astToXmlCode(ast)
console.log(xml, 'xml')
Output
{
script: { '': '', '#text': 'function test() {\n for (let i = 0; i' }
} ast
xml
expected data
Would you like to work on this issue?
- Yes
- No
Bookmark this repository for further updates. Visit SoloThought to know about recent features.
Metadata
Metadata
Assignees
Labels
No labels