in reply to get string between two < tags > in .js file (xml)
Just do it the right way and be done. 16 megabytes is not “huge.” This is a JSON-formatted file, and within that file some of the records are in XML format. Therefore, first use a CPAN package that understands JSON. Then, feed the extracted strings into another CPAN package that understands XML. From here, an XPath query can dive right into the XML to extract from it precisely whatever you need to know. Because of XPath, you do not have to write code to pick apart the XML structure itself. You could, in less than 50 lines of “code that you actually had to write,” be looking at a robust and reliable (i.e. “real”) solution to this task. Finito!
You are simply de-constructing the file in more or less the same way that it was originally constructed; probably using the same tool. It is, if I may say, abjectly pointless to “prove” that something can be done the wrong way, even if you “succeed.” (And, please, take this stern-sounding advice in an impersonal way, not as a flame, but as the pointed and direct admonition from an engineering colleague who deems it very important to get this point across.)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: get string between two < tags > in .js file (xml)
by kamchez (Initiate) on Jul 03, 2012 at 15:40 UTC |