1 package com.icl.saxon.om; 2 3 import javax.xml.parsers.DocumentBuilderFactory ; 4 import javax.xml.parsers.DocumentBuilder ; 5 import javax.xml.parsers.ParserConfigurationException ; 6 7 13 14 public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory { 15 16 public DocumentBuilderFactoryImpl() { 17 setCoalescing(true); 18 setExpandEntityReferences(true); 19 setIgnoringComments(false); 20 setIgnoringElementContentWhitespace(false); 21 setNamespaceAware(true); 22 setValidating(false); 23 } 24 25 public Object getAttribute(String name) { 26 throw new IllegalArgumentException ("Unrecognized attribute name: " + name); 27 } 28 29 public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException { 30 31 33 if (!isExpandEntityReferences()) { 34 throw new ParserConfigurationException ( 35 "Saxon parser always expands entity references"); 36 } 37 if (isIgnoringComments()) { 38 throw new ParserConfigurationException ( 39 "Saxon parser does not allow comments to be ignored"); 40 } 41 if (isIgnoringElementContentWhitespace()) { 42 throw new ParserConfigurationException ( 43 "Saxon parser does not allow whitespace in element content to be ignored"); 44 } 45 if (!isNamespaceAware()) { 46 throw new ParserConfigurationException ( 47 "Saxon parser is always namespace aware"); 48 } 49 if (isValidating()) { 50 throw new ParserConfigurationException ( 51 "Saxon parser is non-validating"); 52 } 53 54 return new DocumentBuilderImpl(); 55 } 56 57 public void setAttribute(String name, Object value) { 58 throw new IllegalArgumentException ("Unrecognized attribute name: " + name); 59 } 60 61 } 62 | Popular Tags |