When attempting to parse an XML file, I have run into the issue of how to efficiently extract strings .
Using pure Java, without 3rd party libraries, what would be the best solution for extracting a string from between something like this:
<Foo> Hello Every Foo One </Foo>
Thanks in advance.
Why not use regular expressions? You can use capturing groups: http://www.javamex.com/tutorials/regular_expressions/capturing_groups.shtml
in your case, the regex would be something like "<Foo>([^<]*)</Foo>" (capturing group in bold)...
If this is the most performant way, IDK... Regular expressions are not that well known for being very performant. Altough they certainly powerful and flexible, they do run slower than other alternatives, so if you need performance and want to use regular expressions, maybe look into ways to make them run faster.
For example: http://www.javapractices.com/topic/TopicAction.do?Id=104
If you already know all that and are looking for a different approach, IDK.... maybe splitting twice with < and > as split chars?