本文整理汇总了Java中org.apache.batik.dom.util.DocumentFactory类的典型用法代码示例。如果您正苦于以下问题:Java DocumentFactory类的具体用法?Java DocumentFactory怎么用?Java DocumentFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentFactory类属于org.apache.batik.dom.util包,在下文中一共展示了DocumentFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: load
import org.apache.batik.dom.util.DocumentFactory; //导入依赖的package包/类
/**
* Reads a property list (key and element pairs) from the input stream.
* The stream is assumed to be using the ISO 8859-1 character encoding.
*/
public synchronized void load(InputStream is) throws IOException {
BufferedReader r;
r = new BufferedReader(new InputStreamReader(is, PREFERENCE_ENCODING));
DocumentFactory df = new SAXDocumentFactory
(GenericDOMImplementation.getDOMImplementation(),
xmlParserClassName);
Document doc = df.createDocument("http://xml.apache.org/batik/preferences",
"preferences",
null,
r);
Element elt = doc.getDocumentElement();
for (Node n = elt.getFirstChild(); n != null; n = n.getNextSibling()) {
if (n.getNodeType() == Node.ELEMENT_NODE) {
if (n.getNodeName().equals("property")) {
String name = ((Element)n).getAttributeNS(null, "name");
StringBuffer cont = new StringBuffer();
for (Node c = n.getFirstChild();
c != null;
c = c.getNextSibling()) {
if (c.getNodeType() == Node.TEXT_NODE) {
cont.append(c.getNodeValue());
} else {
break;
}
}
String val = cont.toString();
put(name, val);
}
}
}
}
示例2: createDocumentFactory
import org.apache.batik.dom.util.DocumentFactory; //导入依赖的package包/类
/**
* Creates a {@link DocumentFactory} that is used to create an SVG DOM
* tree. The specified DOM Implementation is ignored and the Batik
* SVG DOM Implementation is automatically used.
*
* @param domImpl the DOM Implementation (not used)
* @param parserClassname the XML parser classname
* @return the document factory
*/
protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
String parserClassname) {
final FOPSAXSVGDocumentFactory factory
= new FOPSAXSVGDocumentFactory(parserClassname);
if (this.resolver != null) {
factory.setAdditionalEntityResolver(this.resolver);
}
return factory;
}
示例3: createDocumentFactory
import org.apache.batik.dom.util.DocumentFactory; //导入依赖的package包/类
/**
* Creates a <code>DocumentFactory</code> that is used to create an SVG DOM
* tree. The specified DOM Implementation is ignored and the Batik
* SVG DOM Implementation is automatically used.
*
* @param domImpl the DOM Implementation (not used)
* @param parserClassname the XML parser classname
*/
protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
String parserClassname) {
return new SAXSVGDocumentFactory(parserClassname);
}
示例4: createDocumentFactory
import org.apache.batik.dom.util.DocumentFactory; //导入依赖的package包/类
/**
* Creates the <code>DocumentFactory</code> used to create the DOM
* tree. Override this method if you have to use another
* implementation of the <code>DocumentFactory</code> (ie. for SVG,
* you have to use the <code>SAXSVGDocumentFactory</code>).
*
* @param domImpl the DOM Implementation to use
* @param parserClassname the XML parser classname
*/
protected DocumentFactory createDocumentFactory(DOMImplementation domImpl,
String parserClassname) {
return new SAXDocumentFactory(domImpl, parserClassname);
}