| Method from org.dom4j.DocumentFactory Detail: |
public Attribute createAttribute(Element owner,
QName qname,
String value) {
return new DefaultAttribute(qname, value);
}
|
public Attribute createAttribute(Element owner,
String name,
String value) {
return createAttribute(owner, createQName(name), value);
}
|
public CDATA createCDATA(String text) {
return new DefaultCDATA(text);
}
|
public Comment createComment(String text) {
return new DefaultComment(text);
}
|
public DocumentType createDocType(String name,
String publicId,
String systemId) {
return new DefaultDocumentType(name, publicId, systemId);
}
|
public Document createDocument() {
DefaultDocument answer = new DefaultDocument();
answer.setDocumentFactory(this);
return answer;
}
|
public Document createDocument(String encoding) {
// to keep the DocumentFactory backwards compatible, we have to do this
// in this not so nice way, since subclasses only need to extend the
// createDocument() method.
Document answer = createDocument();
if (answer instanceof AbstractDocument) {
((AbstractDocument) answer).setXMLEncoding(encoding);
}
return answer;
}
|
public Document createDocument(Element rootElement) {
Document answer = createDocument();
answer.setRootElement(rootElement);
return answer;
}
|
public Element createElement(QName qname) {
return new DefaultElement(qname);
}
|
public Element createElement(String name) {
return createElement(createQName(name));
}
|
public Element createElement(String qualifiedName,
String namespaceURI) {
return createElement(createQName(qualifiedName, namespaceURI));
}
|
public Entity createEntity(String name,
String text) {
return new DefaultEntity(name, text);
}
|
public Namespace createNamespace(String prefix,
String uri) {
return Namespace.get(prefix, uri);
}
|
public Pattern createPattern(String xpathPattern) {
return new XPathPattern(xpathPattern);
}
createPattern parses the given XPath expression to create
an XSLT style Pattern instance which can then be used in an XSLT
processing model.
|
public ProcessingInstruction createProcessingInstruction(String target,
String data) {
return new DefaultProcessingInstruction(target, data);
}
|
public ProcessingInstruction createProcessingInstruction(String target,
Map data) {
return new DefaultProcessingInstruction(target, data);
}
|
public QName createQName(String localName) {
return cache.get(localName);
}
|
public QName createQName(String localName,
Namespace namespace) {
return cache.get(localName, namespace);
}
|
public QName createQName(String qualifiedName,
String uri) {
return cache.get(qualifiedName, uri);
}
|
public QName createQName(String name,
String prefix,
String uri) {
return cache.get(name, Namespace.get(prefix, uri));
}
|
protected QNameCache createQNameCache() {
return new QNameCache(this);
}
Factory method to create the QNameCache. This method should be overloaded
if you wish to use your own derivation of QName. |
protected static DocumentFactory createSingleton(String className) {
// let's try and class load an implementation?
try {
// I'll use the current class loader
// that loaded me to avoid problems in J2EE and web apps
Class theClass = Class.forName(className, true,
DocumentFactory.class.getClassLoader());
return (DocumentFactory) theClass.newInstance();
} catch (Throwable e) {
System.out.println("WARNING: Cannot load DocumentFactory: "
+ className);
return new DocumentFactory();
}
}
|
public Text createText(String text) {
if (text == null) {
String msg = "Adding text to an XML document must not be null";
throw new IllegalArgumentException(msg);
}
return new DefaultText(text);
}
|
public XPath createXPath(String xpathExpression) throws InvalidXPathException {
DefaultXPath xpath = new DefaultXPath(xpathExpression);
if (xpathNamespaceURIs != null) {
xpath.setNamespaceURIs(xpathNamespaceURIs);
}
return xpath;
}
|
public XPath createXPath(String xpathExpression,
VariableContext variableContext) {
XPath xpath = createXPath(xpathExpression);
xpath.setVariableContext(variableContext);
return xpath;
}
|
public NodeFilter createXPathFilter(String xpathFilterExpression) {
return createXPath(xpathFilterExpression);
// return new DefaultXPath( xpathFilterExpression );
}
createXPathFilter parses a NodeFilter from the given XPath
filter expression. XPath filter expressions occur within XPath
expressions such as self::node()[ filterExpression ]
|
public NodeFilter createXPathFilter(String xpathFilterExpression,
VariableContext variableContext) {
XPath answer = createXPath(xpathFilterExpression);
// DefaultXPath answer = new DefaultXPath( xpathFilterExpression );
answer.setVariableContext(variableContext);
return answer;
}
createXPathFilter parses a NodeFilter from the given XPath
filter expression. XPath filter expressions occur within XPath
expressions such as self::node()[ filterExpression ]
|
public static synchronized DocumentFactory getInstance() {
if (singleton == null) {
singleton = createSingleton();
}
return (DocumentFactory) singleton.instance();
}
Access to singleton implementation of DocumentFactory which is used if no
DocumentFactory is specified when building using the standard builders.
|
public List getQNames() {
return cache.getQNames();
}
Returns a list of all the QName instances currently used by this document
factory |
public Map getXPathNamespaceURIs() {
return xpathNamespaceURIs;
}
|
protected void init() {
cache = createQNameCache();
}
|
protected QName intern(QName qname) {
return cache.intern(qname);
}
|
public void setXPathNamespaceURIs(Map namespaceURIs) {
this.xpathNamespaceURIs = namespaceURIs;
}
Sets the namespace URIs to be used by XPath expressions created by this
factory or by nodes associated with this factory. The keys are namespace
prefixes and the values are namespace URIs. |