/*
* XInfoFileParser.java
*
* Created on 08 February 2007, 12:25
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.xoetrope.svg;
import com.xoetrope.carousel.build.BuildProperties;
import java.io.IOException;
import java.io.Reader;
import java.net.URL;
import java.util.Vector;
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.5 $</p>
*/
public class XInfoFileParser
{
protected XProject project;
protected String path;
protected URL url;
/**
* Creates a new instance of XInfoFileParser
* Which will be used to parse information from XML files.
*/
public XInfoFileParser( XProject project, String path )
{
this.project = project;
this.path = path;
}
/**
* Reads the specified element number from the xml file and passes it by use of the <CODE>XHotSpotInfo</CODE> interface's set method
* to a class implementing the interface;
* @param elementNum <CODE>int</CODE> specifying the xml element to be parsed.
* @param statusInfo <CODE>XHotSpotInfo</CODE> interface used to pass the element to an implementing class.
*/
public void read( int elementNum, XHotSpotInfo statusInfo )
{
Reader reader = null;
try{
reader = project.getBufferedReader(path);
}
catch ( Exception ex ){
if ( BuildProperties.DEBUG )
ex.printStackTrace();
}
XmlElement root = XmlSource.read( reader );
Vector nodes = root.getChildren();
XmlElement node = (XmlElement)nodes.elementAt( elementNum );
statusInfo.set( node );
}
}
|