1 57 58 package org.apache.soap.util.xml; 59 60 import javax.xml.parsers.*; 62 import org.xml.sax.*; 63 import org.xml.sax.helpers.*; 64 import org.w3c.dom.*; 65 import org.apache.soap.Constants; 66 67 74 public class XMLParserUtils { 75 private static DocumentBuilderFactory dbf = null; 76 77 static { 78 refreshDocumentBuilderFactory(null, true, false); 80 } 81 82 102 synchronized public static void refreshDocumentBuilderFactory( 103 String factoryClassName, 104 boolean namespaceAware, 105 boolean validating) { 106 if (factoryClassName != null) { 107 System.setProperty("javax.xml.parsers.DocumentBuilderFactory", 108 factoryClassName); 109 } 110 111 dbf = DocumentBuilderFactory.newInstance(); 113 114 dbf.setNamespaceAware(namespaceAware); 116 dbf.setValidating(validating); 117 118 123 } 124 125 133 synchronized public static DocumentBuilder getXMLDocBuilder() 134 throws IllegalArgumentException { 135 try { 138 return dbf.newDocumentBuilder(); 139 } catch (ParserConfigurationException pce) { 140 throw new IllegalArgumentException (pce.toString()); 141 } 142 } 143 } 144 | Popular Tags |