ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/util/uk/org/iscream/cms/util/XMLStringParser.java
(Generate patch)

Comparing projects/cms/source/util/uk/org/iscream/cms/util/XMLStringParser.java (file contents):
Revision 1.5 by ajm, Tue Dec 12 20:44:30 2000 UTC vs.
Revision 1.8 by tdb, Sat Mar 10 00:49:39 2001 UTC

# Line 6 | Line 6 | import java.io.*;
6   import java.util.ArrayList;
7  
8   import org.xml.sax.*;
9 + import org.xml.sax.helpers.*;
10   import javax.xml.parsers.SAXParserFactory;
11   import javax.xml.parsers.ParserConfigurationException;
12   import javax.xml.parsers.SAXParser;
# Line 16 | Line 17 | import javax.xml.parsers.SAXParser;
17   * @author  $Author$
18   * @version $Id$
19   */
20 < public class XMLStringParser extends HandlerBase {
20 > public class XMLStringParser extends DefaultHandler {
21  
22   //---FINAL ATTRIBUTES---
23  
# Line 73 | Line 74 | public class XMLStringParser extends HandlerBase {
74       *     "packet.attributes.machine_name"
75       * within the XMLPacket.
76       */
77 <    public void startElement (String name, AttributeList attrs) throws SAXException {
77 >    public void startElement (String name, Attributes attrs) throws SAXException {
78          indentLevel++;
79          tagList.add(name);
80          if (attrs != null) {
81              for (int i = 0; i < attrs.getLength (); i++) {
82 <                packet.addParam(getPath()+".attributes."+attrs.getName(i), attrs.getValue(i));
82 >                packet.addParam(getPath()+".attributes."+attrs.getLocalName(i), attrs.getValue(i));
83              }
84          }
85      }
# Line 101 | Line 102 | public class XMLStringParser extends HandlerBase {
102       */
103      public void characters (char[] buf, int offset, int len) throws SAXException {
104          String s = new String(buf, offset, len);
105 <        if (!s.trim().equals("")) {
105 <            packet.addParam(getPath(), s);
106 <        }
105 >        packet.addParam(getPath(), s);
106      }
107  
108      /**
# Line 146 | Line 145 | public class XMLStringParser extends HandlerBase {
145  
146   //---ATTRIBUTES---
147  
148 +    /**
149 +     * To keep track of our identation level
150 +     */
151      private int indentLevel = 0;
152 +    
153 +    /**
154 +     * An ArrayList of tags
155 +     */
156      private ArrayList tagList = new ArrayList();
157 +    
158 +    /**
159 +     * A reference to the XMLPacket we are making
160 +     */
161      private XMLPacket packet;
162      
163      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines