1 29 30 package com.caucho.xtpdoc; 31 32 import javax.xml.stream.XMLStreamException; 33 import javax.xml.stream.XMLStreamWriter; 34 import java.io.IOException ; 35 import java.io.PrintWriter ; 36 37 public class IndexItem implements ContentItem { 38 private String _id; 39 private String _link; 40 private FormattedTextWithAnchors _text; 41 private Document _document; 42 43 public IndexItem(Document document) 44 { 45 _document = document; 46 } 47 48 public void setId(String id) 49 { 50 _id = id; 51 } 52 53 public void setH(String link) 54 { 55 _link = link; 56 } 57 58 public FormattedTextWithAnchors createD() 59 { 60 _text = new FormattedTextWithAnchors(_document); 61 return _text; 62 } 63 64 public void writeHtml(XMLStreamWriter out) 65 throws XMLStreamException 66 { 67 out.writeStartElement("dt"); 68 out.writeStartElement("a"); 69 out.writeAttribute("name", _link); 70 out.writeCharacters(_id); 71 out.writeEndElement(); out.writeEndElement(); 74 out.writeStartElement("dd"); 75 _text.writeHtml(out); 76 out.writeEndElement(); } 78 79 public void writeLaTeX(PrintWriter out) 80 throws IOException  81 { 82 } 84 85 public void writeLaTeXEnclosed(PrintWriter out) 86 throws IOException  87 { 88 writeLaTeX(out); 89 } 90 91 public void writeLaTeXTop(PrintWriter out) 92 throws IOException  93 { 94 writeLaTeX(out); 95 } 96 } 97 | Popular Tags |