1 package org.enhydra.xml.xhtml.dom.xerces; 2 3 import org.enhydra.apache.xerces.dom.DOMImplementationImpl; 4 import org.w3c.dom.DOMException ; 5 import org.w3c.dom.DOMImplementation ; 6 import org.w3c.dom.Document ; 7 import org.w3c.dom.DocumentType ; 8 import org.w3c.dom.Element ; 9 import org.w3c.dom.html.HTMLDOMImplementation; 10 import org.w3c.dom.html.HTMLDocument; 11 12 22 public class XHTMLDOMImplementationImpl 23 extends DOMImplementationImpl 24 implements HTMLDOMImplementation 25 { 26 30 private static HTMLDOMImplementation _instance = new XHTMLDOMImplementationImpl(); 31 32 33 38 private XHTMLDOMImplementationImpl() 39 { 40 } 41 42 43 46 public Document createDocument(String namespaceURI, 47 String qualifiedName, 48 DocumentType doctype) throws DOMException { 49 if (qualifiedName == null) { 50 throw new NullPointerException ("qualifiedName is null"); 51 } 52 Document doc = new XHTMLDocumentImpl(doctype); 53 Element e = doc.createElementNS(namespaceURI, qualifiedName); 54 doc.appendChild(e); 55 return doc; 56 } 57 58 59 65 public final HTMLDocument createHTMLDocument( String title ) 66 throws DOMException 67 { 68 HTMLDocument doc; 69 70 if ( title == null ) 71 throw new NullPointerException ( "HTM014 Argument 'title' is null." ); 72 doc = new XHTMLDocumentImpl(); 73 doc.setTitle( title ); 74 return doc; 75 } 76 77 78 85 public static HTMLDOMImplementation getHTMLDOMImplementation() 86 { 87 return _instance; 88 } 89 90 97 public static DOMImplementation getDOMImplementation() 98 { 99 return _instance; 100 } 101 } 102 | Popular Tags |