KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > jcr > impl > util > DOMBuilder


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5
6 package org.exoplatform.services.jcr.impl.util;
7
8 import org.w3c.dom.Document JavaDoc;
9
10 import javax.xml.parsers.ParserConfigurationException JavaDoc;
11 import javax.xml.parsers.DocumentBuilderFactory JavaDoc;
12 import javax.xml.parsers.DocumentBuilder JavaDoc;
13 import java.io.InputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15
16 import org.xml.sax.SAXException JavaDoc;
17
18 /**
19  * Created by The eXo Platform SARL .
20  *
21  * @author <a HREF="mailto:geaz@users.sourceforge.net">Gennady Azarenkov</a>
22  * @version $Id: DOMBuilder.java,v 1.2 2004/07/08 23:36:50 benjmestrallet Exp $
23  */

24
25 public class DOMBuilder {
26
27   public static Document JavaDoc createDocument() throws ParserConfigurationException JavaDoc {
28     DocumentBuilderFactory JavaDoc dfactory = DocumentBuilderFactory.newInstance();
29     dfactory.setNamespaceAware(true);
30     DocumentBuilder JavaDoc docBuilder = dfactory.newDocumentBuilder();
31     return docBuilder.newDocument();
32   }
33
34   public static Document JavaDoc createDocument(InputStream JavaDoc is)
35       throws IOException JavaDoc, SAXException JavaDoc, ParserConfigurationException JavaDoc {
36     DocumentBuilderFactory JavaDoc dfactory = DocumentBuilderFactory.newInstance();
37     dfactory.setNamespaceAware(true);
38     DocumentBuilder JavaDoc docBuilder = dfactory.newDocumentBuilder();
39     return docBuilder.parse(is);
40   }
41
42
43 }
44
Popular Tags