Turn on namespace processing and simplify handler interface.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@565667 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/XmlHandler.java b/scr/src/main/java/org/apache/felix/scr/XmlHandler.java
index 6c50234..16c5593 100644
--- a/scr/src/main/java/org/apache/felix/scr/XmlHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/XmlHandler.java
@@ -50,11 +50,10 @@
      *
      * @param   uri
      * @param   localName
-     * @param   qName
      * @param   attrib
      * @exception   ParseException
     **/
-    public void startElement(String uri, String localName, String qName, Properties attrib)
+    public void startElement(String uri, String localName, Properties attrib)
     throws ParseException {
         // we process elements in the default namespace and in the scr namespace only
         // TODO - To be 100% correct we should only listen to the scr namespace
@@ -172,10 +171,9 @@
     *
     * @param   uri
     * @param   localName
-    * @param   qName
     * @exception   ParseException
     */
-    public void endElement(String uri, String localName, String qName) throws ParseException
+    public void endElement(String uri, String localName) throws ParseException
     {
         // we process elements in the default namespace and in the scr namespace only
         // TODO - To be 100% correct we should only listen to the scr namespace
@@ -204,30 +202,39 @@
         return this.m_components;
     }
 
-	public void characters( char[] ch, int offset, int length ) throws Exception
+	/**
+	 * @see org.apache.felix.scr.parser.KXml2SAXHandler#characters(java.lang.String)
+	 */
+	public void characters( String text ) throws ParseException
     {
         // 112.4.5 If the value attribute is not specified, the body must contain one or more values
         if ( this.m_pendingProperty != null )
         {
-            this.m_pendingProperty.setValues( new String( ch, offset, length ) );
+            this.m_pendingProperty.setValues( text );
             this.m_currentComponent.addProperty( this.m_pendingProperty );
             this.m_pendingProperty = null;
         }
     }
 
-	public void processingInstruction(String target, String data) throws Exception {
+	/**
+	 * @see org.apache.felix.scr.parser.KXml2SAXHandler#processingInstruction(java.lang.String, java.lang.String)
+	 */
+	public void processingInstruction(String target, String data) throws ParseException {
 		// Not used
-
 	}
 
+	/**
+	 * @see org.apache.felix.scr.parser.KXml2SAXHandler#setLineNumber(int)
+	 */
 	public void setLineNumber(int lineNumber) {
 		// Not used
-
 	}
 
+	/**
+	 * @see org.apache.felix.scr.parser.KXml2SAXHandler#setColumnNumber(int)
+	 */
 	public void setColumnNumber(int columnNumber) {
 		// Not used
-
 	}
 }
 
diff --git a/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXHandler.java b/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXHandler.java
index fd851aa..59b14aa 100644
--- a/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXHandler.java
+++ b/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXHandler.java
@@ -1,4 +1,4 @@
-/* 

+/*

  * Licensed to the Apache Software Foundation (ASF) under one

  * or more contributor license agreements.  See the NOTICE file

  * distributed with this work for additional information

@@ -21,54 +21,49 @@
 import java.util.Properties;

 

 /**

- * Interface for SAX handler with kXML

+ * Interface for a SAX like handler with kXML

  */

 public interface KXml2SAXHandler {

 

-	/**

+   /**

 	* Method called when parsing text

 	*

-	* @param   ch

-	* @param   offset

-	* @param   length

-	* @exception   SAXException

+	* @param   text

+	* @exception   ParseException

 	*/

-	public void characters(char[] ch, int offset, int length) throws Exception;

+   void characters(String text) throws ParseException;

 

-	/**

+   /**

 	* Method called when a tag opens

 	*

 	* @param   uri

 	* @param   localName

-	* @param   qName

 	* @param   attrib

-	* @exception   SAXException

-	**/

-	public void startElement(

+	* @exception   ParseException

+	*/

+	void startElement(

 		String uri,

 		String localName,

-		String qName,

 		Properties attrib)

-		throws Exception;

-	/**

+		throws ParseException;

+

+   /**

 	* Method called when a tag closes

 	*

 	* @param   uri

 	* @param   localName

-	* @param   qName

-	* @exception   SAXException

+	* @exception   ParseException

 	*/

-	public void endElement(

-		java.lang.String uri,

-		java.lang.String localName,

-		java.lang.String qName)

-		throws Exception;

+    void endElement(

+		String uri,

+		String localName)

+		throws ParseException;

 

-	public void processingInstruction(String target,

+    void processingInstruction(String target,

 									  String data)

 							   throws Exception;

-		

-	public void setLineNumber(int lineNumber);

 

-	public void setColumnNumber(int columnNumber);

+	void setLineNumber(int lineNumber);

+

+	void setColumnNumber(int columnNumber);

 }

diff --git a/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXParser.java b/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXParser.java
index 3808eb8..0ad5ea2 100644
--- a/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXParser.java
+++ b/scr/src/main/java/org/apache/felix/scr/parser/KXml2SAXParser.java
@@ -43,6 +43,7 @@
 	public KXml2SAXParser(Reader reader) throws XmlPullParserException {

 		super();

 	    this.setInput(reader);

+	    this.setFeature(FEATURE_PROCESS_NAMESPACES, true);

 	}

 

 	/**

@@ -65,13 +66,12 @@
 				handler.startElement(

 					this.getNamespace(),

 					this.getName(),

-					this.getName(),

 					props);

 			} else if (this.getEventType() == XmlPullParser.END_TAG) {

-				handler.endElement(this.getNamespace(), this.getName(), this.getName());

+				handler.endElement(this.getNamespace(), this.getName());

 			} else if (this.getEventType() == XmlPullParser.TEXT) {

 				String text = this.getText();

-				handler.characters(text.toCharArray(),0,text.length());

+				handler.characters(text);

 			} else if (this.getEventType() == XmlPullParser.PROCESSING_INSTRUCTION) {

 				// TODO extract the target from the evt.getText()

 				handler.processingInstruction(null,this.getText());