[Pharo-project] Prematurely ending document on purpose with the SAXParser
Since XML-Parser-JAAyer.50 the SAXDriver doesn't check anymore for #checkEOD in the #handle methods, have you removed eod iVar for performance reasons? I need it because I have a very large XML and I want to be able to parse some "header" nodes without parsing the entire XML. Otherwise, what would be the way of doing this with the newer versions? UserSAXParser>>endDocument "This call corresponds to the Java SAX call endDocument()." eod := true Cheers, Hernán
Just for the record, I have to install the previous version of XML-Parser-JAAyer.50 until I find some time to work on this. Cheers, Hernán 2011/11/15 Hernán Morales Durand <hernan.morales@gmail.com>:
Since XML-Parser-JAAyer.50 the SAXDriver doesn't check anymore for #checkEOD in the #handle methods, have you removed eod iVar for performance reasons? I need it because I have a very large XML and I want to be able to parse some "header" nodes without parsing the entire XML. Otherwise, what would be the way of doing this with the newer versions?
UserSAXParser>>endDocument     "This call corresponds to the Java SAX call endDocument()."     eod := true
Cheers,
Hernán
I wonder what to do in this kind of situations. See 1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package Any suggestion? Cheers Hernan 2011/11/17 Hernán Morales Durand <hernan.morales@gmail.com>:
Just for the record, I have to install the previous version of XML-Parser-JAAyer.50 until I find some time to work on this. Cheers,
Hernán
2011/11/15 Hernán Morales Durand <hernan.morales@gmail.com>:
Since XML-Parser-JAAyer.50 the SAXDriver doesn't check anymore for #checkEOD in the #handle methods, have you removed eod iVar for performance reasons? I need it because I have a very large XML and I want to be able to parse some "header" nodes without parsing the entire XML. Otherwise, what would be the way of doing this with the newer versions?
UserSAXParser>>endDocument     "This call corresponds to the Java SAX call endDocument()."     eod := true
Cheers,
Hernán
On 03 Jan 2012, at 13:31, Hernán Morales Durand wrote:
I wonder what to do in this kind of situations. See
1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package
Any suggestion?
Maybe you could try to reach someone from the administrators/developers directly, there are quite a few on SS. Sven
Am 03.01.2012 um 16:14 schrieb Sven Van Caekenberghe:
On 03 Jan 2012, at 13:31, Hernán Morales Durand wrote:
I wonder what to do in this kind of situations. See
1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package
Any suggestion?
Maybe you could try to reach someone from the administrators/developers directly, there are quite a few on SS.
I'm one of those listed. But jaayer is the developer of the XML package. He picked up Michaels implementation and extended it. So there is only one guy that can give an elaborate answer. Hernan, I don't really understand your problem. It sounds like you need to mess with the method checkEOD in order to get your use case done. While the real problem is that SAX is about to read the whole file at once. And while this is inappropriate for a lot of cases StAX/pull parsers have been implemented. So the real issue is that there is no StAX/pull parser in smalltalk (or at least in pharo). Norbert
2012/1/4 Norbert Hartl <norbert@hartl.name>:
Am 03.01.2012 um 16:14 schrieb Sven Van Caekenberghe:
On 03 Jan 2012, at 13:31, Hernán Morales Durand wrote:
I wonder what to do in this kind of situations. See
1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package
Any suggestion?
Maybe you could try to reach someone from the administrators/developers directly, there are quite a few on SS.
I'm one of those listed. But jaayer is the developer of the XML package. He picked up Michaels implementation and extended it. So there is only one guy that can give an elaborate answer. Hernan, I don't really understand your problem. It sounds like you need to mess with the method checkEOD in order to get your use case done. While the real problem is that SAX is about to read the whole file at once. And while this is inappropriate for a lot of cases StAX/pull parsers have been implemented. So the real issue is that there is no StAX/pull parser in smalltalk (or at least in pharo).
Norbert
Hi, Of course the ideal would be a using a full StAX implementation, or even better a vtd-xml one, that would really be a cool use case for attracting more developers into Smalltalk. As there is no specification of SAX we are in the consensus line. So while SAX is commonly and thought to be used as a read-all solution, there is some workaround to stop the reading in Java [*]. So yes, I've used a workaround for that case. Today I played with XMLPullParser (StAX) and after a few changes I could parse and stop parsing when a specific node is reached, example: | parser | parser := XMLPullParser parse: '<?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd"> <BlastOutput> <BlastOutput_program>blastn</BlastOutput_program> <BlastOutput_version>BLASTN 2.2.26+</BlastOutput_version> <BlastOutput_reference>Zheng Zhang, Scott Schwartz, Lukas Wagner, and Webb Miller (2000), "A greedy algorithm for aligning DNA sequences", J Comput Biol 2000; 7(1-2):203-14.</BlastOutput_reference> <BlastOutput_param> <Parameters> <Parameters_expect>10</Parameters_expect> <Parameters_sc-match>1</Parameters_sc-match> </Parameters> </BlastOutput_param> <BlastOutput_iterations>'. [ parser isStartTag: 'BlastOutput_param' ] whileFalse:[ Transcript show: parser text; cr. parser next ] I've sent the changes to Ken Treis so he can integrate them in XMLPullParser package. Cheers, Hernán http://www.ibm.com/developerworks/xml/library/x-tipsaxstop/ http://stackoverflow.com/questions/3405702/using-sax-to-parse-common-xml-ele... http://stackoverflow.com/questions/1345293/how-to-stop-parsing-xml-document-...
Is the XMLPulParser part of XMLSupport? Stef
I wonder what to do in this kind of situations. See
1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package
Any suggestion?
Maybe you could try to reach someone from the administrators/developers directly, there are quite a few on SS.
I'm one of those listed. But jaayer is the developer of the XML package. He picked up Michaels implementation and extended it. So there is only one guy that can give an elaborate answer. Hernan, I don't really understand your problem. It sounds like you need to mess with the method checkEOD in order to get your use case done. While the real problem is that SAX is about to read the whole file at once. And while this is inappropriate for a lot of cases StAX/pull parsers have been implemented. So the real issue is that there is no StAX/pull parser in smalltalk (or at least in pharo).
Norbert
Hi,
Of course the ideal would be a using a full StAX implementation, or even better a vtd-xml one, that would really be a cool use case for attracting more developers into Smalltalk. As there is no specification of SAX we are in the consensus line. So while SAX is commonly and thought to be used as a read-all solution, there is some workaround to stop the reading in Java [*]. So yes, I've used a workaround for that case. Today I played with XMLPullParser (StAX) and after a few changes I could parse and stop parsing when a specific node is reached, example:
| parser | parser := XMLPullParser parse: '<?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd"> <BlastOutput> <BlastOutput_program>blastn</BlastOutput_program> <BlastOutput_version>BLASTN 2.2.26+</BlastOutput_version> <BlastOutput_reference>Zheng Zhang, Scott Schwartz, Lukas Wagner, and Webb Miller (2000), "A greedy algorithm for aligning DNA sequences", J Comput Biol 2000; 7(1-2):203-14.</BlastOutput_reference> <BlastOutput_param> <Parameters> <Parameters_expect>10</Parameters_expect> <Parameters_sc-match>1</Parameters_sc-match> </Parameters> </BlastOutput_param> <BlastOutput_iterations>'. [ parser isStartTag: 'BlastOutput_param' ] whileFalse:[ Transcript show: parser text; cr. parser next ]
I've sent the changes to Ken Treis so he can integrate them in XMLPullParser package. Cheers,
Hernán
http://www.ibm.com/developerworks/xml/library/x-tipsaxstop/ http://stackoverflow.com/questions/3405702/using-sax-to-parse-common-xml-ele... http://stackoverflow.com/questions/1345293/how-to-stop-parsing-xml-document-...
No, it's a separate package http://www.squeaksource.com/XMLPullParser.html 2012/1/6 Stéphane Ducasse <stephane.ducasse@inria.fr>:
Is the XMLPulParser part of XMLSupport?
Stef
Am 06.01.2012 um 13:09 schrieb Stéphane Ducasse:
Is the XMLPulParser part of XMLSupport?
No, it is completely different. It is based on the old parser. I wanted to combine those two but didn't find the time to do it. Ken also did a pull parser based Sixx which would be worth to integrate. Would partially solve the resource consumption of Sixx. Norbert
Stef
I wonder what to do in this kind of situations. See
1) XML is one of the most important packages 2) There is no mailng-list for xml ? 3) Nobody replies and 4) You want latest updates from that package
Any suggestion?
Maybe you could try to reach someone from the administrators/developers directly, there are quite a few on SS.
I'm one of those listed. But jaayer is the developer of the XML package. He picked up Michaels implementation and extended it. So there is only one guy that can give an elaborate answer. Hernan, I don't really understand your problem. It sounds like you need to mess with the method checkEOD in order to get your use case done. While the real problem is that SAX is about to read the whole file at once. And while this is inappropriate for a lot of cases StAX/pull parsers have been implemented. So the real issue is that there is no StAX/pull parser in smalltalk (or at least in pharo).
Norbert
Hi,
Of course the ideal would be a using a full StAX implementation, or even better a vtd-xml one, that would really be a cool use case for attracting more developers into Smalltalk. As there is no specification of SAX we are in the consensus line. So while SAX is commonly and thought to be used as a read-all solution, there is some workaround to stop the reading in Java [*]. So yes, I've used a workaround for that case. Today I played with XMLPullParser (StAX) and after a few changes I could parse and stop parsing when a specific node is reached, example:
| parser | parser := XMLPullParser parse: '<?xml version="1.0"?> <!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd"> <BlastOutput> <BlastOutput_program>blastn</BlastOutput_program> <BlastOutput_version>BLASTN 2.2.26+</BlastOutput_version> <BlastOutput_reference>Zheng Zhang, Scott Schwartz, Lukas Wagner, and Webb Miller (2000), "A greedy algorithm for aligning DNA sequences", J Comput Biol 2000; 7(1-2):203-14.</BlastOutput_reference> <BlastOutput_param> <Parameters> <Parameters_expect>10</Parameters_expect> <Parameters_sc-match>1</Parameters_sc-match> </Parameters> </BlastOutput_param> <BlastOutput_iterations>'. [ parser isStartTag: 'BlastOutput_param' ] whileFalse:[ Transcript show: parser text; cr. parser next ]
I've sent the changes to Ken Treis so he can integrate them in XMLPullParser package. Cheers,
Hernán
http://www.ibm.com/developerworks/xml/library/x-tipsaxstop/ http://stackoverflow.com/questions/3405702/using-sax-to-parse-common-xml-ele... http://stackoverflow.com/questions/1345293/how-to-stop-parsing-xml-document-...
participants (4)
-
Hernán Morales Durand -
Norbert Hartl -
Stéphane Ducasse -
Sven Van Caekenberghe