import java.lang.Integer;
import java.io.*;
import java.net.URL;
import java.util.*;
import com.ms.xml.om.*;
import com.ms.xml.util.*;
import com.ms.xml.parser.*;
class TestParser {
public static void main (String args[]) throws IOException {
Document aDoc = new Document();
URL aURL = null;
//InputStream s;
String initialText = "\n" +
"
\n" +
"Color and font test:\n" +
"\n" +
"- red\n" +
"
- blue\n" +
"
- green\n" +
"
- small\n" +
"
- large\n" +
"
- italic\n" +
"
- bold\n" +
"
\n" +
"\n" +
"\n";
String s = null;
File inputFile = new File("Hello.html");
FileInputStream in = new FileInputStream(inputFile);
try {
s = "file:"
+ System.getProperty("user.dir")
+ System.getProperty("file.separator")
+ "Hello.html";
aURL = new URL(s);
} catch (Exception e) {
System.err.println("Couldn't create a URL: " + s);
}
try {
aDoc.load(aURL);
} catch (Exception e) {
System.out.println("Parse error.");
e.printStackTrace();
//System.out.println("File:" + aURL.toString() + "*");
}
System.out.println("An XML Document may be loaded.");
Enumeration e = aDoc.getChild(1).getElements();
//Enumeration e = aDoc.getElements();
Element el;
String res="";
while (e.hasMoreElements()) {
el = (Element)e.nextElement();
res += el.getText();
}
System.out.println("res: " + res);
System.out.println("Number of elements of aDoc: " + aDoc.numElements());
//System.out.println("getText(): " + aDoc.getText());
/*int c;
while ( (c = in.read()) != -1 ) {
char ch = (char)c;
System.out.print(ch);
}*/
in.close();
}
}