java - Spliting big XML file into small based on tag name -
i have requirement in xml file & tag name input, have split xml file using given tag name using java. pls. suggest me s
input: xml file
<note> <to>tove</to> <from>jani</from> <heading>reminder</heading> <body>don't forget me weekend!</body> </note> <book> <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 @ creating applications xml.</description> </book> <book> <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, evil sorceress, , own childhood become queen of world.</description>
tag name: book
output:
<book> <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 @ creating applications xml.</description> </book> <book> <author>ralls, kim</author> <title>midnight rain</title> <genre>fantasy</genre> <price>5.95</price>`enter code here` <publish_date>2000-12-16</publish_date> <description>a former architect battles corporate zombies, evil sorceress, , own childhood become queen of world.</description> </book>
i think general algorithm follows:
- read file buffer
- locate first instance of tag
- keep reading lines until find last tag
- output lines
Comments
Post a Comment