| Method from com.lowagie.text.xml.XmlWriter Detail: |
public boolean add(Element element) throws DocumentException {
if (pause) {
return false;
}
try {
switch(element.type()) {
case Element.TITLE:
itext.put(ElementTags.TITLE, ((Meta)element).content());
return true;
case Element.SUBJECT:
itext.put(ElementTags.SUBJECT, ((Meta)element).content());
return true;
case Element.KEYWORDS:
itext.put(ElementTags.KEYWORDS, ((Meta)element).content());
return true;
case Element.AUTHOR:
itext.put(ElementTags.AUTHOR, ((Meta)element).content());
return true;
default:
write(element, 1);
return true;
}
}
catch(IOException ioe) {
return false;
}
}
Signals that an Element was added to the Document. |
static final void addTabs(StringBuffer buf,
int indent) {
for (int i = 0; i < indent; i++) {
buf.append("\t");
}
}
Adds a number of tabs to a StringBuffer. |
public void close() {
try {
os.write(NEWLINE);
writeEnd(ElementTags.ITEXT);
super.close();
}
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
}
}
Signals that the Document was closed and that no other
Elements will be added. |
static final String encode(String string,
int indent) {
int n = string.length();
int pos = 0;
char character;
StringBuffer buf = new StringBuffer();
// loop over all the characters of the String.
for (int i = 0; i < n; i++) {
character = string.charAt(i);
// the Xmlcode of these characters are added to a StringBuffer one by one
switch(character) {
case ' ":
if ((i - pos) > 60) {
pos = i;
buf.append("\n");
addTabs(buf, indent);
break;
}
default:
buf.append(xmlCode[(int) character]);
}
}
return buf.toString();
}
|
public static XmlWriter getInstance(Document document,
OutputStream os) {
return new XmlWriter(document, os);
}
Gets an instance of the XmlWriter. |
public static XmlWriter getInstance(Document document,
OutputStream os,
String dtd) {
return new XmlWriter(document, os, dtd);
}
Gets an instance of the XmlWriter. |
public boolean newPage() throws DocumentException {
if (pause || !open) {
return false;
}
try {
writeStart(ElementTags.NEWPAGE);
writeEnd();
return true;
}
catch(IOException ioe) {
return false;
}
}
Signals that an new page has to be LTed. |
public void open() {
super.open();
try {
itext.put(ElementTags.PRODUCER, "iTextXML by lowagie.com");
itext.put(ElementTags.CREATIONDATE, new Date().toString());
writeStart(ElementTags.ITEXT);
String key;
for (java.util.Iterator i = itext.keySet().iterator(); i.hasNext(); ) {
key = (String) i.next();
write(key, (String) itext.get(key));
}
os.write(GT);
}
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
}
}
Signals that the Document has been opened and that
Elements can be added. |