Rick

I'm very busy until the end of July
but I have writen various adapters to XML parsers (kxml, kxml2 and jaxp) for the metadata parser used in the OBR and in fact they are originally based on the humberto' org.apache.felix.servicebinder.parser.KxmlParser
Jan may reuse quickly those adapters (in attachment).
Best regards

Didier

PS: My ICLA is signed and faxed !

Richard S. Hall wrote:

Excellent. Post here if you have any questions.

I believe the XML parsing code is fairly localized in SB... You might even look at how the XML parsing is performed in SCR, since it evolved from SB.

Thanks a lot.

-> richard

Jan S. Rellermeyer wrote:

I have used both versions of kXML in past projects. If you agree, I will try to port it to the new version over the weekend.
Jan.
-----------------------------------------------------------
ETH Zurich, MSc Jan S. Rellermeyer, Information and Communication Systems Research Group (IKS), Department of Computer Science, IFW B 47.1, Haldeneggsteig 4, CH–8092 Zürich
Tel +41 44 632 30 38, http://www.iks.inf.ethz.ch
-----------------------------------------------------------
-----Original Message-----
From: Richard S. Hall [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 11, 2006 10:52 AM
To: [email protected]
Subject: Re: KXML License

I agree that we have two options:

   1. Nuking SB from the repo.
   2. Porting SB to kxml2.

Since our SCR impl uses kxml2 and is simply a modified version of SB, it seems like it would be simple to modify SB to use kxml2...the main issue is finding someone who has the time to do it. I know Humberto is very busy at this point in time...

-> richard

Marcel Offermans wrote:
From memory, the service binder is currently the only one

still using
kXML 1.x (which has this "problematic" license). Several

other bundles
have already been migrated to kXML 2.x (which has a different license). I have no experience with either version of the

library, so
I don't know if it is easy to migrate from 1.x to 2.x but I

do believe
that is the way to go. Perhaps Humberto or Richard can have

a look at
this (or somebody else with kXML experience)?

On Jul 10, 2006, at 23:49 , Upayavira wrote:

I am concerned about the license for KXML, which I believe we use.

From my uneducated reading of the below clause [1] (which is taken from Enhydra 1.0, I can't yet find a copy of 1.1), we cannot use KXML, as it places a requirement upon us that we offer

modifications
public and notifying the originator. This is a requirement

on top of
those in the ASL and is therefore not compatible.

So, how do we deal with this? How possible is it to

replace KXML with
something else, assuming my interpretation is correct?

Regards, Upayavira

[1]
3.2. Availability of Source Code.
Any Modification which You create or to which You

contribute must be
made available in Source Code form under the terms of this License either on the same media as an Executable version or via

an accepted
Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available,

or at least
six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for notifying the Initial Developer of the

Modification
and the location of the Source Code if a contact means is

provided.
Lutris will be acting as maintainer of the Source Code and may provide an Electronic Distribution mechanism for the

Modification to
be made available. You can contact Lutris to make the Modification available and to notify the Initial Developer. (http://www.lutris.com/)








--
---------------------------------------------------------
Didier DONSEZ
Laboratoire LSR, Institut Imag, Universite Joseph Fourier
Bat. C, 220 rue de la Chimie, Domaine Universitaire
BP 53, 38041 Grenoble Cedex 9, France
GPS : lat 45°11'38.3"N, lon 05°46'14.7"E, alt 223m
Tel : +33 4 76 63 55 49           Fax : +33 4 76 63 55 50
mailto:[EMAIL PROTECTED]
URL: http://www-adele.imag.fr/~donsez
---------------------------------------------------------

/*
 * This package adds SAX like parser to kXML 
 *
 * This program is licensed under the Apache Software License
 * version 1.1; refer to the ASL-LICENSE.txt file included with
 * this program for details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Contact: Didier Donsez <[EMAIL PROTECTED]>
 *
**/

package kxml.sax;

import java.io.IOException;
import java.io.Reader;
import java.util.Properties;

import org.kxml.Attribute;
import org.kxml.Xml;
import org.kxml.parser.ParseEvent;
import org.kxml.parser.XmlParser;

/**
 * The KXmlSAXParser extends the XmlParser from kxml (which does not take into 
account the DTD)
 *
 * @version     1.0 08 Nov 2002
 * @version     1.1 24 Apr 2004
 * @author      Humberto Cervantes, Didier Donsez
 */
public class KXmlSAXParser extends XmlParser {
        
        public String uri="uri";

        /**
        * The constructor for a parser, it receives a java.io.Reader.
        *
        * @param   reader  The reader
        * @exception   IOException thrown by the superclass
        */
        public KXmlSAXParser(Reader reader) throws IOException {
                super(reader);
        }

        /**
        * parse from the reader provided in the constructor, and call
        * the startElement and endElement in the handler
        *
        * @param   handler  The handler
        * @exception   Exception thrown by the superclass
        */
        public void parseXML(KXmlSAXHandler handler) throws Exception {
                ParseEvent evt = null;
                do {
                        evt = read();
                        handler.setLineNumber(getLineNumber());
                        handler.setColumnNumber(getColumnNumber());
                        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(
                                        evt.getNamespace(),
                                        evt.getName(),
                                        evt.getName(),
                                        props);
                        } else if (evt.getType() == Xml.END_TAG) {
                                handler.endElement(evt.getNamespace(), 
evt.getName(), evt.getName());
                        } else if (evt.getType() == Xml.TEXT) {
                                String text = evt.getText();
                                
handler.characters(text.toCharArray(),0,text.length());
                        } else if (evt.getType() == Xml.PROCESSING_INSTRUCTION) 
{
                                // TODO extract the target from the 
evt.getText()
                                
handler.processingInstruction(null,evt.getText()); 
                        } else {
                                // do nothing
                        }
                } while (evt.getType() != Xml.END_DOCUMENT);
        }       
}
/*
 * This package adds SAX like parser to kXML 
 *
 * This program is licensed under the Apache Software License
 * version 1.1; refer to the ASL-LICENSE.txt file included with
 * this program for details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Contact: Didier Donsez ([EMAIL PROTECTED])
 *
**/

package kxml.sax;

import java.util.Properties;

/**
 * Interface for SAX handler with kXML
 *
 * @author Didier Donsez ([EMAIL PROTECTED])
 */
public interface KXmlSAXHandler {

        /**
        * Method called when parsing text
        *
        * @param   ch
        * @param   offset
        * @param   length
        * @exception   SAXException
        */
        public void characters(char[] ch, int offset, int length) throws 
Exception;

        /**
        * Method called when a tag opens
        *
        * @param   uri
        * @param   localName
        * @param   qName
        * @param   attrib
        * @exception   SAXException
        **/
        public void startElement(
                String uri,
                String localName,
                String qName,
                Properties attrib)
                throws Exception;
        /**
        * Method called when a tag closes
        *
        * @param   uri
        * @param   localName
        * @param   qName
        * @exception   SAXException
        */
        public void endElement(
                java.lang.String uri,
                java.lang.String localName,
                java.lang.String qName)
                throws Exception;

        public void processingInstruction(String target,
                                                                          
String data)
                                                           throws Exception;
                
        public void setLineNumber(int lineNumber);

        public void setColumnNumber(int columnNumber);
}
/*
 * This package adds SAX like parser to kXML 
 *
 * This program is licensed under the Apache Software License
 * version 1.1; refer to the ASL-LICENSE.txt file included with
 * this program for details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Contact: Didier Donsez ([EMAIL PROTECTED])
 *
**/

package org.kxml2.sax;

import java.util.Properties;

/**
 * Interface for SAX handler with kXML
 *
 * @author Didier Donsez ([EMAIL PROTECTED])
 */
public interface KXml2SAXHandler {

        /**
        * Method called when parsing text
        *
        * @param   ch
        * @param   offset
        * @param   length
        * @exception   SAXException
        */
        public void characters(char[] ch, int offset, int length) throws 
Exception;

        /**
        * Method called when a tag opens
        *
        * @param   uri
        * @param   localName
        * @param   qName
        * @param   attrib
        * @exception   SAXException
        **/
        public void startElement(
                String uri,
                String localName,
                String qName,
                Properties attrib)
                throws Exception;
        /**
        * Method called when a tag closes
        *
        * @param   uri
        * @param   localName
        * @param   qName
        * @exception   SAXException
        */
        public void endElement(
                java.lang.String uri,
                java.lang.String localName,
                java.lang.String qName)
                throws Exception;

        public void processingInstruction(String target,
                                                                          
String data)
                                                           throws Exception;
                
        public void setLineNumber(int lineNumber);

        public void setColumnNumber(int columnNumber);
}
/*
 * This package adds SAX like parser to kXML2 
 *
 * This program is licensed under the Apache Software License
 * version 1.1; refer to the ASL-LICENSE.txt file included with
 * this program for details.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * Contact: Didier Donsez <[EMAIL PROTECTED]>
 *
**/

package org.kxml2.sax;

import java.io.Reader;
import java.util.Properties;

import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

/**
 * The KXml2SAXParser extends the XmlParser from kxml2 (which  does not take 
into account the DTD).
 *
 * @version     1.0 08 Nov 2002
 * @version     1.1 24 Apr 2004
 * @version     1.2 12 Apr 2006
 * @author      Humberto Cervantes, Didier Donsez
 */
public class KXml2SAXParser extends KXmlParser {
        
        public String uri="uri";

        /**
        * The constructor for a parser, it receives a java.io.Reader.
        *
        * @param   reader  The reader
        * @throws XmlPullParserException 
        */
        public KXml2SAXParser(Reader reader) throws XmlPullParserException {
                super();
            setInput(reader);
        }
        
        /**
        * parse from the reader provided in the constructor, and call
        * the startElement and endElement in the handler
        *
        * @param   handler  The handler
        * @exception   Exception thrown by the superclass
        */
        public void parseXML(KXml2SAXHandler handler) throws Exception {

                while (next() != XmlPullParser.END_DOCUMENT) {
                        handler.setLineNumber(getLineNumber());
                        handler.setColumnNumber(getColumnNumber());
                        if (getEventType() == 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);
                        } else if (getEventType() == XmlPullParser.END_TAG) {
                                handler.endElement(getNamespace(), getName(), 
getName());
                        } else if (getEventType() == XmlPullParser.TEXT) {
                                String text = getText();
                                
handler.characters(text.toCharArray(),0,text.length());
                        } else if (getEventType() == 
XmlPullParser.PROCESSING_INSTRUCTION) {
                                // TODO extract the target from the 
evt.getText()
                                handler.processingInstruction(null,getText()); 
                        } else {
                                // do nothing
                        }
                }
        }       
}

Reply via email to