I have a situation similar to the following (the names have been changed to make the poster appear as though they work on something fun)
I currently have a SAX parser that can read an xml document: football_team.xml.
<football_team>
…
</football_team>
I parse the football team document through the an object called FootballTeamXmlParser. The method is:
FootballTeamXmlParser
public FootballTeam parse(InputSource pSource);
I now have a new document called: football_league.xml that is an aggregation of several football teams. Note: The file structure of football_team.xml is embedded in football_league.xml. The file, football_league.xml does not contain references to external files like football_team.xml.
<football_league>
<commissioner>Carl Stottlemyer</commissioner>
...
<football_team>Xml structure same as football_team.xml</football_team>
<football_team>…</football_team>
…
</football_league>
I would like to create a SAX parser, FootballLeagueXmlParser, that utilizes my FootballTeamXmlParser. I still want my FootballTeamXmlParser to be capable of parsing standalone documents. I would like my FootballLeagueXmlParser to call the FootballTeamParser whenever a <football_team> is encountered. However, I can't find an easy way to extract all of the content within a <football_team> as an InputSource so that I can pass it to my FootballTeamParser.
Can anyone offer any recommendations to get the most reuse out of my FootballTeamXmlParser?
Thank you,
Carl Stottlemyer
Software Engineer