We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi @amitguptagwl, i found the problem with the unpairedTags parameter. If i set ignoreAttributes to false the paramter unpairedTags is ignored.
const { XMLParser, XMLBuilder } = require('fast-xml-parser') const xmlData = ` <CommunicationLog xmlns="http://knx.org/xml/telegrams/01"> <Telegram Timestamp="2023-01-29T23:01:06.239Z" RawData="0640103020080ee"/> <Telegram Timestamp="2023-01-29T23:01:16.945Z" RawData="0640103020080aa"/> <Telegram Timestamp="2023-01-30T22:58:27.572Z" RawData="066040c02008067"/> <Telegram Timestamp="2023-01-30T22:58:27.606Z" RawData="066043402008067"/> </CommunicationLog>` const options = { format: true, ignoreAttributes: false, suppressUnpairedNode: false, unpairedTags: ['Telegram'] } const parser = new XMLParser(options) const result = parser.parse(xmlData) const builder = new XMLBuilder(options) const output = builder.build(result) console.log(output)
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01"> <Telegram Timestamp="2023-01-29T23:01:06.239Z" RawData="0640103020080ee"></Telegram> <Telegram Timestamp="2023-01-29T23:01:16.945Z" RawData="0640103020080aa"></Telegram> <Telegram Timestamp="2023-01-30T22:58:27.572Z" RawData="066040c02008067"></Telegram> <Telegram Timestamp="2023-01-30T22:58:27.606Z" RawData="066043402008067"></Telegram> </CommunicationLog>
<CommunicationLog xmlns="http://knx.org/xml/telegrams/01"> <Telegram Timestamp="2023-01-29T23:01:06.239Z" RawData="0640103020080ee"/> <Telegram Timestamp="2023-01-29T23:01:16.945Z" RawData="0640103020080aa"/> <Telegram Timestamp="2023-01-30T22:58:27.572Z" RawData="066040c02008067"/> <Telegram Timestamp="2023-01-30T22:58:27.606Z" RawData="066043402008067"/> </CommunicationLog>
Would you like to work on this issue?
Bookmark this repository for further updates.
The text was updated successfully, but these errors were encountered:
update tests for #540
b6ee2a5
fixed
Sorry, something went wrong.
No branches or pull requests
Description
Hi @amitguptagwl,
i found the problem with the unpairedTags parameter.
If i set ignoreAttributes to false the paramter unpairedTags is ignored.
Input
Code
Output
expected data
Would you like to work on this issue?
Bookmark this repository for further updates.
The text was updated successfully, but these errors were encountered: