com.lowagie.text.xml.simpleparser.SimpleXMLParser Java Examples

The following examples show how to use com.lowagie.text.xml.simpleparser.SimpleXMLParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleNamedDestination.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example #2
Source File: SimpleNamedDestination.java    From itext2 with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * 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();
}
 
Example #3
Source File: HTMLWorker.java    From gcs with Mozilla Public License 2.0 4 votes vote down vote up
public void parse(Reader reader) throws IOException {
	SimpleXMLParser.parse(this, null, reader, true);
}
 
Example #4
Source File: HTMLWorker.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
public void parse(Reader reader) throws IOException {
	SimpleXMLParser.parse(this, null, reader, true);
}
 
Example #5
Source File: HTMLWorker.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void parse(Reader reader) throws IOException {
	SimpleXMLParser.parse(this, null, reader, true);
}
 
Example #6
Source File: HTMLWorker.java    From sakai with Educational Community License v2.0 4 votes vote down vote up
public void parse(Reader reader) throws IOException {
	SimpleXMLParser.parse(this, null, reader, true);
}
 
Example #7
Source File: SimpleBookmark.java    From gcs with Mozilla Public License 2.0 3 votes vote down vote up
/**
 * 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();
}
 
Example #8
Source File: SimpleBookmark.java    From itext2 with GNU Lesser General Public License v3.0 3 votes vote down vote up
/**
 * 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();
}
 
Example #9
Source File: SimpleNamedDestination.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: SimpleNamedDestination.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Import the names from XML.
 * 
 * @param in the XML source. The reader is not closed
 * @throws IOException on error
 * @return the names
 */
public static HashMap importFromXML(Reader in) throws IOException {
	SimpleNamedDestination names = new SimpleNamedDestination();
	SimpleXMLParser.parse(names, in);
	return names.xmlNames;
}
 
Example #11
Source File: SimpleBookmark.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: SimpleBookmark.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Import the bookmarks from XML.
 * 
 * @param in the XML source. The reader is not closed
 * @throws IOException on error
 * @return the bookmarks
 */
public static List importFromXML(Reader in) throws IOException {
	SimpleBookmark book = new SimpleBookmark();
	SimpleXMLParser.parse(book, in);
	return book.topList;
}
 
Example #13
Source File: XfdfReader.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/** Reads an XFDF form.
  * @param xfdfIn the byte array with the form
  * @throws IOException on error
  */    
 public XfdfReader(byte xfdfIn[]) throws IOException {
     SimpleXMLParser.parse( this, new ByteArrayInputStream(xfdfIn));
}
 
Example #14
Source File: XfdfReader.java    From gcs with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Reads an XFDF form.
 * 
 * @param xfdfIn the byte array with the form
 * @throws IOException on error
 */
public XfdfReader(byte xfdfIn[]) throws IOException {
	SimpleXMLParser.parse(this, new ByteArrayInputStream(xfdfIn));
}
 
Example #15
Source File: SimpleNamedDestination.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #16
Source File: SimpleNamedDestination.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Import the names from XML.
 * @param in the XML source. The reader is not closed
 * @throws IOException on error
 * @return the names
 */
public static HashMap importFromXML(Reader in) throws IOException {
    SimpleNamedDestination names = new SimpleNamedDestination();
    SimpleXMLParser.parse(names, in);
    return names.xmlNames;
}
 
Example #17
Source File: SimpleBookmark.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #18
Source File: SimpleBookmark.java    From itext2 with GNU Lesser General Public License v3.0 2 votes vote down vote up
/**
 * Import the bookmarks from XML.
 * @param in the XML source. The reader is not closed
 * @throws IOException on error
 * @return the bookmarks
 */
public static List importFromXML(Reader in) throws IOException {
    SimpleBookmark book = new SimpleBookmark();
    SimpleXMLParser.parse(book, in);
    return book.topList;
}