-
-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
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?
Description
For mentioned valid input, parser doesn't parse data correctly. As can be seen in the output, an extra node named <-- is introduced for comment.
I understand that adding space before and after comment (<!-- >> ISO DICTIONARY TYPES << -->) solves the issue but, wanted to know if there is any issue in understanding such comments by parser. Also XML is suggested valid in online tool.
Input
<xsd:element name="AccountHolderDetails">
<xsd:complexType>
<xsd:sequence>
<!-->> ISO DICTIONARY TYPES <<-->
<xsd:element minOccurs="0" name="address" nillable="true" type="Address" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
Code
const fastXMLParser = require('fast-xml-parser'),
options = {
ignoreAttributes: false,
ignoreNameSpace: false,
parseNodeValue: true,
trimValues: true
};
const parsed = fastXMLParser.parse(xmlDocument, options);Output
{
"xsd:element": {
"@_name": "AccountHolderDetails",
"xsd:complexType": {
"xsd:sequence": {
"#text": "> ISO DICTIONARY TYPES",
"<--": {
"xsd:element": {
"@_minOccurs": "0",
"@_name": "address",
"@_nillable": "true",
"@_type": "Address"
}
}
}
}
}
}
expected data
{
"xsd:element": {
"@_name": "AccountHolderDetails",
"xsd:complexType": {
"xsd:sequence": {
"xsd:element": {
"@_minOccurs": "0",
"@_name": "address",
"@_nillable": "true",
"@_type": "Address"
}
}
}
}
}
Would you like to work on this issue?
- Yes
- No
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels