Search in sources :

Example 6 with DOMOutputter

use of org.jdom2.output.DOMOutputter in project mycore by MyCoRe-Org.

the class MCRXMLFunctions method resolve.

/**
 * @param uri the uri to resolve
 */
public static NodeList resolve(String uri) throws JDOMException {
    org.jdom2.Element element = MCRURIResolver.instance().resolve(uri);
    element.detach();
    org.jdom2.Document document = new org.jdom2.Document(element);
    return new DOMOutputter().output(document).getDocumentElement().getChildNodes();
}
Also used : DOMOutputter(org.jdom2.output.DOMOutputter) Document(org.w3c.dom.Document)

Example 7 with DOMOutputter

use of org.jdom2.output.DOMOutputter in project mycore by MyCoRe-Org.

the class MCRXMLFunctions method document.

public static Node document(String uri) throws JDOMException, IOException, SAXException, TransformerException {
    MCRSourceContent sourceContent = MCRSourceContent.getInstance(uri);
    if (sourceContent == null) {
        throw new TransformerException("Could not load document: " + uri);
    }
    DOMOutputter out = new DOMOutputter();
    return out.output(sourceContent.asXML());
}
Also used : MCRSourceContent(org.mycore.common.content.MCRSourceContent) DOMOutputter(org.jdom2.output.DOMOutputter) TransformerException(javax.xml.transform.TransformerException)

Aggregations

DOMOutputter (org.jdom2.output.DOMOutputter)7 Element (org.jdom2.Element)5 Document (org.jdom2.Document)3 TransformerException (javax.xml.transform.TransformerException)2 NodeList (org.w3c.dom.NodeList)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Locale (java.util.Locale)1 Transformer (javax.xml.transform.Transformer)1 TransformerFactory (javax.xml.transform.TransformerFactory)1 TransformerFactoryConfigurationError (javax.xml.transform.TransformerFactoryConfigurationError)1 DOMSource (javax.xml.transform.dom.DOMSource)1 StreamResult (javax.xml.transform.stream.StreamResult)1 XPath (javax.xml.xpath.XPath)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 NodeSet (org.apache.xpath.NodeSet)1 JDOMException (org.jdom2.JDOMException)1 MCRAccessManager (org.mycore.access.MCRAccessManager)1 MCRConfiguration (org.mycore.common.config.MCRConfiguration)1