package com.xoetrope.export;
import java.io.Reader;
import net.xoetrope.xml.XmlElement;
import net.xoetrope.xml.XmlSource;
import net.xoetrope.xui.XProject;
/**
*
* <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
* the GNU Public License (GPL), please see license.txt for more details. If
* you make commercial use of this software you must purchase a commercial
* license from Xoetrope.</p>
* <p> $Revision: 1.6 $</p>
*/
public class XMLHelper
{
public static XmlElement readXml( XProject currentProject, String path )
{
try
{
Reader reader = currentProject.getBufferedReader( path, null );
XmlElement ele = XmlSource.read( reader );
return ele;
}
catch ( Exception e )
{
e.printStackTrace();
return null;
}
}
public static int getAttribAsInt( XmlElement ele, String attribName, int defaultValue )
{
String value = ele.getAttribute( attribName );
try
{
return Integer.parseInt( value );
}
catch ( Exception e )
{
return defaultValue;
}
}
}
|