/Users/lyon/j4p/src/xml/adbk/Xml2Address.java

1    package xml.adbk; 
2     
3    import org.xml.sax.SAXException; 
4    import org.xml.sax.SAXParseException; 
5     
6    import javax.xml.parsers.ParserConfigurationException; 
7    import javax.xml.parsers.SAXParser; 
8    import javax.xml.parsers.SAXParserFactory; 
9    import java.io.IOException; 
10    
11   /** 
12    * xml.Xml2Address reads AML and makes address books. 
13    */ 
14    
15   public class Xml2Address { 
16       public static AddressBook read(String uri) 
17               throws 
18               SAXParseException, 
19               SAXException, 
20               ParserConfigurationException, 
21               IOException { 
22    
23           SAXParserFactory spf 
24                   = SAXParserFactory.newInstance(); 
25           spf.setValidating(true); 
26    
27           SAXParser sp = spf.newSAXParser(); 
28    
29           ParseAml dh = new ParseAml(); 
30           sp.parse(uri, dh); 
31           return dh.getAddressBook(); 
32       } 
33    
34   } 
35    
36    
37