commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From comctrl6 <comct...@yahoo.com>
Subject Re: Commons Configuration
Date Fri, 15 Feb 2008 23:49:12 GMT
I believe the problem is with the way Configuration is setting up the XML parser.

The following test code works and reports the number of nodes correctly, which is 2 (the doctype
and the main plist element). However, as in my last email, a NullPointerException is thrown
when I try to load the same XML file using configuration.

public static void main(String[] args) {
    try {
        Document doc = XmlDocument.createXmlDocument(new File("test.plist.xml").getAbsolutePath());
        System.out.println(doc.getChildNodes().getLength());
    } catch (IOException e) {
        e.printStackTrace();
    } catch (SAXException e) {
        e.printStackTrace();
    }
}

Just for the sake of completeness, I went ahead and tested the code from my last email with
Java 1.5. I can't use 1.5 in the project, but I just wanted to see if Configuration
would work with it. The following is the exception I get. Something really strange is going
on here.

org.apache.commons.configuration.ConfigurationException: Unable to parse the configuration
file
    at org.apache.commons.configuration.plist.XMLPropertyListConfiguration.load(XMLPropertyListConfiguration.java:247)
    at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration$FileConfigurationDelegate.load(AbstractHierarchicalFileConfiguration.java:443)
    at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:356)
    at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:322)
    at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:285)
    at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:217)
    at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:195)
    at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.load(AbstractHierarchicalFileConfiguration.java:164)
    at ConfigTester.main(ConfigTester.java:13)
Caused by: java.net.MalformedURLException
    at java.net.URL.<init>(URL.java:601)
    at java.net.URL.<init>(URL.java:464)
    at java.net.URL.<init>(URL.java:413)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:968)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:905)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:872)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:282)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:1021)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
    at org.apache.commons.configuration.plist.XMLPropertyListConfiguration.load(XMLPropertyListConfiguration.java:243)
    ... 8 more

Any ideas or suggestions?
Thanks.



----- Original Message ----
> From: "simon.kitching@chello.at" <simon.kitching@chello.at>
> To: Jakarta Commons Users List <user@commons.apache.org>
> Sent: Friday, February 15, 2008 4:51:40 AM
> Subject: Re: Commons Configuration
>
>
The 
org.apache.crimson 
parser 
*is* 
the 
default 
parser 
for 
java 
1.4. 
It
> was 
only 
in 
1.5 
that 
they 
moved 
to 
Xerces.
>
> The 
question 
is 
whether 
this 
is
> (a) 
something 
in 
the 
input 
that 
crimson 
just 
doesn't 
handle, 
or
> (b) 
something 
in 
the 
way 
that 
Configuration 
is 
setting 
up 
the 
xml 
parser
> that 
crimson 
doesn't 
like
>
> The 
best 
test 
would 
be 
to 
try 
to 
process 
"test.plist.xml" 
directly 
with
> crimson, 
eg 
just 
read 
it 
and 
count 
the 
number 
of 
elements. 
If 
that
> doesn't 
work, 
then 
there 
isn't 
much 
that 
Configuration 
can 
do 
about 
it.
> 
> Regards,
> Simon






      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message