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

(nodeSerializeToString) TypeError: Cannot read property 'prefix' of null #228

Open
aniltallam opened this issue Jan 23, 2018 · 5 comments
Open

Comments

@aniltallam
Copy link

aniltallam commented Jan 23, 2018

Following code is throwing error at line number 3

let xmlString = '<?xml version="1.0" encoding="utf-8"?>'
let doc = new Dom().parseFromString(xmlString)
let nXmlString = doc.toString()

Error details:

TypeError: Cannot read property 'prefix' of null
at Document.nodeSerializeToString [as toString] (E:\repos\temp\integrator-adaptor\node_modules\xmldom\dom.js:920:22)

@avral
Copy link

avral commented Apr 19, 2018

same error

@ash-lionell
Copy link

For me, this happens whenever I perform a delete operation using "removeChild". I want to update the dom as I process individual nodes. But this issue is preventing me from completing that solution.

@darlenya
Copy link

darlenya commented Dec 7, 2018

Got the same Error with:

const xmldom = require('xmldom')
const domParser = new xmldom.DOMParser()
const xmlSerializer = new xmldom.XMLSerializer()

let xmlString = '<?xml version="1.0" encoding="utf-8"?>'
let doc =  domParser.parseFromString(xmlString)
let nXmlString = xmlSerializer.serializeToString(doc)
console.log(nXmlString)

But when you change
<?xml version="1.0" encoding="utf-8"?>
to
<?xml version="1.0" encoding="utf-8"?><div/>

it will work

@amitguptagwl
Copy link

This project is not active anymore. You can try fast-xml-parser instead

@sntran
Copy link

sntran commented May 30, 2019

Possibly from #124 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants