Package org.dspace.administer
Class RegistryImporter
- java.lang.Object
-
- org.dspace.administer.RegistryImporter
-
public class RegistryImporter extends Object
- Author:
- Richard Jones This class provides the tools that registry importers might need to use. Basically some utility methods. And actually, although it says I am the author, really I ripped these methods off from other classes
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetElementData(Node parentElement, String childName)Get the CDATA of a particular element.static String[]getRepeatedElementData(Node parentElement, String childName)Get repeated CDATA for a particular element.static DocumentloadXML(String filename)Load in the XML from file.
-
-
-
Method Detail
-
loadXML
public static Document loadXML(String filename) throws IOException, ParserConfigurationException, SAXException
Load in the XML from file.- Parameters:
filename- the filename to load from- Returns:
- the DOM representation of the XML file
- Throws:
IOException- if IO errorParserConfigurationException- if configuration parse errorSAXException- if XML parse error
-
getElementData
public static String getElementData(Node parentElement, String childName) throws TransformerException
Get the CDATA of a particular element. For example, if the XML document contains:
Why this isn't a core part of the XML API I do not know...<foo><mimetype>application/pdf</mimetype></foo>passing this thefoonode andmimetypewill returnapplication/pdf.- Parameters:
parentElement- the element, whose child element you want the CDATA fromchildName- the name of the element you want the CDATA from- Returns:
- the CDATA as a
String - Throws:
TransformerException- if error
-
getRepeatedElementData
public static String[] getRepeatedElementData(Node parentElement, String childName) throws TransformerException
Get repeated CDATA for a particular element. For example, if the XML document contains:
Why this also isn't a core part of the XML API I do not know...<foo> <bar>val1</bar> <bar>val2</bar> </foo>passing this thefoonode andbarwill returnval1andval2.- Parameters:
parentElement- the element, whose child element you want the CDATA fromchildName- the name of the element you want the CDATA from- Returns:
- the CDATA as a
String - Throws:
TransformerException- if error
-
-