vgritsenko 2003/12/22 06:02:44
Modified: java/src/org/apache/xindice/tools/command AddDocument.java
ExportTree.java
Log:
TODO: Add binary support to command line tools
Revision Changes Path
1.10 +10 -10
xml-xindice/java/src/org/apache/xindice/tools/command/AddDocument.java
Index: AddDocument.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/AddDocument.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AddDocument.java 7 Aug 2003 20:13:24 -0000 1.9
+++ AddDocument.java 22 Dec 2003 14:02:44 -0000 1.10
@@ -60,6 +60,9 @@
package org.apache.xindice.tools.command;
import org.apache.xindice.tools.XMLTools;
+import org.apache.xindice.client.xmldb.xmlrpc.CollectionImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -103,7 +106,6 @@
}
try {
-
// Create a collection instance
String colstring = normalizeCollectionURI((String)
table.get(XMLTools.COLLECTION),
(String)
table.get(XMLTools.LOCAL));
@@ -114,21 +116,19 @@
}
// Parse in XML using Xerces
+ // TODO: BinaryResource support
File file = new File((String) table.get(XMLTools.FILE_PATH));
-
InputStream fis = new FileInputStream(file);
SAXParserFactory spf =
javax.xml.parsers.SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
- XMLReader saxReader = spf.newSAXParser().getXMLReader();
-
+ XMLReader reader = spf.newSAXParser().getXMLReader();
StringSerializer ser = new StringSerializer(null);
-
- saxReader.setContentHandler(ser);
-
saxReader.setProperty("http://xml.org/sax/properties/lexical-handler",
+ reader.setContentHandler(ser);
+
reader.setProperty("http://xml.org/sax/properties/lexical-handler",
ser);
- saxReader.parse(new InputSource(fis));
+ reader.parse(new InputSource(fis));
fis.close();
// Create the XMLResource and store the document
1.9 +3 -2
xml-xindice/java/src/org/apache/xindice/tools/command/ExportTree.java
Index: ExportTree.java
===================================================================
RCS file:
/home/cvs/xml-xindice/java/src/org/apache/xindice/tools/command/ExportTree.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ExportTree.java 7 Aug 2003 20:13:24 -0000 1.8
+++ ExportTree.java 22 Dec 2003 14:02:44 -0000 1.9
@@ -174,6 +174,7 @@
System.out.println("Extracting " + files.length + " files
from " +
(String) table.get(XMLTools.COLLECTION));
for (int j = 0; j < files.length; j++) {
+ // TODO: BinaryResource support
XMLResource res =
(XMLResource) col.getResource(files[j]);
String content = (String) res.getContent();