Hi,

I've attached a patch that allows commons-feedparser to be built against jdom 1.0. I've changed all references to XPath to JDOMXPath. Also in AtomFeedParser I've changed the call to new XMLOutputter(" ", true) to a call to the no argument constructor as the constructor being used is no longer available.

It all compiles and the unit tests seem to work (at least all the ones that work on checkout still work and the ones that failed still fail). I've also been testing feedparser with the patch in my own application and haven't come across any problems. Cheers,
Andrew McCall <cid:[email protected]>
Index: src/java/org/apache/commons/feedparser/AtomFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/AtomFeedParser.java  (revision 
365922)
+++ src/java/org/apache/commons/feedparser/AtomFeedParser.java  (working copy)
@@ -108,7 +108,7 @@
                                  FeedParserListener listener,
                                  org.jdom.Document doc ) throws Exception {
 
-        XPath xpath = new XPath( "/atom:feed/atom:entry" );
+        JDOMXPath xpath = new JDOMXPath( "/atom:feed/atom:entry" );
         xpath.setNamespaceContext( NS.context );
 
         List items = xpath.selectNodes( doc );
@@ -196,7 +196,7 @@
 
         LinkFeedParserListener lfpl = (LinkFeedParserListener)listener;
         
-        XPath xpath = new XPath( "atom:link" );
+        JDOMXPath xpath = new JDOMXPath( "atom:link" );
         xpath.setNamespaceContext( NS.context );
 
         List items = xpath.selectNodes( current );
@@ -230,7 +230,7 @@
         
         ContentFeedParserListener clistener = 
(ContentFeedParserListener)listener;
 
-        XPath xpath = new XPath( "atom:content" );
+        JDOMXPath xpath = new JDOMXPath( "atom:content" );
         xpath.setNamespaceContext( NS.context );
 
         List items = xpath.selectNodes( current );
@@ -273,7 +273,7 @@
             
         }
 
-        xpath = new XPath( "atom:[EMAIL PROTECTED]'application/xhtml+xml']" );
+        xpath = new JDOMXPath( "atom:[EMAIL 
PROTECTED]'application/xhtml+xml']" );
         xpath.setNamespaceContext( NS.context );
         Element e = (Element)xpath.selectSingleNode( current );
 
@@ -311,9 +311,11 @@
         //to do the same thing we do for xhtml:body RIGHT?
         
         StringBuffer buff = new StringBuffer( 10000 ); 
-                
-        XMLOutputter outputter = new XMLOutputter( "    ", true );
 
