You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ma...@apache.org on 2008/01/07 04:06:42 UTC
svn commit: r609491 [10/11] - in /incubator/tika/site: ./ apidocs/
apidocs/org/apache/tika/config/ apidocs/org/apache/tika/config/class-use/
apidocs/org/apache/tika/exception/
apidocs/org/apache/tika/exception/class-use/
apidocs/org/apache/tika/metadat...
Modified: incubator/tika/site/xref/org/apache/tika/parser/microsoft/WordTextBuffer.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/microsoft/WordTextBuffer.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/microsoft/WordTextBuffer.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/microsoft/WordTextBuffer.html Sun Jan 6 19:06:26 2008
@@ -32,16 +32,16 @@
<a name="22" href="#22">22</a> <em class="jxr_javadoccomment"> */</em>
<a name="23" href="#23">23</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/tika/parser/microsoft/WordTextBuffer.html">WordTextBuffer</a>
<a name="24" href="#24">24</a> {
-<a name="25" href="#25">25</a> StringBuffer _buf;
+<a name="25" href="#25">25</a> Appendable _buf;
<a name="26" href="#26">26</a> <strong class="jxr_keyword">boolean</strong> _hold;
<a name="27" href="#27">27</a>
-<a name="28" href="#28">28</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/tika/parser/microsoft/WordTextBuffer.html">WordTextBuffer</a>()
+<a name="28" href="#28">28</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/tika/parser/microsoft/WordTextBuffer.html">WordTextBuffer</a>(Appendable appendable)
<a name="29" href="#29">29</a> {
-<a name="30" href="#30">30</a> _buf = <strong class="jxr_keyword">new</strong> StringBuffer();
+<a name="30" href="#30">30</a> _buf = appendable;
<a name="31" href="#31">31</a> _hold = false;
<a name="32" href="#32">32</a> }
<a name="33" href="#33">33</a>
-<a name="34" href="#34">34</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> append(String text)
+<a name="34" href="#34">34</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> append(String text) <strong class="jxr_keyword">throws</strong> java.io.IOException
<a name="35" href="#35">35</a> {
<a name="36" href="#36">36</a> <strong class="jxr_keyword">char</strong>[] letters = text.toCharArray();
<a name="37" href="#37">37</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> x = 0; x < letters.length; x++)
@@ -67,12 +67,7 @@
<a name="57" href="#57">57</a> }
<a name="58" href="#58">58</a> }
<a name="59" href="#59">59</a>
-<a name="60" href="#60">60</a> <strong class="jxr_keyword">public</strong> String toString()
-<a name="61" href="#61">61</a> {
-<a name="62" href="#62">62</a> <strong class="jxr_keyword">return</strong> _buf.toString();
-<a name="63" href="#63">63</a> }
-<a name="64" href="#64">64</a>
-<a name="65" href="#65">65</a> }
+<a name="60" href="#60">60</a> }
</pre>
<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.microsoft</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.microsoft</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -16,6 +16,9 @@
<ul>
<li>
+ <a href="ExcelEventParser.html" target="classFrame">ExcelEventParser</a>
+ </li>
+ <li>
<a href="ExcelParser.html" target="classFrame">ExcelParser</a>
</li>
<li>
@@ -38,6 +41,9 @@
</li>
<li>
<a href="TextBox.html" target="classFrame">TextBox</a>
+ </li>
+ <li>
+ <a href="ExcelEventParser.html" target="classFrame">TikaHSSFListener</a>
</li>
<li>
<a href="Word6CHPBinTable.html" target="classFrame">Word6CHPBinTable</a>
Modified: incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/microsoft/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.microsoft</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.microsoft</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -37,6 +37,11 @@
<tbody>
<tr>
<td>
+ <a href="ExcelEventParser.html" target="classFrame">ExcelEventParser</a>
+ </td>
+ </tr>
+ <tr>
+ <td>
<a href="ExcelParser.html" target="classFrame">ExcelParser</a>
</td>
</tr>
@@ -77,6 +82,11 @@
</tr>
<tr>
<td>
+ <a href="ExcelEventParser.html" target="classFrame">TikaHSSFListener</a>
+ </td>
+ </tr>
+ <tr>
+ <td>
<a href="Word6CHPBinTable.html" target="classFrame">Word6CHPBinTable</a>
</td>
</tr>
@@ -122,6 +132,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/opendocument/OpenOfficeParser.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/opendocument/OpenOfficeParser.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/opendocument/OpenOfficeParser.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/opendocument/OpenOfficeParser.html Sun Jan 6 19:06:26 2008
@@ -41,119 +41,122 @@
<a name="31" href="#31">31</a> <strong class="jxr_keyword">import</strong> org.apache.tika.metadata.Metadata;
<a name="32" href="#32">32</a> <strong class="jxr_keyword">import</strong> org.apache.tika.parser.Parser;
<a name="33" href="#33">33</a> <strong class="jxr_keyword">import</strong> org.apache.tika.parser.xml.XMLParser;
-<a name="34" href="#34">34</a> <strong class="jxr_keyword">import</strong> org.apache.tika.sax.XHTMLContentHandler;
-<a name="35" href="#35">35</a>
-<a name="36" href="#36">36</a> <strong class="jxr_keyword">import</strong> org.apache.log4j.Logger;
-<a name="37" href="#37">37</a> <strong class="jxr_keyword">import</strong> org.jdom.Document;
-<a name="38" href="#38">38</a> <strong class="jxr_keyword">import</strong> org.jdom.Element;
-<a name="39" href="#39">39</a> <strong class="jxr_keyword">import</strong> org.jdom.JDOMException;
-<a name="40" href="#40">40</a> <strong class="jxr_keyword">import</strong> org.jdom.Namespace;
-<a name="41" href="#41">41</a> <strong class="jxr_keyword">import</strong> org.jdom.input.SAXBuilder;
-<a name="42" href="#42">42</a> <strong class="jxr_keyword">import</strong> org.xml.sax.ContentHandler;
-<a name="43" href="#43">43</a> <strong class="jxr_keyword">import</strong> org.xml.sax.SAXException;
-<a name="44" href="#44">44</a>
-<a name="45" href="#45">45</a> <em class="jxr_javadoccomment">/**</em>
-<a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * OpenOffice parser</em>
-<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> */</em>
-<a name="48" href="#48">48</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/tika/parser/opendocument/OpenOfficeParser.html">OpenOfficeParser</a> implements <a href="../../../../../org/apache/tika/parser/Parser.html">Parser</a> {
-<a name="49" href="#49">49</a> <strong class="jxr_keyword">static</strong> Logger logger = Logger.getRootLogger();
-<a name="50" href="#50">50</a>
-<a name="51" href="#51">51</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> Namespace NS_DC = Namespace.getNamespace(<span class="jxr_string">"dc"</span>,
-<a name="52" href="#52">52</a> <span class="jxr_string">"http://purl.org/dc/elements/1.1/"</span>);
-<a name="53" href="#53">53</a>
-<a name="54" href="#54">54</a> <strong class="jxr_keyword">public</strong> org.jdom.Document parse(InputStream is) {
-<a name="55" href="#55">55</a> Document xmlDoc = <strong class="jxr_keyword">new</strong> org.jdom.Document();
-<a name="56" href="#56">56</a> org.jdom.Document xmlMeta = <strong class="jxr_keyword">new</strong> org.jdom.Document();
-<a name="57" href="#57">57</a> <strong class="jxr_keyword">try</strong> {
-<a name="58" href="#58">58</a> List files = unzip(is);
-<a name="59" href="#59">59</a> SAXBuilder builder = <strong class="jxr_keyword">new</strong> SAXBuilder();
-<a name="60" href="#60">60</a> builder.setEntityResolver(<strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/parser/opendocument/OpenOfficeEntityResolver.html">OpenOfficeEntityResolver</a>());
-<a name="61" href="#61">61</a> builder.setValidation(false);
-<a name="62" href="#62">62</a>
-<a name="63" href="#63">63</a> xmlDoc = builder.build((InputStream) files.get(0));
-<a name="64" href="#64">64</a> xmlMeta = builder.build((InputStream) files.get(1));
-<a name="65" href="#65">65</a> Element rootMeta = xmlMeta.getRootElement();
-<a name="66" href="#66">66</a> Element meta = <strong class="jxr_keyword">null</strong>;
-<a name="67" href="#67">67</a> List ls = rootMeta.getChildren();
-<a name="68" href="#68">68</a> <strong class="jxr_keyword">if</strong> (! ls.isEmpty()) {
-<a name="69" href="#69">69</a> meta = (Element) ls.get(0);
-<a name="70" href="#70">70</a> }
-<a name="71" href="#71">71</a> xmlDoc.getRootElement().addContent(meta.detach());
-<a name="72" href="#72">72</a> xmlDoc.getRootElement().addNamespaceDeclaration(NS_DC);
-<a name="73" href="#73">73</a> } <strong class="jxr_keyword">catch</strong> (JDOMException e) {
-<a name="74" href="#74">74</a> logger.error(e.getMessage());
-<a name="75" href="#75">75</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
-<a name="76" href="#76">76</a> logger.error(e.getMessage());
-<a name="77" href="#77">77</a> }
-<a name="78" href="#78">78</a> <strong class="jxr_keyword">return</strong> xmlDoc;
-<a name="79" href="#79">79</a> }
-<a name="80" href="#80">80</a>
-<a name="81" href="#81">81</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> parse(
-<a name="82" href="#82">82</a> InputStream stream, ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
-<a name="83" href="#83">83</a> <strong class="jxr_keyword">throws</strong> IOException, SAXException, <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a> {
-<a name="84" href="#84">84</a> Document xmlDoc = parse(stream);
-<a name="85" href="#85">85</a> <a href="../../../../../org/apache/tika/parser/xml/XMLParser.html">XMLParser</a> xp = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/parser/xml/XMLParser.html">XMLParser</a>();
-<a name="86" href="#86">86</a> xp.getAllDocumentNs(xmlDoc);
-<a name="87" href="#87">87</a> xp.extractContent(xmlDoc, Metadata.TITLE, <span class="jxr_string">"//dc:title"</span>, metadata);
-<a name="88" href="#88">88</a> xp.extractContent(xmlDoc, Metadata.SUBJECT, <span class="jxr_string">"//dc:subject"</span>, metadata);
-<a name="89" href="#89">89</a> xp.extractContent(xmlDoc, Metadata.CREATOR, <span class="jxr_string">"//dc:creator"</span>, metadata);
-<a name="90" href="#90">90</a> xp.extractContent(xmlDoc, Metadata.DESCRIPTION, <span class="jxr_string">"//dc:description"</span>, metadata);
-<a name="91" href="#91">91</a> xp.extractContent(xmlDoc, Metadata.LANGUAGE, <span class="jxr_string">"//dc:language"</span>, metadata);
-<a name="92" href="#92">92</a> xp.extractContent(xmlDoc, Metadata.KEYWORDS, <span class="jxr_string">"//meta:keyword"</span>, metadata);
-<a name="93" href="#93">93</a> xp.extractContent(xmlDoc, Metadata.DATE, <span class="jxr_string">"//dc:date"</span>, metadata);
-<a name="94" href="#94">94</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbTab"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:table-count"</span>, metadata);
-<a name="95" href="#95">95</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbObject"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:object-count"</span>, metadata);
-<a name="96" href="#96">96</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbImg"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:image-count"</span>, metadata);
-<a name="97" href="#97">97</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbPage"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:page-count"</span>, metadata);
-<a name="98" href="#98">98</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbPara"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:paragraph-count"</span>, metadata);
-<a name="99" href="#99">99</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbWord"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:word-count"</span>, metadata);
-<a name="100" href="#100">100</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbcharacter"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:character-count"</span>, metadata);
-<a name="101" href="#101">101</a>
-<a name="102" href="#102">102</a> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a> xhtml = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a>(handler, metadata);
-<a name="103" href="#103">103</a> xhtml.startDocument();
-<a name="104" href="#104">104</a> xhtml.element(<span class="jxr_string">"p"</span>, xp.concatOccurrence(xmlDoc, <span class="jxr_string">"//*"</span>, <span class="jxr_string">" "</span>));
-<a name="105" href="#105">105</a> xhtml.endDocument();
-<a name="106" href="#106">106</a> }
-<a name="107" href="#107">107</a>
-<a name="108" href="#108">108</a> <strong class="jxr_keyword">public</strong> List unzip(InputStream is) {
-<a name="109" href="#109">109</a> List res = <strong class="jxr_keyword">new</strong> ArrayList();
-<a name="110" href="#110">110</a> <strong class="jxr_keyword">try</strong> {
-<a name="111" href="#111">111</a> ZipInputStream in = <strong class="jxr_keyword">new</strong> ZipInputStream(is);
-<a name="112" href="#112">112</a> ZipEntry entry = <strong class="jxr_keyword">null</strong>;
-<a name="113" href="#113">113</a> <strong class="jxr_keyword">while</strong> ((entry = in.getNextEntry()) != <strong class="jxr_keyword">null</strong>) {
-<a name="114" href="#114">114</a> <strong class="jxr_keyword">if</strong> (entry.getName().equals(<span class="jxr_string">"meta.xml"</span>)
-<a name="115" href="#115">115</a> || entry.getName().equals(<span class="jxr_string">"content.xml"</span>)) {
-<a name="116" href="#116">116</a> ByteArrayOutputStream stream = <strong class="jxr_keyword">new</strong> ByteArrayOutputStream();
-<a name="117" href="#117">117</a> byte[] buf = <strong class="jxr_keyword">new</strong> byte[1024];
-<a name="118" href="#118">118</a> <strong class="jxr_keyword">int</strong> len;
-<a name="119" href="#119">119</a> <strong class="jxr_keyword">while</strong> ((len = in.read(buf)) > 0) {
-<a name="120" href="#120">120</a> stream.write(buf, 0, len);
-<a name="121" href="#121">121</a> }
-<a name="122" href="#122">122</a> InputStream isEntry = <strong class="jxr_keyword">new</strong> ByteArrayInputStream(stream
-<a name="123" href="#123">123</a> .toByteArray());
-<a name="124" href="#124">124</a> res.add(isEntry);
-<a name="125" href="#125">125</a> }
-<a name="126" href="#126">126</a> }
-<a name="127" href="#127">127</a> in.close();
-<a name="128" href="#128">128</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
-<a name="129" href="#129">129</a> logger.error(e.getMessage());
-<a name="130" href="#130">130</a> }
-<a name="131" href="#131">131</a> <strong class="jxr_keyword">return</strong> res;
-<a name="132" href="#132">132</a> }
-<a name="133" href="#133">133</a>
-<a name="134" href="#134">134</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> copyInputStream(InputStream in, OutputStream out)
-<a name="135" href="#135">135</a> <strong class="jxr_keyword">throws</strong> IOException {
-<a name="136" href="#136">136</a> byte[] buffer = <strong class="jxr_keyword">new</strong> byte[1024];
-<a name="137" href="#137">137</a> <strong class="jxr_keyword">int</strong> len;
-<a name="138" href="#138">138</a>
-<a name="139" href="#139">139</a> <strong class="jxr_keyword">while</strong> ((len = in.read(buffer)) >= 0)
-<a name="140" href="#140">140</a> out.write(buffer, 0, len);
+<a name="34" href="#34">34</a> <strong class="jxr_keyword">import</strong> org.apache.tika.sax.AppendableAdaptor;
+<a name="35" href="#35">35</a> <strong class="jxr_keyword">import</strong> org.apache.tika.sax.XHTMLContentHandler;
+<a name="36" href="#36">36</a>
+<a name="37" href="#37">37</a> <strong class="jxr_keyword">import</strong> org.apache.log4j.Logger;
+<a name="38" href="#38">38</a> <strong class="jxr_keyword">import</strong> org.jdom.Document;
+<a name="39" href="#39">39</a> <strong class="jxr_keyword">import</strong> org.jdom.Element;
+<a name="40" href="#40">40</a> <strong class="jxr_keyword">import</strong> org.jdom.JDOMException;
+<a name="41" href="#41">41</a> <strong class="jxr_keyword">import</strong> org.jdom.Namespace;
+<a name="42" href="#42">42</a> <strong class="jxr_keyword">import</strong> org.jdom.input.SAXBuilder;
+<a name="43" href="#43">43</a> <strong class="jxr_keyword">import</strong> org.xml.sax.ContentHandler;
+<a name="44" href="#44">44</a> <strong class="jxr_keyword">import</strong> org.xml.sax.SAXException;
+<a name="45" href="#45">45</a>
+<a name="46" href="#46">46</a> <em class="jxr_javadoccomment">/**</em>
+<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> * OpenOffice parser</em>
+<a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> */</em>
+<a name="49" href="#49">49</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/tika/parser/opendocument/OpenOfficeParser.html">OpenOfficeParser</a> implements <a href="../../../../../org/apache/tika/parser/Parser.html">Parser</a> {
+<a name="50" href="#50">50</a> <strong class="jxr_keyword">static</strong> Logger logger = Logger.getRootLogger();
+<a name="51" href="#51">51</a>
+<a name="52" href="#52">52</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> Namespace NS_DC = Namespace.getNamespace(<span class="jxr_string">"dc"</span>,
+<a name="53" href="#53">53</a> <span class="jxr_string">"http://purl.org/dc/elements/1.1/"</span>);
+<a name="54" href="#54">54</a>
+<a name="55" href="#55">55</a> <strong class="jxr_keyword">public</strong> org.jdom.Document parse(InputStream is) {
+<a name="56" href="#56">56</a> Document xmlDoc = <strong class="jxr_keyword">new</strong> org.jdom.Document();
+<a name="57" href="#57">57</a> org.jdom.Document xmlMeta = <strong class="jxr_keyword">new</strong> org.jdom.Document();
+<a name="58" href="#58">58</a> <strong class="jxr_keyword">try</strong> {
+<a name="59" href="#59">59</a> List files = unzip(is);
+<a name="60" href="#60">60</a> SAXBuilder builder = <strong class="jxr_keyword">new</strong> SAXBuilder();
+<a name="61" href="#61">61</a> builder.setEntityResolver(<strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/parser/opendocument/OpenOfficeEntityResolver.html">OpenOfficeEntityResolver</a>());
+<a name="62" href="#62">62</a> builder.setValidation(false);
+<a name="63" href="#63">63</a>
+<a name="64" href="#64">64</a> xmlDoc = builder.build((InputStream) files.get(0));
+<a name="65" href="#65">65</a> xmlMeta = builder.build((InputStream) files.get(1));
+<a name="66" href="#66">66</a> Element rootMeta = xmlMeta.getRootElement();
+<a name="67" href="#67">67</a> Element meta = <strong class="jxr_keyword">null</strong>;
+<a name="68" href="#68">68</a> List ls = rootMeta.getChildren();
+<a name="69" href="#69">69</a> <strong class="jxr_keyword">if</strong> (! ls.isEmpty()) {
+<a name="70" href="#70">70</a> meta = (Element) ls.get(0);
+<a name="71" href="#71">71</a> }
+<a name="72" href="#72">72</a> xmlDoc.getRootElement().addContent(meta.detach());
+<a name="73" href="#73">73</a> xmlDoc.getRootElement().addNamespaceDeclaration(NS_DC);
+<a name="74" href="#74">74</a> } <strong class="jxr_keyword">catch</strong> (JDOMException e) {
+<a name="75" href="#75">75</a> logger.error(e.getMessage());
+<a name="76" href="#76">76</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="77" href="#77">77</a> logger.error(e.getMessage());
+<a name="78" href="#78">78</a> }
+<a name="79" href="#79">79</a> <strong class="jxr_keyword">return</strong> xmlDoc;
+<a name="80" href="#80">80</a> }
+<a name="81" href="#81">81</a>
+<a name="82" href="#82">82</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> parse(
+<a name="83" href="#83">83</a> InputStream stream, ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
+<a name="84" href="#84">84</a> <strong class="jxr_keyword">throws</strong> IOException, SAXException, <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a> {
+<a name="85" href="#85">85</a> Document xmlDoc = parse(stream);
+<a name="86" href="#86">86</a> <a href="../../../../../org/apache/tika/parser/xml/XMLParser.html">XMLParser</a> xp = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/parser/xml/XMLParser.html">XMLParser</a>();
+<a name="87" href="#87">87</a> xp.getAllDocumentNs(xmlDoc);
+<a name="88" href="#88">88</a> xp.extractContent(xmlDoc, Metadata.TITLE, <span class="jxr_string">"//dc:title"</span>, metadata);
+<a name="89" href="#89">89</a> xp.extractContent(xmlDoc, Metadata.SUBJECT, <span class="jxr_string">"//dc:subject"</span>, metadata);
+<a name="90" href="#90">90</a> xp.extractContent(xmlDoc, Metadata.CREATOR, <span class="jxr_string">"//dc:creator"</span>, metadata);
+<a name="91" href="#91">91</a> xp.extractContent(xmlDoc, Metadata.DESCRIPTION, <span class="jxr_string">"//dc:description"</span>, metadata);
+<a name="92" href="#92">92</a> xp.extractContent(xmlDoc, Metadata.LANGUAGE, <span class="jxr_string">"//dc:language"</span>, metadata);
+<a name="93" href="#93">93</a> xp.extractContent(xmlDoc, Metadata.KEYWORDS, <span class="jxr_string">"//meta:keyword"</span>, metadata);
+<a name="94" href="#94">94</a> xp.extractContent(xmlDoc, Metadata.DATE, <span class="jxr_string">"//dc:date"</span>, metadata);
+<a name="95" href="#95">95</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbTab"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:table-count"</span>, metadata);
+<a name="96" href="#96">96</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbObject"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:object-count"</span>, metadata);
+<a name="97" href="#97">97</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbImg"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:image-count"</span>, metadata);
+<a name="98" href="#98">98</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbPage"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:page-count"</span>, metadata);
+<a name="99" href="#99">99</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbPara"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:paragraph-count"</span>, metadata);
+<a name="100" href="#100">100</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbWord"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:word-count"</span>, metadata);
+<a name="101" href="#101">101</a> xp.extractContent(xmlDoc, <span class="jxr_string">"nbcharacter"</span>, <span class="jxr_string">"//meta:document-statistic/@meta:character-count"</span>, metadata);
+<a name="102" href="#102">102</a>
+<a name="103" href="#103">103</a> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a> xhtml = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a>(handler, metadata);
+<a name="104" href="#104">104</a> xhtml.startDocument();
+<a name="105" href="#105">105</a> xhtml.startElement(<span class="jxr_string">"p"</span>);
+<a name="106" href="#106">106</a> xp.concatOccurrence(xmlDoc, <span class="jxr_string">"//*"</span>, <span class="jxr_string">" "</span>, <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/sax/AppendableAdaptor.html">AppendableAdaptor</a>(xhtml));
+<a name="107" href="#107">107</a> xhtml.endElement(<span class="jxr_string">"p"</span>);
+<a name="108" href="#108">108</a> xhtml.endDocument();
+<a name="109" href="#109">109</a> }
+<a name="110" href="#110">110</a>
+<a name="111" href="#111">111</a> <strong class="jxr_keyword">public</strong> List unzip(InputStream is) {
+<a name="112" href="#112">112</a> List res = <strong class="jxr_keyword">new</strong> ArrayList();
+<a name="113" href="#113">113</a> <strong class="jxr_keyword">try</strong> {
+<a name="114" href="#114">114</a> ZipInputStream in = <strong class="jxr_keyword">new</strong> ZipInputStream(is);
+<a name="115" href="#115">115</a> ZipEntry entry = <strong class="jxr_keyword">null</strong>;
+<a name="116" href="#116">116</a> <strong class="jxr_keyword">while</strong> ((entry = in.getNextEntry()) != <strong class="jxr_keyword">null</strong>) {
+<a name="117" href="#117">117</a> <strong class="jxr_keyword">if</strong> (entry.getName().equals(<span class="jxr_string">"meta.xml"</span>)
+<a name="118" href="#118">118</a> || entry.getName().equals(<span class="jxr_string">"content.xml"</span>)) {
+<a name="119" href="#119">119</a> ByteArrayOutputStream stream = <strong class="jxr_keyword">new</strong> ByteArrayOutputStream();
+<a name="120" href="#120">120</a> byte[] buf = <strong class="jxr_keyword">new</strong> byte[1024];
+<a name="121" href="#121">121</a> <strong class="jxr_keyword">int</strong> len;
+<a name="122" href="#122">122</a> <strong class="jxr_keyword">while</strong> ((len = in.read(buf)) > 0) {
+<a name="123" href="#123">123</a> stream.write(buf, 0, len);
+<a name="124" href="#124">124</a> }
+<a name="125" href="#125">125</a> InputStream isEntry = <strong class="jxr_keyword">new</strong> ByteArrayInputStream(stream
+<a name="126" href="#126">126</a> .toByteArray());
+<a name="127" href="#127">127</a> res.add(isEntry);
+<a name="128" href="#128">128</a> }
+<a name="129" href="#129">129</a> }
+<a name="130" href="#130">130</a> in.close();
+<a name="131" href="#131">131</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="132" href="#132">132</a> logger.error(e.getMessage());
+<a name="133" href="#133">133</a> }
+<a name="134" href="#134">134</a> <strong class="jxr_keyword">return</strong> res;
+<a name="135" href="#135">135</a> }
+<a name="136" href="#136">136</a>
+<a name="137" href="#137">137</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> copyInputStream(InputStream in, OutputStream out)
+<a name="138" href="#138">138</a> <strong class="jxr_keyword">throws</strong> IOException {
+<a name="139" href="#139">139</a> byte[] buffer = <strong class="jxr_keyword">new</strong> byte[1024];
+<a name="140" href="#140">140</a> <strong class="jxr_keyword">int</strong> len;
<a name="141" href="#141">141</a>
-<a name="142" href="#142">142</a> in.close();
-<a name="143" href="#143">143</a> out.close();
-<a name="144" href="#144">144</a> }
-<a name="145" href="#145">145</a>
-<a name="146" href="#146">146</a> }
+<a name="142" href="#142">142</a> <strong class="jxr_keyword">while</strong> ((len = in.read(buffer)) >= 0)
+<a name="143" href="#143">143</a> out.write(buffer, 0, len);
+<a name="144" href="#144">144</a>
+<a name="145" href="#145">145</a> in.close();
+<a name="146" href="#146">146</a> out.close();
+<a name="147" href="#147">147</a> }
+<a name="148" href="#148">148</a>
+<a name="149" href="#149">149</a> }
</pre>
<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.opendocument</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.opendocument</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
Modified: incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/opendocument/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.opendocument</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.opendocument</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -67,6 +67,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="style" />
</head>
<body>
Modified: incubator/tika/site/xref/org/apache/tika/parser/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -87,6 +87,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/pdf/PDF2XHTML.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/pdf/PDF2XHTML.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/pdf/PDF2XHTML.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/pdf/PDF2XHTML.html Sun Jan 6 19:06:26 2008
@@ -28,128 +28,130 @@
<a name="18" href="#18">18</a>
<a name="19" href="#19">19</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
<a name="20" href="#20">20</a>
-<a name="21" href="#21">21</a> <strong class="jxr_keyword">import</strong> org.apache.tika.exception.TikaException;
-<a name="22" href="#22">22</a> <strong class="jxr_keyword">import</strong> org.apache.tika.metadata.Metadata;
-<a name="23" href="#23">23</a> <strong class="jxr_keyword">import</strong> org.apache.tika.sax.XHTMLContentHandler;
-<a name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> org.pdfbox.pdmodel.PDDocument;
-<a name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> org.pdfbox.pdmodel.PDPage;
-<a name="26" href="#26">26</a> <strong class="jxr_keyword">import</strong> org.pdfbox.util.PDFTextStripper;
-<a name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> org.pdfbox.util.TextPosition;
-<a name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> org.xml.sax.ContentHandler;
-<a name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> org.xml.sax.SAXException;
-<a name="30" href="#30">30</a>
-<a name="31" href="#31">31</a> <em class="jxr_javadoccomment">/**</em>
-<a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> * Utility class that overrides the {@link PDFTextStripper} functionality</em>
-<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> * to produce a semi-structured XHTML SAX events instead of a plain text</em>
-<a name="34" href="#34">34</a> <em class="jxr_javadoccomment"> * stream.</em>
-<a name="35" href="#35">35</a> <em class="jxr_javadoccomment"> */</em>
-<a name="36" href="#36">36</a> <strong class="jxr_keyword">class</strong> PDF2XHTML <strong class="jxr_keyword">extends</strong> PDFTextStripper {
-<a name="37" href="#37">37</a>
-<a name="38" href="#38">38</a> <em class="jxr_javadoccomment">/**</em>
-<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> * Converts the given PDF document (and related metadata) to a stream</em>
-<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> * of XHTML SAX events sent to the given content handler.</em>
-<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> * </em>
-<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * @param document PDF document</em>
-<a name="43" href="#43">43</a> <em class="jxr_javadoccomment"> * @param handler SAX content handler</em>
-<a name="44" href="#44">44</a> <em class="jxr_javadoccomment"> * @param metadata PDF metadata</em>
-<a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * @throws SAXException if the content handler fails to process SAX events</em>
-<a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * @throws TikaException if the PDF document can not be processed</em>
-<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> */</em>
-<a name="48" href="#48">48</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> process(
-<a name="49" href="#49">49</a> PDDocument document, ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
-<a name="50" href="#50">50</a> <strong class="jxr_keyword">throws</strong> SAXException, <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a> {
-<a name="51" href="#51">51</a> <strong class="jxr_keyword">try</strong> {
-<a name="52" href="#52">52</a> <strong class="jxr_keyword">new</strong> PDF2XHTML(handler, metadata).getText(document);
-<a name="53" href="#53">53</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
-<a name="54" href="#54">54</a> <strong class="jxr_keyword">if</strong> (e.getCause() instanceof SAXException) {
-<a name="55" href="#55">55</a> <strong class="jxr_keyword">throw</strong> (SAXException) e.getCause();
-<a name="56" href="#56">56</a> } <strong class="jxr_keyword">else</strong> {
-<a name="57" href="#57">57</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a>(<span class="jxr_string">"Unable to extract PDF content"</span>, e);
-<a name="58" href="#58">58</a> }
-<a name="59" href="#59">59</a> }
-<a name="60" href="#60">60</a> }
-<a name="61" href="#61">61</a>
-<a name="62" href="#62">62</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a> handler;
-<a name="63" href="#63">63</a>
-<a name="64" href="#64">64</a> <strong class="jxr_keyword">private</strong> PDF2XHTML(ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
-<a name="65" href="#65">65</a> <strong class="jxr_keyword">throws</strong> IOException {
-<a name="66" href="#66">66</a> <strong class="jxr_keyword">this</strong>.handler = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a>(handler, metadata);
-<a name="67" href="#67">67</a> }
-<a name="68" href="#68">68</a>
-<a name="69" href="#69">69</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startDocument(PDDocument pdf) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="70" href="#70">70</a> <strong class="jxr_keyword">try</strong> {
-<a name="71" href="#71">71</a> handler.startDocument();
-<a name="72" href="#72">72</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="73" href="#73">73</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to start a document: reason: "</span>+e.getMessage());
-<a name="74" href="#74">74</a> }
-<a name="75" href="#75">75</a> }
-<a name="76" href="#76">76</a>
-<a name="77" href="#77">77</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endDocument(PDDocument pdf) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="78" href="#78">78</a> <strong class="jxr_keyword">try</strong> {
-<a name="79" href="#79">79</a> handler.endDocument();
-<a name="80" href="#80">80</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="81" href="#81">81</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to end a document: reason: "</span>+e.getMessage());
-<a name="82" href="#82">82</a> }
-<a name="83" href="#83">83</a> }
-<a name="84" href="#84">84</a>
-<a name="85" href="#85">85</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startPage(PDPage page) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="86" href="#86">86</a> <strong class="jxr_keyword">try</strong> {
-<a name="87" href="#87">87</a> handler.startElement(<span class="jxr_string">"div"</span>);
-<a name="88" href="#88">88</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="89" href="#89">89</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to start a page: reason: "</span>+e.getMessage());
-<a name="90" href="#90">90</a> }
-<a name="91" href="#91">91</a> }
-<a name="92" href="#92">92</a>
-<a name="93" href="#93">93</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endPage(PDPage page) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="94" href="#94">94</a> <strong class="jxr_keyword">try</strong> {
-<a name="95" href="#95">95</a> handler.endElement(<span class="jxr_string">"div"</span>);
-<a name="96" href="#96">96</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="97" href="#97">97</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to end a page: reason: "</span>+e.getMessage());
-<a name="98" href="#98">98</a> }
-<a name="99" href="#99">99</a> }
-<a name="100" href="#100">100</a>
-<a name="101" href="#101">101</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startParagraph() <strong class="jxr_keyword">throws</strong> IOException {
-<a name="102" href="#102">102</a> <strong class="jxr_keyword">try</strong> {
-<a name="103" href="#103">103</a> handler.startElement(<span class="jxr_string">"p"</span>);
-<a name="104" href="#104">104</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="105" href="#105">105</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to start a paragraph: reason: "</span>+e.getMessage());
-<a name="106" href="#106">106</a> }
-<a name="107" href="#107">107</a> }
-<a name="108" href="#108">108</a>
-<a name="109" href="#109">109</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endParagraph() <strong class="jxr_keyword">throws</strong> IOException {
-<a name="110" href="#110">110</a> <strong class="jxr_keyword">try</strong> {
-<a name="111" href="#111">111</a> handler.endElement(<span class="jxr_string">"p"</span>);
-<a name="112" href="#112">112</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="113" href="#113">113</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to end a paragraph: reason: "</span>+e.getMessage());
-<a name="114" href="#114">114</a> }
-<a name="115" href="#115">115</a> }
-<a name="116" href="#116">116</a>
-<a name="117" href="#117">117</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> writeCharacters(TextPosition text) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="118" href="#118">118</a> <strong class="jxr_keyword">try</strong> {
-<a name="119" href="#119">119</a> handler.characters(text.getCharacter());
-<a name="120" href="#120">120</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="121" href="#121">121</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to write a newline: reason: "</span>+e.getMessage());
-<a name="122" href="#122">122</a> }
-<a name="123" href="#123">123</a> }
-<a name="124" href="#124">124</a>
-<a name="125" href="#125">125</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> processLineSeparator(TextPosition p) <strong class="jxr_keyword">throws</strong> IOException {
-<a name="126" href="#126">126</a> <strong class="jxr_keyword">try</strong> {
-<a name="127" href="#127">127</a> handler.characters(<span class="jxr_string">"\n"</span>);
-<a name="128" href="#128">128</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="129" href="#129">129</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to write a newline: reason: "</span>+e.getMessage());
-<a name="130" href="#130">130</a> }
-<a name="131" href="#131">131</a> }
-<a name="132" href="#132">132</a>
-<a name="133" href="#133">133</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> processWordSeparator(TextPosition a, TextPosition b)
-<a name="134" href="#134">134</a> <strong class="jxr_keyword">throws</strong> IOException {
-<a name="135" href="#135">135</a> <strong class="jxr_keyword">try</strong> {
-<a name="136" href="#136">136</a> handler.characters(<span class="jxr_string">" "</span>);
-<a name="137" href="#137">137</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
-<a name="138" href="#138">138</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Unable to write a space: reason: "</span>+e.getMessage());
-<a name="139" href="#139">139</a> }
-<a name="140" href="#140">140</a> }
-<a name="141" href="#141">141</a>
-<a name="142" href="#142">142</a> }
+<a name="21" href="#21">21</a> <strong class="jxr_keyword">import</strong> org.apache.tika.exception.CauseIOException;
+<a name="22" href="#22">22</a> <strong class="jxr_keyword">import</strong> org.apache.tika.exception.TikaException;
+<a name="23" href="#23">23</a> <strong class="jxr_keyword">import</strong> org.apache.tika.metadata.Metadata;
+<a name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> org.apache.tika.sax.XHTMLContentHandler;
+<a name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> org.pdfbox.pdmodel.PDDocument;
+<a name="26" href="#26">26</a> <strong class="jxr_keyword">import</strong> org.pdfbox.pdmodel.PDPage;
+<a name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> org.pdfbox.util.PDFTextStripper;
+<a name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> org.pdfbox.util.TextPosition;
+<a name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> org.xml.sax.ContentHandler;
+<a name="30" href="#30">30</a> <strong class="jxr_keyword">import</strong> org.xml.sax.SAXException;
+<a name="31" href="#31">31</a>
+<a name="32" href="#32">32</a> <em class="jxr_javadoccomment">/**</em>
+<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> * Utility class that overrides the {@link PDFTextStripper} functionality</em>
+<a name="34" href="#34">34</a> <em class="jxr_javadoccomment"> * to produce a semi-structured XHTML SAX events instead of a plain text</em>
+<a name="35" href="#35">35</a> <em class="jxr_javadoccomment"> * stream.</em>
+<a name="36" href="#36">36</a> <em class="jxr_javadoccomment"> */</em>
+<a name="37" href="#37">37</a> <strong class="jxr_keyword">class</strong> PDF2XHTML <strong class="jxr_keyword">extends</strong> PDFTextStripper {
+<a name="38" href="#38">38</a>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment">/**</em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> * Converts the given PDF document (and related metadata) to a stream</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> * of XHTML SAX events sent to the given content handler.</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * </em>
+<a name="43" href="#43">43</a> <em class="jxr_javadoccomment"> * @param document PDF document</em>
+<a name="44" href="#44">44</a> <em class="jxr_javadoccomment"> * @param handler SAX content handler</em>
+<a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * @param metadata PDF metadata</em>
+<a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * @throws SAXException if the content handler fails to process SAX events</em>
+<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> * @throws TikaException if the PDF document can not be processed</em>
+<a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> */</em>
+<a name="49" href="#49">49</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> process(
+<a name="50" href="#50">50</a> PDDocument document, ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
+<a name="51" href="#51">51</a> <strong class="jxr_keyword">throws</strong> SAXException, <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a> {
+<a name="52" href="#52">52</a> <strong class="jxr_keyword">try</strong> {
+<a name="53" href="#53">53</a> <strong class="jxr_keyword">new</strong> PDF2XHTML(handler, metadata).getText(document);
+<a name="54" href="#54">54</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="55" href="#55">55</a> <strong class="jxr_keyword">if</strong> (e.getCause() instanceof SAXException) {
+<a name="56" href="#56">56</a> <strong class="jxr_keyword">throw</strong> (SAXException) e.getCause();
+<a name="57" href="#57">57</a> } <strong class="jxr_keyword">else</strong> {
+<a name="58" href="#58">58</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/TikaException.html">TikaException</a>(<span class="jxr_string">"Unable to extract PDF content"</span>, e);
+<a name="59" href="#59">59</a> }
+<a name="60" href="#60">60</a> }
+<a name="61" href="#61">61</a> }
+<a name="62" href="#62">62</a>
+<a name="63" href="#63">63</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a> handler;
+<a name="64" href="#64">64</a>
+<a name="65" href="#65">65</a> <strong class="jxr_keyword">private</strong> PDF2XHTML(ContentHandler handler, <a href="../../../../../org/apache/tika/metadata/Metadata.html">Metadata</a> metadata)
+<a name="66" href="#66">66</a> <strong class="jxr_keyword">throws</strong> IOException {
+<a name="67" href="#67">67</a> <strong class="jxr_keyword">this</strong>.handler = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/sax/XHTMLContentHandler.html">XHTMLContentHandler</a>(handler, metadata);
+<a name="68" href="#68">68</a> }
+<a name="69" href="#69">69</a>
+<a name="70" href="#70">70</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startDocument(PDDocument pdf) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="71" href="#71">71</a> <strong class="jxr_keyword">try</strong> {
+<a name="72" href="#72">72</a> handler.startDocument();
+<a name="73" href="#73">73</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="74" href="#74">74</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to start a document"</span>, e);
+<a name="75" href="#75">75</a> }
+<a name="76" href="#76">76</a> }
+<a name="77" href="#77">77</a>
+<a name="78" href="#78">78</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endDocument(PDDocument pdf) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="79" href="#79">79</a> <strong class="jxr_keyword">try</strong> {
+<a name="80" href="#80">80</a> handler.endDocument();
+<a name="81" href="#81">81</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="82" href="#82">82</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to end a document"</span>, e);
+<a name="83" href="#83">83</a> }
+<a name="84" href="#84">84</a> }
+<a name="85" href="#85">85</a>
+<a name="86" href="#86">86</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startPage(PDPage page) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="87" href="#87">87</a> <strong class="jxr_keyword">try</strong> {
+<a name="88" href="#88">88</a> handler.startElement(<span class="jxr_string">"div"</span>);
+<a name="89" href="#89">89</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="90" href="#90">90</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to start a page"</span>, e);
+<a name="91" href="#91">91</a> }
+<a name="92" href="#92">92</a> }
+<a name="93" href="#93">93</a>
+<a name="94" href="#94">94</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endPage(PDPage page) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="95" href="#95">95</a> <strong class="jxr_keyword">try</strong> {
+<a name="96" href="#96">96</a> handler.endElement(<span class="jxr_string">"div"</span>);
+<a name="97" href="#97">97</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="98" href="#98">98</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to end a page"</span>, e);
+<a name="99" href="#99">99</a> }
+<a name="100" href="#100">100</a> }
+<a name="101" href="#101">101</a>
+<a name="102" href="#102">102</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> startParagraph() <strong class="jxr_keyword">throws</strong> IOException {
+<a name="103" href="#103">103</a> <strong class="jxr_keyword">try</strong> {
+<a name="104" href="#104">104</a> handler.startElement(<span class="jxr_string">"p"</span>);
+<a name="105" href="#105">105</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="106" href="#106">106</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to start a paragraph"</span>, e);
+<a name="107" href="#107">107</a> }
+<a name="108" href="#108">108</a> }
+<a name="109" href="#109">109</a>
+<a name="110" href="#110">110</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> endParagraph() <strong class="jxr_keyword">throws</strong> IOException {
+<a name="111" href="#111">111</a> <strong class="jxr_keyword">try</strong> {
+<a name="112" href="#112">112</a> handler.endElement(<span class="jxr_string">"p"</span>);
+<a name="113" href="#113">113</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="114" href="#114">114</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to end a paragraph"</span>, e);
+<a name="115" href="#115">115</a> }
+<a name="116" href="#116">116</a> }
+<a name="117" href="#117">117</a>
+<a name="118" href="#118">118</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> writeCharacters(TextPosition text) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="119" href="#119">119</a> <strong class="jxr_keyword">try</strong> {
+<a name="120" href="#120">120</a> handler.characters(text.getCharacter());
+<a name="121" href="#121">121</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="122" href="#122">122</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(
+<a name="123" href="#123">123</a> <span class="jxr_string">"Unable to write a character: "</span> + text.getCharacter(), e);
+<a name="124" href="#124">124</a> }
+<a name="125" href="#125">125</a> }
+<a name="126" href="#126">126</a>
+<a name="127" href="#127">127</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> processLineSeparator(TextPosition p) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="128" href="#128">128</a> <strong class="jxr_keyword">try</strong> {
+<a name="129" href="#129">129</a> handler.characters(<span class="jxr_string">"\n"</span>);
+<a name="130" href="#130">130</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="131" href="#131">131</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to write a newline"</span>, e);
+<a name="132" href="#132">132</a> }
+<a name="133" href="#133">133</a> }
+<a name="134" href="#134">134</a>
+<a name="135" href="#135">135</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> processWordSeparator(TextPosition a, TextPosition b)
+<a name="136" href="#136">136</a> <strong class="jxr_keyword">throws</strong> IOException {
+<a name="137" href="#137">137</a> <strong class="jxr_keyword">try</strong> {
+<a name="138" href="#138">138</a> handler.characters(<span class="jxr_string">" "</span>);
+<a name="139" href="#139">139</a> } <strong class="jxr_keyword">catch</strong> (SAXException e) {
+<a name="140" href="#140">140</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/tika/exception/CauseIOException.html">CauseIOException</a>(<span class="jxr_string">"Unable to write a space"</span>, e);
+<a name="141" href="#141">141</a> }
+<a name="142" href="#142">142</a> }
+<a name="143" href="#143">143</a>
+<a name="144" href="#144">144</a> }
</pre>
<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/pdf/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/pdf/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/pdf/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/pdf/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.pdf</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.pdf</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
Modified: incubator/tika/site/xref/org/apache/tika/parser/pdf/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/pdf/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/pdf/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/pdf/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.pdf</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.pdf</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -67,6 +67,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/rtf/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/rtf/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/rtf/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/rtf/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.rtf</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.rtf</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
Modified: incubator/tika/site/xref/org/apache/tika/parser/rtf/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/rtf/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/rtf/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/rtf/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.rtf</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.rtf</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -62,6 +62,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>
Modified: incubator/tika/site/xref/org/apache/tika/parser/txt/package-frame.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/txt/package-frame.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/txt/package-frame.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/txt/package-frame.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.txt</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.txt</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
Modified: incubator/tika/site/xref/org/apache/tika/parser/txt/package-summary.html
URL: http://svn.apache.org/viewvc/incubator/tika/site/xref/org/apache/tika/parser/txt/package-summary.html?rev=609491&r1=609490&r2=609491&view=diff
==============================================================================
--- incubator/tika/site/xref/org/apache/tika/parser/txt/package-summary.html (original)
+++ incubator/tika/site/xref/org/apache/tika/parser/txt/package-summary.html Sun Jan 6 19:06:26 2008
@@ -3,7 +3,7 @@
<html xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
- <title>Apache Tika 0.1-SNAPSHOT Reference Package org.apache.tika.parser.txt</title>
+ <title>Apache Tika 0.2-SNAPSHOT Reference Package org.apache.tika.parser.txt</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" />
</head>
<body>
@@ -62,6 +62,6 @@
</ul>
</div>
<hr />
- Copyright © 2007 The Apache Software Foundation. All Rights Reserved.
+ Copyright © 2008 The Apache Software Foundation. All Rights Reserved.
</body>
</html>