// Copyright 2010, Stanford NLP // Test that the XMLBeginEndIterator will successfully find a bunch of // text inside xml tags. // TODO: can add tests for the String->Object conversion and some of // the other options the XMLBeginEndIterator has private static List <string> GetResults(XMLBeginEndIterator <string> iterator) { List <string> results = new List <string>(); while (iterator.MoveNext()) { results.Add(iterator.Current); } return(results); }
/// <exception cref="System.IO.IOException"/> public static void Main(string[] args) { if (args.Length < 3) { log.Info("usage: XMLBeginEndIterator file element keepInternalBoolean"); return; } Reader @in = new FileReader(args[0]); IEnumerator <string> iter = new XMLBeginEndIterator <string>(@in, args[1], Sharpen.Runtime.EqualsIgnoreCase(args[2], "true")); while (iter.MoveNext()) { string s = iter.Current; System.Console.Out.WriteLine("*************************************************"); System.Console.Out.WriteLine(s); } @in.Close(); }