Looks like a problem with the XML parser you use. Which parsers do you have in your classpath?

If you use JDK 1.4.x, you don't have to bother about including a specific parser; you can simply use the one shipped with the JDK. For earlier JDKs in our dependencies we have defined Xerces in version 2.2.1.

Oliver

paul.hopper wrote:
Good day,

Thought that configuration might be an easy replacement for my properties configurator since it does both UNIX based key=value properties but also xml config files. Mine only does the former 8-(

While setting up my test I came across an error while setting up this from example:

#more config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<configuration>
    <properties fileName="usergui.properties"/>
    <xml fileName="gui.xml"/>
</configuration>

My src code works fine with just the properties "fileName" but I get a

2005-04-05 13:25:52,211 [main] ERROR org.apache.commons.digester.Digester - Begin event threw error
java.lang.VerifyError: (class: org/apache/xerces/jaxp/DocumentBuilderImpl, method: parse signature: (Lorg/xml/sax/InputSource;)Lorg/w3c/dom/Document;) Incompatible object argument for function call
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:88)


......
......
......

with the xml "fileName" when using both loadConfigXML and loadConfigByFactory method class of my test class. Any suggestions?

[[my src]]

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConfigurationFactory;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class TestProperties {
private Logger logger = Logger.getLogger(TestProperties.class);
protected Configuration config = null;
public TestProperties() {
this.loadConfigByFactory();
//this.loadConfigXML();
//System.out.println("CONFIG::" + config.getString("DATABASES.DATABASE.DRIVER"));
logger.info("colors.background = " + config.getString("colors.background"));
logger.info("application.title = " + config.getString("application.title"));
logger.info("rowsPerPage = " + config.getInt("rowsPerPage"));
}
public void loadConfigXML() {
//ConfigurationFactory factory = new ConfigurationFactory("config.conf");
XMLConfiguration config = new XMLConfiguration();
config.setFileName("test.xml");
try {
config.load();
} catch (ConfigurationException e) {
logger.error(e);
} logger.info("rowsPerPage = " + config.getInt("rowsPerPage"));
}
public void loadConfigByFactory() {
ConfigurationFactory factory = new ConfigurationFactory();
URL configURL = null;
try {
configURL = new File("config.xml").toURL();
} catch (MalformedURLException mue) {
logger.error("error loading config.conf: ", mue);
}
factory.setConfigurationFileName(configURL.toString());
try {
config = factory.getConfiguration();
} catch (ConfigurationException ce) {
logger.error("error loading configuration: ", ce);
}
}


    public static void main(String[] args) {
        PropertyConfigurator.configure("log4j.cfg");
        new TestProperties();
    }
}

[[my gui.xml]]

<?xml version="1.0" encoding="ISO-8859-1" ?>
<gui-definition>
  <colors>
    <background>#808080</background>
    <text>#000000</text>
    <header>#008000</header>
    <link normal="#000080" visited="#800080"/>
  </colors>
  <rowsPerPage>15</rowsPerPage>
</gui-definition>

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




--
Dipl.-Inform. Oliver Heger
Zentrale Informationsverarbeitung (ZIV) / Bereich Anwenderverfahren
Klinikum der Philipps-Universit�t Marburg
Baldingerstra�e,
D-35037 Marburg
Tel: +49 6421 28-66679
mailto:[EMAIL PROTECTED]

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



Reply via email to