Package javax.xml.parsers

Examples of javax.xml.parsers.DocumentBuilder.newDocument()


        rootModel = model;               
        DocumentBuilderFactory docfac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docbuild = null;
        try {
            docbuild = docfac.newDocumentBuilder();
            doc = docbuild.newDocument();           
        } catch (ParserConfigurationException pcerr) {
            System.out.println ("Could not create document :"  + pcerr);           
            // Have to exit ---
        }       
        errorList = new Vector ();      
View Full Code Here


        DocumentBuilderFactory docfac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docbuild = null;
        Document doc = null;
        try {
            docbuild = docfac.newDocumentBuilder();
            doc = docbuild.newDocument();           
        } catch (ParserConfigurationException pcerr) {
            System.out.println ("Could not create document :"  + pcerr);           
            // Have to exit ---
        }             
       
View Full Code Here

        DocumentBuilderFactory docfac = DocumentBuilderFactory.newInstance();
        DocumentBuilder docbuild = null;
        Document doc = null;
        try {
            docbuild = docfac.newDocumentBuilder();
            doc = docbuild.newDocument();           
        } catch (ParserConfigurationException pcerr) {
            System.out.println ("Could not create document :"  + pcerr);           
            // Have to exit ---
        }                      
        Element newModelRoot = doc.createElement("model");
View Full Code Here

   */
  public static Document createXML(final String rootElement) {
    final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    try {
      final DocumentBuilder db = dbf.newDocumentBuilder();
      final Document res = db.newDocument();
      res.appendChild(res.createElement(rootElement));
      return res;
    } catch (Exception e) {
      throw new BuildException("Failed to create new DOM-document:" +e, e);
    }
View Full Code Here

  public boolean spooler_process() {
    boolean rc = true;
    try {
      DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
      Document eventDocument = docBuilder.newDocument();
      eventDocument.appendChild(eventDocument.createElement("events"));
      this.setEvents(eventDocument);
      // fetch events from global Job Scheduler variable
      this.getSchedulerEvents();
      this.setParameters(spooler.create_variable_set());
View Full Code Here

   */
  public String xmlNodeToString(Node node) throws Exception {
    try {
      DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
      Document document = docBuilder.newDocument();
      document.appendChild(document.importNode(node, true));
      StringWriter out = new StringWriter();
      XMLSerializer serializer = new XMLSerializer(out, new OutputFormat(document));
      serializer.serialize(document);
      return out.toString();
View Full Code Here

            catch (Exception e)
            {
                NucleusLogger.PERSISTENCE.info(LOCALISER.msg("034201", fileUrl.getFile()));

                // File doesn't exist, so create it
                doc = db.newDocument();
                rootElement = doc.createElement("datanucleus_autostart");
                doc.appendChild(rootElement);

                writeToFile();
            }
View Full Code Here

        try
        {
          // Dont do any deletion, just reconstruct the DOM with an empty root element
            db = factory.newDocumentBuilder();
            doc = db.newDocument();
            rootElement = doc.createElement("datanucleus_autostart");
            doc.appendChild(rootElement);
        }
        catch (ParserConfigurationException e)
        {
View Full Code Here

    private Document buildXMLDocument(Report report) {
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();
            Document document = builder.newDocument();

            document.setXmlVersion("1.0");
            document.setXmlStandalone(true);

            report.writeXml(document);
View Full Code Here

      dbf.setNamespaceAware(true);

      DocumentBuilder db = dbf.newDocumentBuilder();

      result = db.newDocument();
    } catch (Exception e) {
      throw new TranslationException("Unable to create target document", //$NON-NLS-1$
          e);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.