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

Don't treat XML declarations as Processing Instructions #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Holzhaus
Copy link

XML declarations are not processing instructions.
This fixes #174.

According to XML 1.0 (5th Edition), Section 2.6, the PI target names "xml",
"XML" and so on are reserved.

Production Rule 17 states:

PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

sax.js Outdated
@@ -549,10 +549,11 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
function parseInstruction(source,start,domBuilder){
var end = source.indexOf('?>',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*$/);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is another fix that slipped in: The target name of a PI mustn't be empty.

The XML declaration is not a processing instruction.

According to XML 1.0 (5th Edition), Section 2.6, the PI target names "xml",
"XML" and so on are reserved.

Production Rule 17 states:
> PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

This fixes jindw#174.
@CodyReichert
Copy link

Just hit this myself.

Anything I can do to help get this one merged? The test cases look correct, but let me know if I can help get it ready for release.

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

Successfully merging this pull request may close these issues.

XML Declaration is not a Processing Instruction
2 participants