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 Details

    • 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 error
      ParserConfigurationException - if configuration parse error
      SAXException - if XML parse error
    • getElementData

      public static String getElementData(Node parentElement, String childName) throws XPathExpressionException
      Get the CDATA of a particular element. For example, if the XML document contains:

      <foo><mimetype>application/pdf</mimetype></foo> passing this the foo node and mimetype will return application/pdf.

      Why this isn't a core part of the XML API I do not know...
      Parameters:
      parentElement - the element, whose child element you want the CDATA from
      childName - the name of the element you want the CDATA from
      Returns:
      the CDATA as a String
      Throws:
      TransformerException - if error
      XPathExpressionException
    • getRepeatedElementData

      public static String[] getRepeatedElementData(Node parentElement, String childName) throws XPathExpressionException
      Get repeated CDATA for a particular element. For example, if the XML document contains:

      <foo> <bar>val1</bar> <bar>val2</bar> </foo> passing this the foo node and bar will return val1 and val2.

      Why this also isn't a core part of the XML API I do not know...
      Parameters:
      parentElement - the element, whose child element you want the CDATA from
      childName - the name of the element you want the CDATA from
      Returns:
      the CDATA as a String
      Throws:
      TransformerException - if error
      XPathExpressionException