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

No way to detect incomplete document #21

Open
JasonWoof opened this issue Oct 6, 2011 · 1 comment
Open

No way to detect incomplete document #21

JasonWoof opened this issue Oct 6, 2011 · 1 comment

Comments

@JasonWoof
Copy link

There doesn't seem to be any way to specify that parseString() will not be called again (end of input.)

Thus there seems to be no way to detect an incomplete document. I'm getting xml over http, and I don't want my app to hang forever waiting for xml parsing if I get an incomplete document over http.

When I remove the last parseString call from example.js it does call endDocument at the end, but it also calls it 4 other times, so it's unusable.

Here's what I want: a second parameter to parseString (boolean) that says whether this is the final hunk or not.

If I specify that it's the final hunk, the onError event will fire if the document hasn't closed all the nodes or whatever.

Thanks!

@JasonWoof
Copy link
Author

Note that if I concatenate all the parseString() args in example.js and call parseString() once like this:

parser.parseString("<html><body>"
+ "<!-- This is the start"
+ " and the end of a comment -->"
+ "and lots"
+ "and lots of text&am"
+ "p;some more."
+ "<![CD"
+ "ATA[ this is"
+ " cdata ]]>"
+ "</body"
+ "></html>"
);

But if you comment out the ></html> line, no endDocument or Error or anything fires.

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

1 participant