You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dl...@apache.org on 2003/01/14 04:53:12 UTC
cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
dlr 2003/01/13 19:53:12
Modified: configuration build.xml project.xml
Added: configuration/src/java/org/apache/commons/configuration
XMLConfiguration.java DOM4JConfiguration.java
Removed: configuration/src/java/org/apache/commons/configuration
XmlConfiguration.java
Log:
* build.xml
* project.xml
Added DOM4J dependency.
* src/java/org/apache/commons/configuration/XmlConfiguration.java
Removed, renamed to XMLConfiguration.java.
* src/java/org/apache/commons/configuration/XMLConfiguration.java
New abstract base class providing a starting point for building XML
Configuration implementations using various parsers and supporting
libraries.
* src/java/org/apache/commons/configuration/DOM4JConfiguration.java
New class extending XMLConfiguration which uses DOM4J to provide a
XML Configuration implementation. Written by Kelvin Tan, and
pointed out to me by Martin Poeschl.
Revision Changes Path
1.10 +2 -1 jakarta-commons-sandbox/configuration/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/configuration/build.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- build.xml 13 Jan 2003 23:08:13 -0000 1.9
+++ build.xml 14 Jan 2003 03:53:12 -0000 1.10
@@ -127,6 +127,7 @@
<get dest="lib/commons-collections-2.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-collections/jars/commons-collections-2.0.jar"></get>
<get dest="lib/commons-lang-1.0.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-1.0.1.jar"></get>
+ <get dest="lib/dom4j-1.3.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/dom4j/jars/dom4j-1.3.jar"></get>
<get dest="lib/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar"></get>
<get dest="lib/xerces-2.2.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/xerces/jars/xerces-2.2.1.jar"></get>
<get dest="lib/xml-apis-2.2.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/xml-apis/jars/xml-apis-2.2.1.jar"></get>
1.20 +7 -1 jakarta-commons-sandbox/configuration/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/configuration/project.xml,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -u -r1.19 -r1.20
--- project.xml 13 Jan 2003 23:08:13 -0000 1.19
+++ project.xml 14 Jan 2003 03:53:12 -0000 1.20
@@ -96,6 +96,7 @@
<id>commons-collections</id>
<version>2.0</version>
</dependency>
+
<dependency>
<id>commons-lang</id>
<version>1.0.1</version>
@@ -106,6 +107,11 @@
<version>1.0.2</version>
</dependency>
-->
+ <dependency>
+ <id>dom4j</id>
+ <version>1.3</version>
+ </dependency>
+
<dependency>
<id>junit</id>
<version>3.8.1</version>
1.1 jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/XMLConfiguration.java
Index: XMLConfiguration.java
===================================================================
package org.apache.commons.configuration;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
/**
* Base class for reading an XML configuration file.
*
* @author <a href="mailto:dlr@apache.org">Daniel Rall</a>
* @since 0.8.1
*/
public abstract class XMLConfiguration extends BaseConfiguration
{
}
1.1 jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/DOM4JConfiguration.java
Index: DOM4JConfiguration.java
===================================================================
package org.apache.commons.configuration;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.NestableRuntimeException;
/**
* Reads a XML configuration file.
*
* To retrieve the value of an attribute of an element, use
* <code>X.Y.Z[@attribute]</code>. The '@' symbol was chosen for
* consistency with XPath.
*
* Setting property values will <b>NOT</b> automatically persist
* changes to disk, unless <code>autoSave=true</code>.
*
* @author <a href="mailto:kelvint@apache.org">Kelvin Tan</a>
* @author <a href="mailto:dlr@apache.org">Daniel Rall</a>
* @since 0.8.1
*/
public class DOM4JConfiguration extends XMLConfiguration
{
// For conformance with xpath
private static final char ATTRIB_MARKER = '@';
private static final String ATTRIB_START_MARKER = "[" + ATTRIB_MARKER;
/**
* For consistency with properties files. Access nodes via an
* "A.B.C" notation.
*/
private static final String NODE_DELIMITER = ".";
/**
* A handle to our data source.
*/
private File file;
/**
* The XML document from our data source.
*/
private Document document;
/**
* If true, modifications are immediately persisted.
*/
private boolean autoSave = false;
/**
* Attempts to load the XML file as a resource from the
* classpath. The XML file must be located somewhere in the
* classpath.
*
* @param resource Name of the resource
* @exception Exception If error reading data source.
* @see DOM4JConfiguration(File)
*/
public DOM4JConfiguration(String resource)
throws Exception
{
this(resourceURLToFile(resource));
}
/**
* Attempts to load the XML file.
*
* @param file File object representing the XML file.
* @exception Exception If error reading data source.
*/
public DOM4JConfiguration(File file)
throws Exception
{
this.file = file;
document = new SAXReader().read(file);
initProperties(document.getRootElement(), new StringBuffer());
}
private static File resourceURLToFile(String resource)
{
URL confURL =
DOM4JConfiguration.class.getClassLoader().getResource(resource);
if (confURL == null)
{
confURL = ClassLoader.getSystemResource(resource);
}
return new File(confURL.getFile());
}
/**
* Loads and initializes from the XML file.
*
* @param element The element to start processing from. Callers
* should supply the root element of the document.
* @param hierarchy
*/
private void initProperties(Element element, StringBuffer hierarchy)
{
for (Iterator it = element.elementIterator(); it.hasNext(); )
{
StringBuffer subhierarchy = new StringBuffer(hierarchy.toString());
Element child = (Element) it.next();
String nodeName = child.getName();
String nodeValue = child.getTextTrim();
subhierarchy.append(nodeName);
if (nodeValue.length() > 0)
{
super.addProperty(subhierarchy.toString(), nodeValue);
}
// Add attributes as x.y{ATTRIB_START_MARKER}att{ATTRIB_END_MARKER}
List attributes = child.attributes();
for (int j = 0,k = attributes.size(); j < k; j++)
{
Attribute a = (Attribute) attributes.get(j);
String attName = subhierarchy.toString() + '[' +
ATTRIB_MARKER + a.getName() + ']';
String attValue = a.getValue();
super.addProperty(attName, attValue);
}
StringBuffer buf = new StringBuffer(subhierarchy.toString());
initProperties(child, buf.append('.'));
}
}
/**
* Calls super method, and also ensures the underlying {@link
* Document} is modified so changes are persisted when saved.
*
* @param name
* @param value
*/
public void addProperty(String name, Object value)
{
super.addProperty(name, value);
setXmlProperty(name, value);
possiblySave();
}
/**
* Calls super method, and also ensures the underlying {@link
* Document} is modified so changes are persisted when saved.
*
* @param name
* @param value
*/
public void setProperty(String name, Object value)
{
super.setProperty(name, value);
setXmlProperty(name, value);
possiblySave();
}
/**
* Sets the property value in our document tree, auto-saving if
* appropriate.
*
* @param name The name of the element to set a value for.
* @param value The value to set.
*/
private void setXmlProperty(String name, Object value)
{
String[] nodes = StringUtils.split(name, NODE_DELIMITER);
String attName = null;
Element element = document.getRootElement();
for (int i = 0; i < nodes.length; i++)
{
String eName = nodes[i];
int index = eName.indexOf(ATTRIB_START_MARKER);
if (index > -1)
{
attName = eName.substring(index + ATTRIB_START_MARKER.length(),
eName.length() - 1);
eName = eName.substring(0, index);
}
// If we don't find this part of the property in the XML heirarchy
// we add it as a new node
if (element.element(eName) == null && attName == null)
{
element.addElement(eName);
}
element = element.element(eName);
}
if (attName == null)
{
element.setText((String) value);
}
else
{
element.addAttribute(attName, (String) value);
}
}
/**
* Calls super method, and also ensures the underlying {@link
* Document} is modified so changes are persisted when saved.
*
* @param name The name of the property to clear.
*/
public void clearProperty(String name)
{
super.clearProperty(name);
clearXmlProperty(name);
possiblySave();
}
private void clearXmlProperty(String name)
{
String[] nodes = StringUtils.split(name, NODE_DELIMITER);
String attName = null;
Element element = document.getRootElement();
for (int i = 0; i < nodes.length; i++)
{
String eName = nodes[i];
int index = eName.indexOf(ATTRIB_START_MARKER);
if (index > -1)
{
attName = eName.substring(index + ATTRIB_START_MARKER.length(),
eName.length() - 1);
eName = eName.substring(0, index);
}
element = element.element(eName);
if (element == null)
{
return;
}
}
if (attName == null)
{
element.remove(element.element(nodes[nodes.length - 1]));
}
else
{
element.remove(element.attribute(attName));
}
}
/**
* @throws
*/
private void possiblySave()
{
if (autoSave)
{
try
{
save();
}
catch (IOException e)
{
throw new NestableRuntimeException("Failed to auto-save", e);
}
}
}
/**
* If true, changes are automatically persisted.
* @param autoSave
*/
public void setAutoSave(boolean autoSave)
{
this.autoSave = autoSave;
}
public synchronized void save()
throws IOException
{
XMLWriter writer = null;
OutputStream out = null;
try
{
OutputFormat outputter = OutputFormat.createPrettyPrint();
out = new BufferedOutputStream(new FileOutputStream(file));
writer = new XMLWriter(out, outputter);
writer.write(document);
}
finally
{
if (out != null)
{
out.close();
}
if (writer != null)
{
writer.close();
}
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by Kelvin Tan <ke...@relevanz.com>.
I'm not sure if this is the best way (although its obviously better
than my hack), because if the bug is with Resin and dom4j (resin and
jdom is ok), then either Resin OR dom4j should be changed, not the
application?
Well, Einar proposed an alternative and I'll check up on it.
btw, I saw a couple of references to this very same issue on
dom4j-user lists, with no clear resolution. You might want to make a
post for posterity? :-)
Kelvin
On Tue, 14 Jan 2003 12:54:01 -0000, James Strachan said:
>Rather than hacking dom4j you can just pass in the particular SAX
>XMLReader you want to use.
>
>e.g.
>
>XMLReader parser = new org.apache.xerces.parsers.SAXParser();
>
>// then use with dom4j SAXReader reader = new SAXReader( parser );
>Document doc = reader.read( "foo.xml" );
>
>
>This problem does sound like a resin classloader bug; you should be
>able to specify exactly what XML parser you want to use in each web
>app you deploy -
>the servlet engines own parser shouldn't get in the way.
>
>James -------
>http://radio.weblogs.com/0112098/ ----- Original Message -----
>From: "Kelvin Tan" <ke...@relevanz.com> To: "Jakarta Commons
>Developers List" <commons-
>dev@jakarta.apache.org> Sent: Tuesday, January 14, 2003 10:28 AM
>Subject: Re: cvs commit: jakarta-commons-
>sandbox/configuration/src/java/org/apache/commons/configurat ion
>XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
>
>
>Not really. Its an awful hack!
>In SAXHelper.createXMLReader, I comment out XMLReader reader =
>createXMLReaderViaJAXP( validating, true );
>
>and hardcode
>
>System.setProperty("org.xml.sax.driver",
>"org.apache.xerces.parsers.SAXParser");
>
>to avoid using Rein's SAX driver.
>
>Kelvin
>
>On Tue, 14 Jan 2003 10:19:35 -0000, James Strachan said:
>>Wanna send me the patch & I'll apply it?
>>
>>James -------
>>http://radio.weblogs.com/0112098/ ----- Original Message -----
>>From: "Kelvin Tan" <ke...@relevanz.com> To: "Jakarta Commons
>>Developers List" <commons-
>>dev@jakarta.apache.org> Sent: Tuesday, January 14, 2003 9:03 AM
>>Subject: Re: cvs commit: jakarta-commons-
>>sandbox/configuration/src/java/org/apache/commons/configurat ion
>>XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
>>
>>One thing people should know about dom4j and Resin: they don't like
>>each other very much. :-)
>>
>>I've patched dom4j to work with Resin. Its an awful workaround, but
>>it works. Contact me if anyone needs the patch.
>>
>>Kelvin
>>
>>
>>--
>>To unsubscribe, e-mail: <mailto:commons-dev-
>>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
>><ma...@jakarta.apache.org>
>>
>>__________________________________________________ Do You Yahoo!?
>>Everything you'll ever need on one web page from News and Sport to
>>Email and Music Charts http://uk.my.yahoo.com
>>
>>--
>>To unsubscribe, e-mail: <mailto:commons-dev-
>>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
>><mailto:commons-dev-
>>help@jakarta.apache.org>
>
>
>
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>__________________________________________________ Do You Yahoo!?
>Everything you'll ever need on one web page from News and Sport to
>Email and Music Charts http://uk.my.yahoo.com
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><mailto:commons-dev-
>help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by James Strachan <ja...@yahoo.co.uk>.
Rather than hacking dom4j you can just pass in the particular SAX XMLReader
you want to use.
e.g.
XMLReader parser = new org.apache.xerces.parsers.SAXParser();
// then use with dom4j
SAXReader reader = new SAXReader( parser );
Document doc = reader.read( "foo.xml" );
This problem does sound like a resin classloader bug; you should be able to
specify exactly what XML parser you want to use in each web app you deploy -
the servlet engines own parser shouldn't get in the way.
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Kelvin Tan" <ke...@relevanz.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Tuesday, January 14, 2003 10:28 AM
Subject: Re: cvs commit:
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configurat
ion XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Not really. Its an awful hack!
In SAXHelper.createXMLReader, I comment out
XMLReader reader = createXMLReaderViaJAXP( validating, true );
and hardcode
System.setProperty("org.xml.sax.driver",
"org.apache.xerces.parsers.SAXParser");
to avoid using Rein's SAX driver.
Kelvin
On Tue, 14 Jan 2003 10:19:35 -0000, James Strachan said:
>Wanna send me the patch & I'll apply it?
>
>James -------
>http://radio.weblogs.com/0112098/ ----- Original Message -----
>From: "Kelvin Tan" <ke...@relevanz.com> To: "Jakarta Commons
>Developers List" <commons-
>dev@jakarta.apache.org> Sent: Tuesday, January 14, 2003 9:03 AM
>Subject: Re: cvs commit: jakarta-commons-
>sandbox/configuration/src/java/org/apache/commons/configurat ion
>XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
>
>
>One thing people should know about dom4j and Resin: they don't like
>each other very much. :-)
>
>I've patched dom4j to work with Resin. Its an awful workaround, but
>it works. Contact me if anyone needs the patch.
>
>Kelvin
>
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>__________________________________________________ Do You Yahoo!?
>Everything you'll ever need on one web page from News and Sport to
>Email and Music Charts http://uk.my.yahoo.com
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><mailto:commons-dev-
>help@jakarta.apache.org>
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by Kelvin Tan <ke...@relevanz.com>.
Will try this...thanks!
Kelvin
On Tue, 14 Jan 2003 16:10:17 +0100 (CET), Einar Flesaker said:
>* Kelvin Tan
>
>>Not really. Its an awful hack!
>>In SAXHelper.createXMLReader, I comment out XMLReader reader =
>>createXMLReaderViaJAXP( validating, true );
>>System.setProperty("org.xml.sax.driver",
>>"org.apache.xerces.parsers.SAXParser");
>>to avoid using Rein's SAX driver.
>
>Resin barfs with OJB and quite a few other projects, as well. I've
>found that it's better to replace Resins XML-libraries in
>$RESIN_HOME/lib with xerces and add a few properties to
>$RESIN_HOME/conf/resin.conf :
>
><system-property
>javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxpDocu
>mentBuilderFactoryImpl"/> <system-property
>javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserF
>actoryImpl"/> <system-property
>javax.xml.transform.TransformerFactory="org.apache.xalan.processor.Tr
>ansformerFactoryImpl" />
>
>-Einar-
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><mailto:commons-dev-
>help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration
XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by Einar Flesaker <ei...@flesaker.no>.
* Kelvin Tan
> Not really. Its an awful hack!
> In SAXHelper.createXMLReader, I comment out
> XMLReader reader = createXMLReaderViaJAXP( validating, true );
> System.setProperty("org.xml.sax.driver",
> "org.apache.xerces.parsers.SAXParser");
> to avoid using Rein's SAX driver.
Resin barfs with OJB and quite a few other projects, as well. I've found
that it's better to replace Resins XML-libraries in $RESIN_HOME/lib
with xerces and add a few properties to $RESIN_HOME/conf/resin.conf :
<system-property
javax.xml.parsers.DocumentBuilderFactory="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"/>
<system-property
javax.xml.parsers.SAXParserFactory="org.apache.xerces.jaxp.SAXParserFactoryImpl"/>
<system-property
javax.xml.transform.TransformerFactory="org.apache.xalan.processor.TransformerFactoryImpl"
/>
-Einar-
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by Kelvin Tan <ke...@relevanz.com>.
Not really. Its an awful hack!
In SAXHelper.createXMLReader, I comment out
XMLReader reader = createXMLReaderViaJAXP( validating, true );
and hardcode
System.setProperty("org.xml.sax.driver",
"org.apache.xerces.parsers.SAXParser");
to avoid using Rein's SAX driver.
Kelvin
On Tue, 14 Jan 2003 10:19:35 -0000, James Strachan said:
>Wanna send me the patch & I'll apply it?
>
>James -------
>http://radio.weblogs.com/0112098/ ----- Original Message -----
>From: "Kelvin Tan" <ke...@relevanz.com> To: "Jakarta Commons
>Developers List" <commons-
>dev@jakarta.apache.org> Sent: Tuesday, January 14, 2003 9:03 AM
>Subject: Re: cvs commit: jakarta-commons-
>sandbox/configuration/src/java/org/apache/commons/configurat ion
>XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
>
>
>One thing people should know about dom4j and Resin: they don't like
>each other very much. :-)
>
>I've patched dom4j to work with Resin. Its an awful workaround, but
>it works. Contact me if anyone needs the patch.
>
>Kelvin
>
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>__________________________________________________ Do You Yahoo!?
>Everything you'll ever need on one web page from News and Sport to
>Email and Music Charts http://uk.my.yahoo.com
>
>--
>To unsubscribe, e-mail: <mailto:commons-dev-
>unsubscribe@jakarta.apache.org> For additional commands, e-mail:
><mailto:commons-dev-
>help@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by James Strachan <ja...@yahoo.co.uk>.
Wanna send me the patch & I'll apply it?
James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Kelvin Tan" <ke...@relevanz.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Tuesday, January 14, 2003 9:03 AM
Subject: Re: cvs commit:
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configurat
ion XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
One thing people should know about dom4j and Resin: they don't like
each other very much. :-)
I've patched dom4j to work with Resin. Its an awful workaround, but
it works. Contact me if anyone needs the patch.
Kelvin
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: cvs commit: jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration XMLConfiguration.java DOM4JConfiguration.java XmlConfiguration.java
Posted by Kelvin Tan <ke...@relevanz.com>.
One thing people should know about dom4j and Resin: they don't like
each other very much. :-)
I've patched dom4j to work with Resin. Its an awful workaround, but
it works. Contact me if anyone needs the patch.
Kelvin
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>