1 16 package org.outerj.daisy.publisher.serverimpl.docpreparation; 17 18 import org.xml.sax.ContentHandler ; 19 import org.xml.sax.SAXException ; 20 import org.xml.sax.Locator ; 21 import org.xml.sax.Attributes ; 22 import org.outerj.daisy.repository.Document; 23 import org.outerj.daisy.repository.Version; 24 import org.outerj.daisy.publisher.serverimpl.requestmodel.PublisherContext; 25 26 59 public class ContentProcessor implements ContentHandler { 60 private Document document; 61 private Version version; 62 63 private ContentHandler pipe; 64 private ContentProcessor parent; 65 66 private IncludesProcessor includesProcessor; 67 private PublisherContext publisherContext; 68 private PreparationPipe preparationPipe; 69 70 75 public ContentProcessor(Document document, Version version, ContentHandler consumer, PreparationPipe preparationPipe, 76 PublisherContext publisherContext, ContentProcessor parent) { 77 this.document = document; 78 this.version = version; 79 this.includesProcessor = new IncludesProcessor(document, consumer, this); 80 this.preparationPipe = preparationPipe; 81 this.publisherContext = publisherContext; 82 this.parent = parent; 83 this.pipe = new QueriesProcessor(new QueryIncludeProcessor(includesProcessor, this), this); 84 } 85 86 public ContentProcessor getParent() { 87 return parent; 88 } 89 90 public void setParent(ContentProcessor parent) { 91 this.parent = parent; 92 } 93 94 public IncludesProcessor getIncludesProcessor() { 95 return includesProcessor; 96 } 97 98 public PublisherContext getPublisherContext() { 99 return publisherContext; 100 } 101 102 public PreparationPipe getPreparationPipe() { 103 return preparationPipe; 104 } 105 106 public Document getDocument() { 107 return document; 108 } 109 110 public Version getVersion() { 111 return version; 112 } 113 114 public void endDocument() throws SAXException { 115 pipe.endDocument(); 116 } 117 118 public void startDocument () throws SAXException { 119 pipe.startDocument(); 120 } 121 122 public void characters (char ch[], int start, int length) throws SAXException { 123 pipe.characters(ch, start, length); 124 } 125 126 public void ignorableWhitespace (char ch[], int start, int length) throws SAXException { 127 pipe.ignorableWhitespace(ch, start, length); 128 } 129 130 public void endPrefixMapping (String prefix) throws SAXException { 131 pipe.endPrefixMapping(prefix); 132 } 133 134 public void skippedEntity (String name) throws SAXException { 135 pipe.skippedEntity(name); 136 } 137 138 public void setDocumentLocator (Locator locator) { 139 pipe.setDocumentLocator(locator); 140 } 141 142 public void processingInstruction (String target, String data) throws SAXException { 143 pipe.processingInstruction(target, data); 144 } 145 146 public void startPrefixMapping (String prefix, String uri) throws SAXException { 147 pipe.startPrefixMapping(prefix, uri); 148 } 149 150 public void endElement (String namespaceURI, String localName, 151 String qName) throws SAXException { 152 pipe.endElement(namespaceURI, localName, qName); 153 } 154 155 public void startElement (String namespaceURI, String localName, 156 String qName, Attributes atts) throws SAXException { 157 pipe.startElement(namespaceURI, localName, qName, atts); 158 } 159 } 160 | Popular Tags |