commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vijay" <vija...@icicleconsultancy.com>
Subject [digester] Unable to parse xml, error on line 7: null
Date Thu, 16 Oct 2003 05:52:17 GMT
Hello All,
 
I am trying to parse a particular xml file into an object, but I am
getting the error which says “error on line 7: null”. The error points
to the xml file.
 
Here is the xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<iceframework>
          <application>
                    <name>Name of the Application</name>
                    <description>Description of the
Application</description>
                    <version>Version Number</version>
          </application>
    <init-properties>
        <!-- Path for the log4j configuration file -->
        <property>
                             <name>log4j-file</name>
                             <value>/WEB-INF/conf/log4j.xml</value>
        </property>
    </init-properties>
    <properties>
                   <!-- Default directory for all configuration files.
-->
        <property>
                             <name>config-dir</name>
                             <value>WEB-INF/conf/</value>
        </property>
          </properties>
</iceframework>
 
The code snippet which tries to parse the xml is:
Digester digestInit = new Digester();
            digestInit.setValidating(false);
            digestInit.setNamespaceAware(false);
            digestInit.addObjectCreate("iceframework/init-properties",
com.icicle.system.config.AppInitProperties.class);
 
digestInit.addCallMethod("iceframework/init-properties/property","setPro
perty",2);
 
digestInit.addCallParam("iceframework/init-properties/property/name",0);
 
digestInit.addCallParam("iceframework/init-properties/property/value",1)
;
 
            Object objInitProp = digestInit.parse(isInitApp);
            if(objInitProp instanceof AppInitProperties)
            {
                appInitProp = (AppInitProperties) objInitProp;
            }
 
The AppInitProperties.java file looks like this:
 
public class AppInitProperties
{
    private Hashtable initProp;
 
    /**
     * Setter method for storing the property and the corresponding name
     * @param name Name of the property
     * @param value Value of the property
     */
    public void setProperty(String name, String value)
    {
        initProp.put(name, value);
    }
 
    /**
     * Getter method for getting the init-property information
     * @param name The name of the property for which the value is
required
     * @return The value of the property with the provided name
     */
    public String getProperty(String name)
    {
        //if  (initProp.get(name) instanceof String)
                return (String)initProp.get(name);
    }
 
}
 
Please bear with me if I have made an obvious mistake. However, I am
able to digest the application tag into a different object. Thanks in
advance.
 
With regards, 
 
Vijay Sargunam
 
Icicle Consultancy,
 Web: www.icicleconsultancy.com
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message