diff --git a/sax.js b/sax.js index f8b494e..f1785a0 100644 --- a/sax.js +++ b/sax.js @@ -549,10 +549,11 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '',start); if(end){ - var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/); + var match = source.substring(start,end).match(/^<\?(\S+)\s*([\s\S]*?)\s*$/); if(match){ - var len = match[0].length; - domBuilder.processingInstruction(match[1], match[2]) ; + if(match[1].toLowerCase() !== 'xml'){//ignore XML declarations + domBuilder.processingInstruction(match[1], match[2]) ; + } return end+2; }else{//error return -1;