I have a huge text file and I wanted to write a program which can extract only the XMLs from the file and save it.
Is there a direct API or better solution than splitting/trimming the string read from the file.
Example:
small part of the file:
#---------- #1 : ----------#
<MSG_INFO>
<message type="TextMessage" messageSelector="" originationTimestamp="" receiveTime="" jmsServerTimestamp="" jmsMsgExpiration="">
<header JMSDestinationType="Generic" JMSDeliveryMode="2" />
<properties>
<property name="messageTopic" type="String">xyz</property>
</properties>
</message>
BodyLength=1476
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
Regular expression was the answer.