Fix for issue #83 #84

Closed
wants to merge 3 commits into
from

Projects

None yet

2 participants

@anttileppa

These changes fix the issue #83

Owner
jindw commented Apr 13, 2014

i can not accept your patch.
xmldom is for xml source parser.
ProcessingInstruction is a valid xml source node.

setting for sax-parser maybe a better idea.

Yes, ProcessingInstructions are valid xml but firstChild and lastChild properties should not be set to ProcessingInstructions, at least browsers behave this way.

See http://jsfiddle.net/ddH3R/

Owner
jindw commented Apr 13, 2014

a normal can not generate the ProcessingInstruction default.
you can try:

var doc = new DOMParser().parseFromString('', "text/xml");
var p = doc.createProcessingInstruction('xml',"version='1.0'")
doc.insertBefore(p,doc.firstChild)
console.log(new XMLSerializer().serializeToString(doc))
console.log(doc.firstChild)

Owner
jindw commented Apr 13, 2014

a normal can not generate the ProcessingInstruction default.
you can try:

var doc = new DOMParser().parseFromString('', "text/xml");
var p = doc.createProcessingInstruction('xml',"version='1.0'")
doc.insertBefore(p,doc.firstChild)
console.log(new XMLSerializer().serializeToString(doc))
console.log(doc.firstChild)

Interesting, so the problem is in the sax parser, not in the dom processing.

@anttileppa anttileppa closed this Apr 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment