[ http://issues.apache.org/jira/browse/VFS-39?page=comments#action_12413575 ]
Benoit Callebaut commented on VFS-39: ------------------------------------- I have noted that if you use DOM4J 1.6.1, you can run into trouble. Moving back to version 1.5.1 solved the problem. > [VFS] read/write XML support > ---------------------------- > > Key: VFS-39 > URL: http://issues.apache.org/jira/browse/VFS-39 > Project: Commons VFS > Type: Improvement > Versions: Nightly Builds > Environment: Operating System: other > Platform: Other > Reporter: Benoit Callebaut > Priority: Minor > Attachments: VFSXmlFileObject.java, VFSXmlFileProvider.java, > VFSXmlFileSystem.java, package.html, patchfile, test.xml > > Here is the patch and necessary files for adding XML support for VFS. > I don't know how to include new files in a patch, so I will put them on the > mailing list. > I am not a test writer specialist, so there is no specific test case for this > provider but I tested it and it works. > Index: vfs/src/test/org/apache/commons/vfs/RunTest.java > =================================================================== > --- vfs/src/test/org/apache/commons/vfs/RunTest.java (revision 404758) > +++ vfs/src/test/org/apache/commons/vfs/RunTest.java (working copy) > @@ -26,6 +26,7 @@ > import org.apache.commons.vfs.provider.url.test.UrlProviderHttpTestCase; > import org.apache.commons.vfs.provider.test.VirtualProviderTestCase; > import org.apache.commons.vfs.provider.test.GenericFileNameTestCase; > +import org.apache.commons.vfs.provider.xml.test.XmlProviderTestCase; > import java.util.Properties; > @@ -67,6 +68,7 @@ > // WebdavProviderTestCase.suite(), > SftpProviderTestCase.suite(), > + XmlProviderTestCase.suite(), > // JarProviderTestCase.suite(), > // NestedJarTestCase.suite(), > Index: vfs/src/java/org/apache/commons/vfs/impl/providers.xml > =================================================================== > --- vfs/src/java/org/apache/commons/vfs/impl/providers.xml (revision > 404758) > +++ vfs/src/java/org/apache/commons/vfs/impl/providers.xml (working copy) > @@ -51,6 +51,9 @@ > <provider > class-name="org.apache.commons.vfs.provider.res.ResourceFileProvider"> > <scheme name="res"/> > </provider> > + <provider > class-name="org.apache.commons.vfs.provider.xml.VFSXmlFileProvider"> > + <scheme name="xml"/> > + </provider> > <!-- > <provider > class-name="org.apache.commons.vfs.provider.tar.TgzFileProvider"> > <scheme name="tgz"/> > @@ -78,8 +81,10 @@ > <scheme name="ram"/> > </provider> > + <extension-map extension="xml" scheme="xml"/> > <extension-map extension="zip" scheme="zip"/> > <extension-map extension="tar" scheme="tar"/> > + <mime-type-map mime-type="application/xml" scheme="xml"/> > <mime-type-map mime-type="application/zip" scheme="zip"/> > <mime-type-map mime-type="application/x-tar" scheme="tar"/> > <mime-type-map mime-type="application/x-gzip" scheme="gz"/> > Index: vfs/src/java/org/apache/commons/vfs/FileType.java > =================================================================== > --- vfs/src/java/org/apache/commons/vfs/FileType.java (revision 404758) > +++ vfs/src/java/org/apache/commons/vfs/FileType.java (working copy) > @@ -46,7 +46,7 @@ > private final boolean hasContent; > private final boolean hasAttrs; > - private FileType(final String name, > + public FileType(final String name, > final boolean hasChildren, > final boolean hasContent, > final boolean hasAttrs) > @@ -96,4 +96,14 @@ > { > return hasAttrs; > } > + > + public boolean equals(Object obj){ > + if (!(obj instanceof FileType)) return false; > + FileType ob = (FileType)obj; > + if (this.hasContent() && ob.hasContent()) return true; > + if (this.hasChildren() && ob.hasChildren()) return true; > + if (this.hasAttributes() && ob.hasAttributes()) return true; > + > + return false; > + } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]