2008/7/19 Amit Saxena <[EMAIL PROTECTED]>: > On Sat, Jul 19, 2008 at 6:44 AM, Rob Dixon <[EMAIL PROTECTED]> wrote: > >> >> Epanda wrote: >> > >> > Epanda wrote: >> >> >> >> I would like to know if we can parse XML with regexp faster than with >> >> an MSXML or Xerces library ? >> > >> > I just want to parse an XML and I have seen that the XML!!Parser of >> > Perl based on Expat is the most faster ofth world, I don't know Twig. >> > >> > My XML is classical : >> > <?xml version='1.0' encoding='ISO-8859-1'?> >> > <!DOCTYPE CONF_INST SYSTEM "dtd_conf_inst.dtd"> >> > >> > <ROOT_NODE VERS="1.0"> >> > <NODE1 TAG="VD/N1" SERIAL="3HHE"> >> > <C> >> > <ID>OM</ID> >> > <VAL>SAT</VAL> >> > </C> >> > <C> >> > <ID>TPS</ID> >> > <VAL>3E+01</VAL> >> > </C> >> > </NODE1> >> > </ROOT_NODE> >> > >> > but can be very big. >> >> XML::Twig is built on Expat, and is especially good at processing large >> files >> one element at a time instead of loading the whole file into memory first. >> For >> instance, if your data consists of multiple independent <NODE1> elements >> XML::Twig can be set up to process them individually and so save memory. >> Take a >> look here http://www.xmltwig.com/xmltwig/ >> >> But if you are hoping to write something that is faster than MSXML or >> Xerces you >> may be unsucessful. Perl also has XML::LibXML and XML::Xerces modules as >> well if >> you want to try those. >> >> What do you need to do with the data? It may be possible with regular >> expressions if the data is consistently formatted. >> >> Rob
>> Hi ! > > I am using use XML::SAX::ParserFactory . > > I want to know whether it's a better alternative than suggested so far in > this thread or not ? > > If not, please suggest. > > Regards, > Amit Saxena In many ways it's a preference which parser you use. I would say if you have a large amount of data in your XML then, XML::LibXML is a the best option. I haven't seen anything like it for sheer speed. Dp. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/