org.kahina.core.io.util
Class XMLUtilities
java.lang.Object
org.kahina.core.io.util.XMLUtilities
public class XMLUtilities
- extends Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLUtilities
public XMLUtilities()
parseXMLFile
public static Document parseXMLFile(File f,
boolean validating)
- parse an XML file
- Parameters:
f - the XML filevalidating - toggle validation
- Returns:
- the parsed document
newEmptyDocument
public static Document newEmptyDocument()
writeXML
public static void writeXML(Node node,
String outfile)
- Generates an XML file at a specified path containing the contents of a DOM node
- Parameters:
node - - the DOM node whose content is output into the fileoutfile - - the path to the XML file that is to be generated
attrBoolVal
public static boolean attrBoolVal(Element el,
String attrName)
attrColorVal
public static Color attrColorVal(Element el,
String attrName)
- Constructs a color from an attribute value in an XML document.
Expects the color to be encoded as color(R,G,B).
Outputs an informative error message and returns Color.WHITE on error.
- Parameters:
el - the element whose attribute we accessattrName - name of the attribute whose value encodes the color
- Returns:
- the color at the specified element and attribute
attrIntVal
public static int attrIntVal(Element el,
String attrName)
attrStrVal
public static String attrStrVal(Element el,
String attrName)
getElements
public static List<Element> getElements(Element el,
String elName)
getChildElements
public static List<Element> getChildElements(Element el)