Java XML DOM Parse parseDOMConfigFile(String folderPath, String configFileName)

Here you can find the source of parseDOMConfigFile(String folderPath, String configFileName)

Description

parse DOM Config File

License

Open Source License

Declaration

public static Document parseDOMConfigFile(String folderPath, String configFileName) throws Exception 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *******************************************************************************/

import java.io.File;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;

public class Main {
    public static Document parseDOMConfigFile(String folderPath, String configFileName) throws Exception {
        File clientConfigFile = new File(folderPath, configFileName);

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        return builder.parse(clientConfigFile);
    }//  w w  w  .j a  va2  s. c  o  m
}

Related

  1. parse_XML_String_and_create_DOM(String xmlData)
  2. parseDom(InputStream byteArrayInputStream)
  3. parseDom(Reader reader)
  4. parseDomFromFile(File doc)
  5. parseFileToXML(Transformer transformer, DOMSource source, File file)
  6. parseToDOM(InputStream stream)
  7. parseToDom(String content)