Hi all,

I' ve a problem in parsing a simple xml file of a web application. This
is the file:

<?xml version="1.0" encoding="UTF-8" ?>

<properties>

        <image-base-url>/path/to/img</image-base-url>
        <css-base-url>/path/to/css</css-base-url>
        <js-base-url>/path/to/js</js-base-url>
        <html-base-url>/path/to/html</html-base-url>
        <dynamic-base-url>/path</dynamic-base-url>
        <log-file>file.log</log-file>
        
        <data-access>
                <datasource>dataSource</datasource>
                <query-resource>/path/to/file.xml</query-resource>
        </data-access>
        
</properties>

The file is loaded and parsed through Apache Digester:

[...]
Digester digester = new Digester(new
*org.apache.xerces.parsers.SAXParser()*);

digester.setValidating(false);
digester.setClassLoader(Configurator.class.getClassLoader());
digester.addObjectCreate("properties", Configuration.class);
digester.addSetProperties("properties");
digester.addCallMethod("properties/image-base-url", "setImageBaseUrl",
0);
digester.addCallMethod("properties/css-base-url", "setCssBaseUrl", 0);

[...]
digester.parse();

And this is the problem:

java.net.MalformedURLException
at
org.apache.commons.digester.Digester.createSAXException(Digester.java:3181)
at
org.apache.commons.digester.Digester.createSAXException(Digester.java:3207)
at org.apache.commons.digester.Digester.endElement(Digester.java:1225)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1398)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1002)
at org.apache.xerces.framework.XMLDocumentScanner
$ContentDispatcher.dispatch(XMLDocumentScanner.java:1255)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
at org.apache.commons.digester.Digester.parse(Digester.java:1805)

e.getMessage(), where e is the instance of type MalformedURLException,
reports this:  *Error at line 14 char 51: null*

The problem seems related to the row defined by <query-resource> tag,
but the validation' tools I found in Xerces package don' t show any
error: the document seems to be well formed. The same result if I add an
embedded DTD and try to turn on validation in Digester. 
The xml tag reports an UTF-8 encoding and the file is actually saved
with that encoding. I use these libraries:

commons-digester-1.8
commons-lang-2.3
commons-collections-3.2
commons-lang-2.3
commons-logging-1.1
commons-validator-1.3.1
commons-beanutils-1.7.0
Xerces-J-bin.2.9.1

Any ideas?

Thanks,
Andrea.


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

Reply via email to