Package javax.xml.parsers

Examples of javax.xml.parsers.DocumentBuilderFactory


   */
  @Test
  @SuppressWarnings("nls")
  public void testW3CDocument() throws Exception {
    InputStream inS = getClass().getResourceAsStream("/data/interpreter/feed_opml.xml");
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();

    InputSource source = new InputSource(inS);
    org.w3c.dom.Document doc = documentBuilder.parse(source);
    inS.close();

View Full Code Here


      int[] selCols, int nbrSelRows, TableExportCsvController ctrl,
      int[] selRows) throws ParserConfigurationException,
      FileNotFoundException, TransformerException {

    // Using a factory to get DocumentBuilder for creating XML's
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();

    // Here instead of parsing an existing document we want to
    // create a new one.
    Document testDoc = builder.newDocument();
View Full Code Here

    * TODO this is a duplicate of test.XMLUtil.stringToElement().
    *      Only used by ServerPeer.createDestination(). Get rid of this when I fix that method.
    */
   public static Element stringToElement(String s) throws Exception
   {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder parser = factory.newDocumentBuilder();
      Document doc = parser.parse(new InputSource(new StringReader(s)));
      return doc.getDocumentElement();
   }
View Full Code Here

   * @return a XML document builder
   * @throws JRException
   */
  public static DocumentBuilder createDocumentBuilder() throws JRException
  {
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setValidating(false);
    dbf.setIgnoringComments(true);

    try
    {
      return dbf.newDocumentBuilder();
    }
    catch (ParserConfigurationException e)
    {
      throw new JRException("Failed to create a document builder factory", e);
    }
View Full Code Here

        System.out.println("update bindings:");
        System.out.println("\tConf File: " + xmlFileName);
        System.out.println("\tBinding File: " + bindingXml);
        System.out.println("\tBinding Name: " + bindingName);

        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
        documentBuilderFactory.setNamespaceAware(true);
        documentBuilderFactory.setValidating(false);

        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
        Document doc1 = documentBuilder.parse(xmlFileName);
        Document doc2 = documentBuilder.newDocument();

        doc2.appendChild(doc2.createElement("server"));
View Full Code Here

    }

    private static Document getDocument(String xmlFile)
    {
        Document doc = null;
        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();

        documentBuilderFactory.setNamespaceAware(true);
        documentBuilderFactory.setValidating(false);

        try
        {
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            doc = documentBuilder.parse(xmlFile);
        }
        catch (ParserConfigurationException e)
        {
            System.out.println("Unable to locate an XML doc builder: " + e.getMessage());
View Full Code Here

      xmlNamespaceMap = extractXmlNamespaces(contextNode);
    }
   
    if (xmlNamespaceMap != null && xmlNamespaceMap.size() > 0) {
      if (namespaceElement == null) {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);  
          DocumentBuilder builder = null;
        try {
          builder = factory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
          throw new JRException(e);
        }   
          DOMImplementation impl = builder.getDOMImplementation();
         
View Full Code Here

            dataModel.put("z", new Integer(4));
            conf.setSharedVariable("y", new Integer(7));
        }
       
        else if (testName.equals("xml-fragment")) {
            DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
            f.setNamespaceAware(true);
            DocumentBuilder db = f.newDocumentBuilder();
            org.w3c.dom.Document doc = db.parse(new InputSource(getClass().getResourceAsStream("test-xmlfragment.xml")));
            dataModel.put("node", NodeModel.wrap(doc.getDocumentElement().getFirstChild().getFirstChild()));
        }
       
        else if (testName.equals("xmlns1")) {
View Full Code Here

   
    /**
     * Read the testcase configurations file and build up the test suite
     */
    public void readConfig(File f) throws Exception {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        //dbf.setValidating(true);
        DocumentBuilder db = dbf.newDocumentBuilder();
        Document d = db.parse(f);
        Element root = d.getDocumentElement();
        NodeList children = root.getChildNodes();
        for (int i=0; i<children.getLength(); i++) {
            Node n = children.item(i);
View Full Code Here

   */
  private SimpleFontExtensionHelper()
  {
    try
    {
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      documentBuilder = factory.newDocumentBuilder();
      documentBuilder.setErrorHandler(this);
    }
    catch (ParserConfigurationException e)
    {
      throw new JRRuntimeException(e);
View Full Code Here

TOP

Related Classes of javax.xml.parsers.DocumentBuilderFactory

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.