+        // NOTE: Changed this constructor to use the default Format. Since the
+        // constructor used no longer exists in jdom 1.0.
+        XMLOutputter outputter = new XMLOutputter();
+
         Iterator it = content.iterator();
         
         while ( it.hasNext() ) {
@@ -361,7 +363,7 @@
 
     private static Element selectSingleElement( String query, 
org.jdom.Document doc ) throws Exception {
 
-        XPath xpath = new XPath( query );
+        JDOMXPath xpath = new JDOMXPath( query );
         xpath.setNamespaceContext( NS.context );
         
         //perform onChannel method...  (title, link, description)
@@ -371,7 +373,7 @@
 
     private static String selectSingleAttribute( String query, Element element 
) throws Exception {
 
-        XPath xpath = new XPath( query );
+        JDOMXPath xpath = new JDOMXPath( query );
         xpath.setNamespaceContext( NS.context );
         
         //perform onChannel method...  (title, link, description)
Index: src/java/org/apache/commons/feedparser/BaseParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/BaseParser.java      (revision 
365922)
+++ src/java/org/apache/commons/feedparser/BaseParser.java      (working copy)
@@ -114,7 +114,7 @@
     //FIXME: unify this with RSSFeedParser.getChildElementTextByName
     protected static String selectText( String query, Element element ) throws 
Exception {
 
-        XPath xpath = new XPath( query );
+        JDOMXPath xpath = new JDOMXPath( query );
         xpath.setNamespaceContext( NS.context );
         
         //perform onChannel method...  (title, link, description)
@@ -144,7 +144,7 @@
 
         //FIXME: this can be rewritten to use getChild()
         
-        XPath xpath = new XPath( "descendant::*[local-name() = '" + name + 
"']" );
+        JDOMXPath xpath = new JDOMXPath( "descendant::*[local-name() = '" + 
name + "']" );
         Object resultNode = xpath.selectSingleNode( state.current );
 
         String resultText = null;
@@ -161,4 +161,4 @@
         
     }
 
-}
\ No newline at end of file
+}
Index: src/java/org/apache/commons/feedparser/ChangesFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/ChangesFeedParser.java       
(revision 365922)
+++ src/java/org/apache/commons/feedparser/ChangesFeedParser.java       
(working copy)
@@ -59,7 +59,7 @@
             FeedDirectoryParserListener fdpl = 
(FeedDirectoryParserListener)listener;
 
             //this should be the root directory.
-            XPath xpath = new XPath( "/weblogUpdates/weblog" );
+            JDOMXPath xpath = new JDOMXPath( "/weblogUpdates/weblog" );
             List list = xpath.selectNodes( doc );
 
             Iterator i = list.iterator();
Index: src/java/org/apache/commons/feedparser/FOAFFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/FOAFFeedParser.java  (revision 
365922)
+++ src/java/org/apache/commons/feedparser/FOAFFeedParser.java  (working copy)
@@ -56,7 +56,7 @@
                 flistener = (FOAFFeedParserListener)listener;
 
             //this should be the root directory.
-            XPath xpath = new XPath( "/rdf:RDF/foaf:Person" );
+            JDOMXPath xpath = new JDOMXPath( "/rdf:RDF/foaf:Person" );
             xpath.setNamespaceContext( NS.context );
             
             Element person = (Element)xpath.selectSingleNode( doc );
@@ -70,7 +70,7 @@
             if ( flistener != null )
                 flistener.onPerson( state, name );
             
-            xpath = new XPath( "foaf:knows" );
+            xpath = new JDOMXPath( "foaf:knows" );
 
             xpath.setNamespaceContext( NS.context );
 
Index: src/java/org/apache/commons/feedparser/OPMLFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/OPMLFeedParser.java  (revision 
365922)
+++ src/java/org/apache/commons/feedparser/OPMLFeedParser.java  (working copy)
@@ -62,7 +62,7 @@
             FeedDirectoryParserListener fdpl = 
(FeedDirectoryParserListener)listener;
 
             //this should be the root directory.
-            XPath xpath = new XPath( "/opml/body/outline" );
+            JDOMXPath xpath = new JDOMXPath( "/opml/body/outline" );
             List list = xpath.selectNodes( doc );
 
             Iterator i = list.iterator();
@@ -83,7 +83,7 @@
                                          FeedParserState state,
                                          Element current ) throws Exception {
 
-        XPath xpath = new XPath( "outline" );
+        JDOMXPath xpath = new JDOMXPath( "outline" );
         List list = xpath.selectNodes( current );
 
         Iterator i = list.iterator();
Index: src/java/org/apache/commons/feedparser/RSSFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/RSSFeedParser.java   (revision 
365922)
+++ src/java/org/apache/commons/feedparser/RSSFeedParser.java   (working copy)
@@ -60,7 +60,7 @@
         listener.init();
 
         //*** now process the channel. ***
-        XPath xpath = new XPath( "/descendant::*[local-name() = 'channel']" );
+        JDOMXPath xpath = new JDOMXPath( "/descendant::*[local-name() = 
'channel']" );
         Element channel = (Element)xpath.selectSingleNode( doc );
         state.current = channel;
 
@@ -69,7 +69,7 @@
         doLocaleEnd( state, listener, channel );
 
         //*** now process the image. ***
-        xpath = new XPath( "/descendant::*[local-name() = 'image']" );
+        xpath = new JDOMXPath( "/descendant::*[local-name() = 'image']" );
         List images = xpath.selectNodes( doc );
         Iterator i = images.iterator();
         //update items.
@@ -82,7 +82,7 @@
         }
 
         //*** now process all items. ***
-        xpath = new XPath( "/descendant::*[local-name() = 'item']" );
+        xpath = new JDOMXPath( "/descendant::*[local-name() = 'item']" );
 
         List items = xpath.selectNodes( doc );
 
@@ -159,7 +159,7 @@
 
         //FIXME: migrate this to XPath
 
-        XPath xpath = new XPath( 
"@rdf:resource|guid|descendant::*[local-name() = 'link']" );
+        JDOMXPath xpath = new JDOMXPath( 
"@rdf:resource|guid|descendant::*[local-name() = 'link']" );
         xpath.addNamespace( NS.RDF.getPrefix(), NS.RDF.getURI() );
         Object node = xpath.selectSingleNode( state.current );
 
Index: src/java/org/apache/commons/feedparser/TagFeedParser.java
===================================================================
--- src/java/org/apache/commons/feedparser/TagFeedParser.java   (revision 
365922)
+++ src/java/org/apache/commons/feedparser/TagFeedParser.java   (working copy)
@@ -76,7 +76,7 @@
     public static void doDcSubject( TagFeedParserListener listener, 
                                     FeedParserState state ) throws Exception {
 
-        XPath xpath = new XPath( "dc:subject" );
+        JDOMXPath xpath = new JDOMXPath( "dc:subject" );
         xpath.addNamespace( NS.DC.getPrefix(), NS.DC.getURI() );
         
         List list = xpath.selectNodes( state.current );
@@ -107,7 +107,7 @@
 
         //XPath xpath = new XPath( "local-name() = 'category'" );
 
-        XPath xpath = new XPath( "descendant::*[local-name() = 'category']" );
+        JDOMXPath xpath = new JDOMXPath( "descendant::*[local-name() = 
'category']" );
 
         //NOTE: this only works for elements without namespaces
         //XPath xpath = new XPath( "category" );
@@ -152,7 +152,7 @@
         //      </rdf:Bag>
         //  </taxo:topics>
  
-        XPath xpath = new XPath( "taxo:topics/rdf:Bag/rdf:li" );
+        JDOMXPath xpath = new JDOMXPath( "taxo:topics/rdf:Bag/rdf:li" );
         xpath.addNamespace( NS.RDF.getPrefix(), NS.RDF.getURI() );
         xpath.addNamespace( NS.TAXO.getPrefix(), NS.TAXO.getURI() );
         

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to