Package org.w3c.dom

Examples of org.w3c.dom.Document


    }
  }

  @Override
  public Document getDocument(String file) {
    Document doc = null;
    try {
      InputStream is = DefaultDom.class.getResourceAsStream("/" + file);
      doc = db.parse(is);
    } catch (SAXException e) {
      e.printStackTrace();
View Full Code Here


     * @return Returns
     * @throws Exception Throws
     */
    public static String xhtmlToDiff(String xhtml, int width, int height)
            throws Exception {
        Document doc = XMLUtil.documentFromFile(xhtml);
        Graphics2DRenderer renderer = new Graphics2DRenderer();
        renderer.setDocument(doc, new File(xhtml).toURI().toURL().toString());

        BufferedImage buff = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
        Graphics2D g = (Graphics2D) buff.getGraphics();
View Full Code Here

        );
    }

    public void setDocumentFromString(String content) {
        InputSource is = new InputSource(new BufferedReader(new StringReader(content)));
        Document dom = XMLResource.load(is).getDocument();

        setDocument(dom, null);
    }
View Full Code Here

  public MappingFileData read(URL url) {
    MappingFileData result = null;
    InputStream stream = null;
    try {
      stream = url.openStream();
      Document document = documentBuilder.parse(stream);
     
      MappingsSource parser = new XMLParser(document);
      result = parser.load();
    } catch (Throwable e) {
      log.error("Error while loading dozer mapping file url: [" + url + "]", e);
View Full Code Here

        if(actual.length() == 0) {
            Assert.assertEquals(expected, actual);
        }
        actual = "<doc>" + actual + "</doc>";
        expected = "<doc>" + expected + "</doc>";
        Document actualDoc = buildDocument(new ByteArrayInputStream(actual.getBytes("UTF-8")));
        Document expectedDoc = buildDocument(new ByteArrayInputStream(expected.getBytes("UTF-8")));
        XMLAssert.assertXMLEqual(expectedDoc, actualDoc);
    }
View Full Code Here

        XMLAssert.assertXMLEqual(expectedDoc, actualDoc);
    }

    private static Document buildDocument(InputStream is) {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        final Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(is);
        } catch (Exception e) {
            throw new IllegalStateException("buildDocument failed!", e);
View Full Code Here

        if(actual.length() == 0) {
            Assert.assertEquals(actual, expected);
        }
        actual = "<doc>" + actual + "</doc>";
        expected = "<doc>" + expected + "</doc>";
        Document actualDoc = buildDocument(new ByteArrayInputStream(actual.getBytes("UTF-8")));
        Document expectedDoc = buildDocument(new ByteArrayInputStream(expected.getBytes("UTF-8")));
        XMLAssert.assertXMLEqual(actualDoc, expectedDoc);
    }
View Full Code Here

        XMLAssert.assertXMLEqual(actualDoc, expectedDoc);
    }

    private static Document buildDocument(InputStream is) {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        final Document doc;
        try {
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(is);
        } catch (Exception e) {
            throw new IllegalStateException("buildDocument failed!", e);
View Full Code Here

   */
  public void load(final InputStream in)
      throws IOException, SAXException, ParserConfigurationException
  {
    content.clear();
    final Document doc = DOMUtilities.parseInputStream(in);
    final Element e = doc.getDocumentElement();
    final NodeList list = e.getElementsByTagName("key"); //$NON-NLS-1$
    for (int i = 0; i < list.getLength(); i++)
    {
      final Element keyElement = (Element) list.item(i);
      final String keyName = keyElement.getAttribute("name"); //$NON-NLS-1$
View Full Code Here

        assertNotNull(d);
       
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = dbf.newDocumentBuilder();

        Document document = DOMUtils.readXml(getResourceAsStream("echo-payload.xml"));

        DOMSource source = new DOMSource(document.getDocumentElement());
       
        Source object = d.invoke(source);
        assertNotNull(object);
    }
View Full Code Here

TOP

Related Classes of org.w3c.dom.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.