org.dspace.administer
Class RegistryImporter

java.lang.Object
  extended by 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

Constructor Summary
RegistryImporter()
           
 
Method Summary
static String getElementData(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 Document loadXML(String filename)
          Load in the XML from file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegistryImporter

public RegistryImporter()
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
ParserConfigurationException
SAXException

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:

<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

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:

<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


Copyright © 2010 DuraSpace. All Rights Reserved.