felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r422004 - in /incubator/felix/trunk/org.apache.felix.servicebinder: pom.xml src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java
Date Fri, 14 Jul 2006 19:52:53 GMT
Author: rickhall
Date: Fri Jul 14 12:52:53 2006
New Revision: 422004

URL: http://svn.apache.org/viewvc?rev=422004&view=rev
Log:
Patched Service Binder to use kxml2 to avoid licensing issues with
kxml1, thanks goes to Jan S. Rellermeyer. (FELIX-93)

Modified:
    incubator/felix/trunk/org.apache.felix.servicebinder/pom.xml
    incubator/felix/trunk/org.apache.felix.servicebinder/src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java

Modified: incubator/felix/trunk/org.apache.felix.servicebinder/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.servicebinder/pom.xml?rev=422004&r1=422003&r2=422004&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.servicebinder/pom.xml (original)
+++ incubator/felix/trunk/org.apache.felix.servicebinder/pom.xml Fri Jul 14 12:52:53 2006
@@ -16,9 +16,9 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>kxml</groupId>
-      <artifactId>kxml</artifactId>
-      <version>1.21</version>
+      <groupId>kxml2</groupId>
+      <artifactId>kxml2</artifactId>
+      <version>2.2.2</version>
     </dependency>
   </dependencies>
   <build>

Modified: incubator/felix/trunk/org.apache.felix.servicebinder/src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.servicebinder/src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java?rev=422004&r1=422003&r2=422004&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.servicebinder/src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java
(original)
+++ incubator/felix/trunk/org.apache.felix.servicebinder/src/main/java/org/apache/felix/servicebinder/parser/KxmlParser.java
Fri Jul 14 12:52:53 2006
@@ -17,13 +17,11 @@
 package org.apache.felix.servicebinder.parser;
 
 import org.apache.felix.servicebinder.XmlHandler;
-import org.kxml.parser.XmlParser;
-import org.kxml.parser.ParseEvent;
-import org.kxml.Xml;
-import org.kxml.Attribute;
-
+import org.kxml2.io.KXmlParser;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+import java.io.IOException;
 import java.io.Reader;
-
 import java.util.Properties;
 
 /**
@@ -32,46 +30,50 @@
  *
  * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
  */
-public class KxmlParser extends XmlParser
+public class KxmlParser extends KXmlParser
 {
     /**
-    * The constructor for a parser, it receives a java.io.Reader.
-    *
-    * @param   r  The reader
-    * @exception   java.io.IOException thrown by the superclass
-    */
-    public KxmlParser(Reader r) throws java.io.IOException
+     * The constructor for a parser, it receives a java.io.Reader.
+     * 
+     * @param reader The reader
+     * @throws XmlPullParserException thrown by the super class.
+     */
+    public KxmlParser(final Reader reader) throws XmlPullParserException
     {
-        super(r);
+        super();
+        setInput(reader);
     }
 
     /**
-    * Parser from the reader provided in the constructor, and call
-    * the startElement and endElement in a KxmlHandler
-    *
-    * @param   handler The handler
-    * @exception   java.io.IOException thrown by the superclass
-    */
-    public void parseXML(XmlHandler handler) throws java.io.IOException, ParseException
+     * Parser from the reader provided in the constructor, and call the
+     * startElement and endElement in a KxmlHandler
+     * 
+     * @param handler The handler
+     * @throws XmlPullParserException thrown by the super class.
+     * @throws IOException thrown by the super class.
+     * @throws ParseException thrown by the handler.
+     */
+    public void parseXML(final XmlHandler handler)
+        throws XmlPullParserException, IOException, ParseException
     {
-        ParseEvent evt=null;
-        do
+        while (next() != XmlPullParser.END_DOCUMENT)
         {
-            evt = read();
-            if (evt.getType() == Xml.START_TAG)
-            {
-                Properties props = new Properties();
-                for (int i=0; i<evt.getAttributeCount();i++)
-                {
-                    Attribute attr = evt.getAttribute(i);
-                    props.put(attr.getName(),attr.getValue());
-                }
-                handler.startElement("uri",evt.getName(),evt.getName(),props);
-            }
-            if (evt.getType() == Xml.END_TAG)
+            switch (getEventType())
             {
-                handler.endElement("uri",evt.getName(),evt.getName());
+                case XmlPullParser.START_TAG:
+                    Properties props = new Properties();
+                    for (int i = 0; i < getAttributeCount(); i++)
+                    {
+                        props.put(getAttributeName(i), getAttributeValue(i));
+                    }
+                    handler.startElement(getNamespace(), getName(), getName(), props);
+                    break;
+                case XmlPullParser.END_TAG:
+                    handler.endElement(getNamespace(), getName(), getName());
+                    break;
+                default:
+                    continue;
             }
-        }while(evt.getType()!=Xml.END_DOCUMENT);
+        }
     }
-}
+}
\ No newline at end of file



Mime
View raw message