changeset 138:d18b0ff52b07

*** empty log message ***
author robcast
date Sat, 12 Jul 2003 01:26:56 +0200
parents 4f1752d80560
children 11cfe4c89fdc
files servlet/src/digilib/io/XMLListLoader.java
diffstat 1 files changed, 10 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/io/XMLListLoader.java	Tue Jul 08 03:05:07 2003 +0200
+++ b/servlet/src/digilib/io/XMLListLoader.java	Sat Jul 12 01:26:56 2003 +0200
@@ -63,7 +63,7 @@
 	private class XMLListParser extends XMLFilterImpl {
 
 		private HashMap listData;
-		private LinkedList nameSpace;
+		private LinkedList tagSpace;
 
 		public HashMap getData() {
 			return listData;
@@ -72,7 +72,7 @@
 		// Parser calls this once at the beginning of a document
 		public void startDocument() throws SAXException {
 			listData = new HashMap();
-			nameSpace = new LinkedList();
+			tagSpace = new LinkedList();
 		}
 
 		// Parser calls this for each element in a document
@@ -84,12 +84,12 @@
 			throws SAXException {
 			//System.out.println("<"+qName);
 			// open a new namespace
-			nameSpace.addLast(qName);
+			tagSpace.addLast(qName);
 
 			// ist it an entry tag?
 			if (qName.equals(entryTag)) {
 				// is it inside a list tag?
-				if ((listTag.length() > 0) && (!nameSpace.contains(listTag))) {
+				if ((listTag.length() > 0) && (!tagSpace.contains(listTag))) {
 					System.out.println(
 						"BOO: Entry "
 							+ entryTag
@@ -131,7 +131,7 @@
 			String qName)
 			throws SAXException {
 			// exit the namespace
-			nameSpace.removeLast();
+			tagSpace.removeLast();
 		}
 
 	}
@@ -144,15 +144,13 @@
 		//System.out.println("loadurl ("+path+")");
 		// Create a JAXP SAXParserFactory and configure it
 		SAXParserFactory spf = SAXParserFactory.newInstance();
-		//spf.setNamespaceAware(true);
+		spf.setNamespaceAware(true);
 
-		XMLReader xmlReader = null;
+		SAXParser parser = null;
 		try {
 			// Create a JAXP SAXParser
-			SAXParser saxParser = spf.newSAXParser();
+			parser = spf.newSAXParser();
 
-			// Get the encapsulated SAX XMLReader
-			xmlReader = saxParser.getXMLReader();
 		} catch (ParserConfigurationException e) {
 			throw new SAXException(e);
 		}
@@ -160,11 +158,8 @@
 		// create a list parser (keeps the data!)
 		XMLListParser listParser = new XMLListParser();
 
-		// Set the ContentHandler of the XMLReader
-		xmlReader.setContentHandler(listParser);
-
-		// Tell the XMLReader to parse the XML document
-		xmlReader.parse(path);
+		// Tell the SAXParser to parse the XML document
+		parser.parse(path, listParser);
 
 		return listParser.getData();
 	}