# HG changeset patch # User robcast # Date 1057966016 -7200 # Node ID d18b0ff52b07b171ea4212482d14d05b4cf0fc16 # Parent 4f1752d805602d1b4f742b8db13aa6174d995fda *** empty log message *** diff -r 4f1752d80560 -r d18b0ff52b07 servlet/src/digilib/io/XMLListLoader.java --- 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(); }