You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running this code: https://gist.github.com/900680 on an XML file with 76 <row ... /> elements in it (and some starting and ending tags), the onEndDocument callback gets called several times. Interestingly, it gets called more times if I reduce the size of the chunks (and therefore increase the number of chunks) being pushed through the parser, but it's not called as many times as the number of chunks.
For example, here is a run with chunkSize=100:
Started parsing
Finished parsing with 2 entries, finished 1 times
Finished parsing with 9 entries, finished 2 times
Finished parsing with 13 entries, finished 3 times
Finished parsing with 22 entries, finished 4 times
Finished parsing with 28 entries, finished 5 times
Finished parsing with 42 entries, finished 6 times
Finished parsing with 47 entries, finished 7 times
Finished parsing with 50 entries, finished 8 times
Finished parsing with 56 entries, finished 9 times
Finished parsing with 59 entries, finished 10 times
Finished parsing with 64 entries, finished 11 times
Finished parsing with 76 entries, finished 12 times
Finished document element oxip
Finished parsing with 76 entries, finished 13 times
// ...
cb.onStartDocument(function() {
sys.puts("DOC-START");
});
cb.onEndDocument(function() {
sys.puts("DOC-END");
});
// ...
//example read from chunks
parser.parseString("<html><body>");
parser.parseString("<!-- This is the start");
parser.parseString(" and the end of a comment -->");
parser.parseString("and lots");
parser.parseString("and lots of text&am");
parser.parseString("p;some more.");
parser.parseString("<![CD");
parser.parseString("ATA[ this is");
parser.parseString(" cdata ]]>");
parser.parseString("</body");
parser.parseString("></html>");
Outputs:
DOC-START
=> Started: html uri=null (Attributes: [] )
=> Started: body uri=null (Attributes: [] )
DOC-END
<COMMENT> This is the start and the end of a comment </COMMENT>
DOC-END
DOC-END
DOC-END
<CDATA> this is cdata </CDATA>
DOC-END
<= End: body uri=null
<= End: html uri=null
When parsing an entire file at once:
//example read from file
parser.parseFile("sample.xml");
When running this code: https://gist.github.com/900680 on an XML file with 76 <row ... /> elements in it (and some starting and ending tags), the onEndDocument callback gets called several times. Interestingly, it gets called more times if I reduce the size of the chunks (and therefore increase the number of chunks) being pushed through the parser, but it's not called as many times as the number of chunks.
For example, here is a run with chunkSize=100:
Here is a sample of mkttmpl.xml:
In my file, there are 76 tags, all between a single tag.
The text was updated successfully, but these errors were encountered: