当前位置: 首页>>代码示例>>Java>>正文


Java SimpleXMLParser类代码示例

本文整理汇总了Java中com.lowagie.text.xml.simpleparser.SimpleXMLParser的典型用法代码示例。如果您正苦于以下问题:Java SimpleXMLParser类的具体用法?Java SimpleXMLParser怎么用?Java SimpleXMLParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SimpleXMLParser类属于com.lowagie.text.xml.simpleparser包,在下文中一共展示了SimpleXMLParser类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: exportToXML

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Exports the destinations to XML.
 * @param names the names
 * @param wrt the export destination. The writer is not closed
 * @param encoding the encoding according to IANA conventions
 * @param onlyASCII codes above 127 will always be escaped with &amp;#nn; if <CODE>true</CODE>,
 * whatever the encoding
 * @throws IOException on error
 */
public static void exportToXML(HashMap names, Writer wrt, String encoding, boolean onlyASCII) throws IOException {
    wrt.write("<?xml version=\"1.0\" encoding=\"");
    wrt.write(SimpleXMLParser.escapeXML(encoding, onlyASCII));
    wrt.write("\"?>\n<Destination>\n");
    for (Iterator it = names.entrySet().iterator(); it.hasNext();) {
        Map.Entry entry = (Map.Entry)it.next();
        String key = (String)entry.getKey();
        String value = (String)entry.getValue();
        wrt.write("  <Name Page=\"");
        wrt.write(SimpleXMLParser.escapeXML(value, onlyASCII));
        wrt.write("\">");
        wrt.write(SimpleXMLParser.escapeXML(escapeBinaryString(key), onlyASCII));
        wrt.write("</Name>\n");
    }
    wrt.write("</Destination>\n");
    wrt.flush();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:27,代码来源:SimpleNamedDestination.java

示例2: XfdfReader

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/** Reads an XFDF form.
 * @param filename the file name of the form
 * @throws IOException on error
 */    
public XfdfReader(String filename) throws IOException {
    FileInputStream fin = null;
    try {
        fin = new FileInputStream(filename);
        SimpleXMLParser.parse(this, fin);
    }
    finally {
        try{if (fin != null) {fin.close();}}catch(Exception e){}
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:15,代码来源:XfdfReader.java

示例3: exportToXMLNode

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Exports the bookmarks to XML. Only of use if the generation is to be include in
 * some other XML document.
 * @param list the bookmarks
 * @param out the export destination. The writer is not closed
 * @param indent the indentation level. Pretty printing significant only
 * @param onlyASCII codes above 127 will always be escaped with &amp;#nn; if <CODE>true</CODE>,
 * whatever the encoding
 * @throws IOException on error
 */
public static void exportToXMLNode(List list, Writer out, int indent, boolean onlyASCII) throws IOException {
    StringBuilder dep = new StringBuilder(8);
    for (int k = 0; k < indent; ++k) {
        dep.append("  ");
    }
    for (Iterator it = list.iterator(); it.hasNext();) {
        HashMap map = (HashMap)it.next();
        String title = null;
        out.write(dep.toString());
        out.write("<Title ");
        List kids = null;
        for (Iterator e = map.entrySet().iterator(); e.hasNext();) {
            Map.Entry entry = (Map.Entry) e.next();
            String key = (String) entry.getKey();
            if (key.equals("Title")) {
                title = (String) entry.getValue();
                continue;
            }
            else if (key.equals("Kids")) {
                kids = (List) entry.getValue();
                continue;
            }
            else {
                out.write(key);
                out.write("=\"");
                String value = (String) entry.getValue();
                if (key.equals("Named") || key.equals("NamedN")) {
                    value = SimpleNamedDestination.escapeBinaryString(value);
                }
                out.write(SimpleXMLParser.escapeXML(value, onlyASCII));
                out.write("\" ");
            }
        }
        out.write(">");
        if (title == null) {
            title = "";
        }
        out.write(SimpleXMLParser.escapeXML(title, onlyASCII));
        if (kids != null) {
            out.write("\n");
            exportToXMLNode(kids, out, indent + 1, onlyASCII);
            out.write(dep.toString());
        }
        out.write("</Title>\n");
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:57,代码来源:SimpleBookmark.java

示例4: parse

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
public void parse(Reader reader) throws IOException {
	SimpleXMLParser.parse(this, null, reader, true);
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:4,代码来源:HTMLWorker.java

示例5: exportToXMLNode

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Exports the bookmarks to XML. Only of use if the generation is to be include in
 * some other XML document.
 * @param list the bookmarks
 * @param out the export destination. The writer is not closed
 * @param indent the indentation level. Pretty printing significant only
 * @param onlyASCII codes above 127 will always be escaped with &amp;#nn; if <CODE>true</CODE>,
 * whatever the encoding
 * @throws IOException on error
 */
public static void exportToXMLNode(List list, Writer out, int indent, boolean onlyASCII) throws IOException {
    String dep = "";
    for (int k = 0; k < indent; ++k)
        dep += "  ";
    for (Iterator it = list.iterator(); it.hasNext();) {
        HashMap map = (HashMap)it.next();
        String title = null;
        out.write(dep);
        out.write("<Title ");
        List kids = null;
        for (Iterator e = map.entrySet().iterator(); e.hasNext();) {
            Map.Entry entry = (Map.Entry) e.next();
            String key = (String) entry.getKey();
            if (key.equals("Title")) {
                title = (String) entry.getValue();
                continue;
            }
            else if (key.equals("Kids")) {
                kids = (List) entry.getValue();
                continue;
            }
            else {
                out.write(key);
                out.write("=\"");
                String value = (String) entry.getValue();
                if (key.equals("Named") || key.equals("NamedN"))
                    value = SimpleNamedDestination.escapeBinaryString(value);
                out.write(SimpleXMLParser.escapeXML(value, onlyASCII));
                out.write("\" ");
            }
        }
        out.write(">");
        if (title == null)
            title = "";
        out.write(SimpleXMLParser.escapeXML(title, onlyASCII));
        if (kids != null) {
            out.write("\n");
            exportToXMLNode(kids, out, indent + 1, onlyASCII);
            out.write(dep);
        }
        out.write("</Title>\n");
    }
}
 
开发者ID:bullda,项目名称:DroidText,代码行数:54,代码来源:SimpleBookmark.java

示例6: exportToXML

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Exports the bookmarks to XML.
 * @param list the bookmarks
 * @param wrt the export destination. The writer is not closed
 * @param encoding the encoding according to IANA conventions
 * @param onlyASCII codes above 127 will always be escaped with &amp;#nn; if <CODE>true</CODE>,
 * whatever the encoding
 * @throws IOException on error
 */
public static void exportToXML(List list, Writer wrt, String encoding, boolean onlyASCII) throws IOException {
    wrt.write("<?xml version=\"1.0\" encoding=\"");
    wrt.write(SimpleXMLParser.escapeXML(encoding, onlyASCII));
    wrt.write("\"?>\n<Bookmark>\n");
    exportToXMLNode(list, wrt, 1, onlyASCII);
    wrt.write("</Bookmark>\n");
    wrt.flush();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:18,代码来源:SimpleBookmark.java

示例7: importFromXML

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Import the names from XML.
 * @param in the XML source. The stream is not closed
 * @throws IOException on error
 * @return the names
 */
public static HashMap importFromXML(InputStream in) throws IOException {
    SimpleNamedDestination names = new SimpleNamedDestination();
    SimpleXMLParser.parse(names, in);
    return names.xmlNames;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:12,代码来源:SimpleNamedDestination.java

示例8: importFromXML

import com.lowagie.text.xml.simpleparser.SimpleXMLParser; //导入依赖的package包/类
/**
 * Import the bookmarks from XML.
 * @param in the XML source. The stream is not closed
 * @throws IOException on error
 * @return the bookmarks
 */    
public static List importFromXML(InputStream in) throws IOException {
    SimpleBookmark book = new SimpleBookmark();
    SimpleXMLParser.parse(book, in);
    return book.topList;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:12,代码来源:SimpleBookmark.java


注:本文中的com.lowagie.text.xml.simpleparser.SimpleXMLParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。