@Test public void readFromNode() throws Exception { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); final Document doc = dbf.newDocumentBuilder().parse( IoSupport.classPathResourceAsFile("/matterhorn-inlined-list-records-response.xml").get()); final NamespaceContext ctx = XmlNamespaceContext.mk( XmlNamespaceBinding.mk("inlined", "http: XmlNamespaceBinding.mk("mp", "http: XmlNamespaceBinding.mk("dc", DublinCores.OC_DC_CATALOG_NS_URI)); final Node mpNode = Xpath.mk(doc, ctx).node(" final MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().loadFromXml(mpNode); assertNotNull(mp); assertEquals("10.0000/5820", mp.getIdentifier().toString()); final Node dcNode = Xpath.mk(doc, ctx).node(" final DublinCoreCatalog dc = DublinCoreXmlFormat.read(dcNode); assertNotNull(dc); assertEquals("10.0000/5820", DublinCores.mkOpencastEpisode(dc).getDcIdentifier().get()); }
@Nonnull public static DublinCoreCatalog read(InputStream xml) throws IOException, SAXException, ParserConfigurationException { return new DublinCoreXmlFormat().readImpl(new InputSource(xml)); }
DublinCoreXmlFormat extends DefaultHandler { @Nonnull public static DublinCoreCatalog read(InputStream xml) throws IOException, SAXException, ParserConfigurationException { return new DublinCoreXmlFormat().readImpl(new InputSource(xml)); } }
DublinCoreXmlFormat extends DefaultHandler { @Nonnull public static DublinCoreCatalog read(InputStream xml) throws IOException, SAXException, ParserConfigurationException { return new DublinCoreXmlFormat().readImpl(new InputSource(xml)); } private  DublinCoreXmlFormat(); private  DublinCoreXmlFormat(boolean includeEmpty); }
DublinCoreXmlFormat extends DefaultHandler { @Nonnull public static DublinCoreCatalog read(InputStream xml) throws IOException, SAXException, ParserConfigurationException { return new DublinCoreXmlFormat().readImpl(new InputSource(xml)); } private  DublinCoreXmlFormat(); private  DublinCoreXmlFormat(boolean includeEmpty); @Nonnull static DublinCoreCatalog read(InputStream xml); @Nonnull static DublinCoreCatalog read(File xml); @Nonnull static DublinCoreCatalog read(String xml); static Opt<DublinCoreCatalog> readOpt(String xml); @Nonnull static DublinCoreCatalog read(Node xml); @Nonnull static DublinCoreCatalog read(File xml, boolean includeEmptiedElements); static DublinCoreCatalog merge(DublinCoreCatalog fromCatalog, DublinCoreCatalog intoCatalog); static Document writeDocument(DublinCoreCatalog dc); @Override void characters(char[] ch, int start, int length); @Override void startPrefixMapping(String prefix, String uri); @Override void startElement(String uri, String localName, String name, Attributes attributes); @Override void endElement(String uri, String localName, String name); @Override void error(SAXParseException e); @Override void fatalError(SAXParseException e); @Override void warning(SAXParseException e); }
DublinCoreXmlFormat extends DefaultHandler { @Nonnull public static DublinCoreCatalog read(InputStream xml) throws IOException, SAXException, ParserConfigurationException { return new DublinCoreXmlFormat().readImpl(new InputSource(xml)); } private  DublinCoreXmlFormat(); private  DublinCoreXmlFormat(boolean includeEmpty); @Nonnull static DublinCoreCatalog read(InputStream xml); @Nonnull static DublinCoreCatalog read(File xml); @Nonnull static DublinCoreCatalog read(String xml); static Opt<DublinCoreCatalog> readOpt(String xml); @Nonnull static DublinCoreCatalog read(Node xml); @Nonnull static DublinCoreCatalog read(File xml, boolean includeEmptiedElements); static DublinCoreCatalog merge(DublinCoreCatalog fromCatalog, DublinCoreCatalog intoCatalog); static Document writeDocument(DublinCoreCatalog dc); @Override void characters(char[] ch, int start, int length); @Override void startPrefixMapping(String prefix, String uri); @Override void startElement(String uri, String localName, String name, Attributes attributes); @Override void endElement(String uri, String localName, String name); @Override void error(SAXParseException e); @Override void fatalError(SAXParseException e); @Override void warning(SAXParseException e);  }