*** javadom_cvs_20040114.py Mon Aug 19 15:44:09 2002 --- javadom_jaxp.py Wed Jan 14 12:50:25 2004 *************** *** 124,129 **** --- 124,149 ---- parser.parse(source) return Document(builder.getDocument()) + class JavaxXmlDomImplementation(BaseDomImplementation): + + def __init__(self): + from javax.xml.parsers import DocumentBuilderFactory + from synchronize import apply_synchronized + self._callsynch = apply_synchronized + self.db = DocumentBuilderFactory.newInstance().newDocumentBuilder() + + def createDocument(self): + return Document(self._callsynch(self.db, self.db.newDocument, [])) + + def buildDocumentString(self, string): + from java.io import StringReader + from org.xml.sax import InputSource + return Document(self._callsynch(self.db, self.db.parse,\ + [InputSource(StringReader(string))])) + + def buildDocumentUrl(self, url): + return Document(self._callsynch(self.db, self.db.parse, [url])) + # ===== Utilities def filetourl(file): *************** *** 677,683 **** # ===== Self-test if __name__ == "__main__": ! impl = BrownellDomImplementation() #XercesDomImplementation() #SunDomImplementation() doc2 = impl.createDocument() print doc2 print doc2._get_implementation() --- 697,703 ---- # ===== Self-test if __name__ == "__main__": ! impl = JavaxXmlDomImplementation() # BrownellDomImplementation() #XercesDomImplementation() #SunDomImplementation() doc2 = impl.createDocument() print doc2 print doc2._get_implementation()