Parsing documents with DOM2

This program parses with Xerces. Other parsers are different.

import org.apache.xerces.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import java.io.*;

public class DOMParserMaker {

  public static void main(String[] args) {
     
    DOMParser parser = new DOMParser();
    
    for (int i = 0; i < args.length; i++) {
      try {
        parser.parse(args[i]);
        Document d = parser.getDocument();
      }
      catch (SAXException ex) {
        System.err.println(ex); 
      }
      catch (IOException ex) {
        System.err.println(ex); 
      }
      
    }
   
  }

}

Previous | Next | Top | Cafe con Leche

Copyright 2000-2004 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified February 12, 2001