Public Methods | |
| BatikTestDocumentBuilderFactory (DocumentBuilderSetting[] settings) throws DOMTestIncompatibleException | |
| DOMTestDocumentBuilderFactory | newInstance (DocumentBuilderSetting[] newSettings) throws DOMTestIncompatibleException |
| Document | load (java.net.URL url) throws DOMTestLoadException |
| DOMImplementation | getDOMImplementation () |
| boolean | hasFeature (String feature, String version) |
| String | addExtension (String testFileName) |
| boolean | isCoalescing () |
| boolean | isExpandEntityReferences () |
| boolean | isIgnoringElementContentWhitespace () |
| boolean | isNamespaceAware () |
| boolean | isValidating () |
Definition at line 33 of file BatikTestDocumentBuilderFactory.java.
|
|
Creates a Batik implementation of DOMTestDocumentBuilderFactory.
Definition at line 46 of file BatikTestDocumentBuilderFactory.java. Referenced by newInstance().
00047 {
00048 super(settings);
00049 domImpl = null;
00050
00051 //
00052 // get the JAXP specified SAX parser's class name
00053 //
00054 SAXParserFactory saxFactory = SAXParserFactory.newInstance();
00055 try {
00056 SAXParser saxParser = saxFactory.newSAXParser();
00057 xmlReader = saxParser.getXMLReader();
00058 }
00059 catch(Exception ex) {
00060 throw new DOMTestIncompatibleException(ex,null);
00061 }
00062 String xmlReaderClassName = xmlReader.getClass().getName();
00063
00064 //
00065 // can't change settings, so if not the same as
00066 // the default SAX parser then throw an exception
00067 //
00068 // for(int i = 0; i < settings.length; i++) {
00069 // if(!settings[i].hasSetting(this)) {
00070 // TODO
00071 // throw new DOMTestIncompatibleException(null,settings[i]);
00072 // }
00073 // }
00074 //
00075 // try loading Batik reflectively
00076 //
00077 try {
00078 ClassLoader classLoader = ClassLoader.getSystemClassLoader();
00079 Class domFactoryClass = classLoader.loadClass("org.apache.batik.dom.svg.SAXSVGDocumentFactory");
00080
00081 Constructor domFactoryConstructor =
00082 domFactoryClass.getConstructor(new Class[] { String.class });
00083 domFactory = domFactoryConstructor.newInstance(
00084 new Object[] { xmlReaderClassName } );
00085 createDocument = domFactoryClass.getMethod("createDocument",
00086 new Class[] { String.class, java.io.InputStream.class });
00087 }
00088 catch(InvocationTargetException ex) {
00089 throw new DOMTestIncompatibleException(ex.getTargetException(),null);
00090 }
00091 catch(Exception ex) {
00092 throw new DOMTestIncompatibleException(ex,null);
00093 }
00094 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 141 of file BatikTestDocumentBuilderFactory.java.
00141 {
00142 return testFileName + ".svg";
00143 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 121 of file BatikTestDocumentBuilderFactory.java.
00121 {
00122 //
00123 // get DOM implementation
00124 //
00125 if(domImpl == null) {
00126 try {
00127 Class svgDomImplClass = ClassLoader.getSystemClassLoader().loadClass("org.apache.batik.dom.svg.SVGDOMImplementation");
00128 Method getImpl = svgDomImplClass.getMethod("getDOMImplementation",new Class[0]);
00129 domImpl = (DOMImplementation) getImpl.invoke(null,new Object[0]);
00130 }
00131 catch(Exception ex) {
00132 }
00133 }
00134 return domImpl;
00135 }
|
|
||||||||||||
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 137 of file BatikTestDocumentBuilderFactory.java.
00137 {
00138 return getDOMImplementation().hasFeature(feature,version);
00139 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 145 of file BatikTestDocumentBuilderFactory.java.
00145 {
00146 return false;
00147 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 149 of file BatikTestDocumentBuilderFactory.java.
00149 {
00150 return false;
00151 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 153 of file BatikTestDocumentBuilderFactory.java.
00153 {
00154 return false;
00155 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 157 of file BatikTestDocumentBuilderFactory.java.
00157 {
00158 return true;
00159 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 161 of file BatikTestDocumentBuilderFactory.java.
00161 {
00162 return false;
00163 }
|
|
|
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 105 of file BatikTestDocumentBuilderFactory.java.
00105 {
00106 try {
00107 java.io.InputStream stream = url.openStream();
00108 return (org.w3c.dom.Document)
00109 createDocument.invoke(domFactory, new Object[] { url.toString(), stream });
00110 }
00111 catch(InvocationTargetException ex) {
00112 ex.printStackTrace();
00113 throw new DOMTestLoadException(ex.getTargetException());
00114 }
00115 catch(Exception ex) {
00116 ex.printStackTrace();
00117 throw new DOMTestLoadException(ex);
00118 }
00119 }
|
|
|
Returns an instance of DOMTestDocumentBuilderFactory with the settings from the argument list and any non-revoked settings from the current object.
Reimplemented from DOMTestDocumentBuilderFactory. Definition at line 96 of file BatikTestDocumentBuilderFactory.java. References BatikTestDocumentBuilderFactory(), and DOMTestDocumentBuilderFactory::mergeSettings().
00097 {
00098 if(newSettings == null) {
00099 return this;
00100 }
00101 DocumentBuilderSetting[] mergedSettings = mergeSettings(newSettings);
00102 return new BatikTestDocumentBuilderFactory(mergedSettings);
00103 }
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001