1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.xml;
16  
17  import java.io.File;
18  import java.io.InputStream;
19  import java.io.Reader;
20  
21  import java.net.MalformedURLException;
22  import java.net.URL;
23  
24  import java.util.List;
25  import java.util.Map;
26  
27  /**
28   * <a href="SAXReader.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   */
32  public interface SAXReader {
33  
34      public Attribute createAttribute(
35          Element element, QName qName, String value);
36  
37      public Attribute createAttribute(
38          Element element, String name, String value);
39  
40      public Document createDocument();
41  
42      public Document createDocument(Element rootElement);
43  
44      public Document createDocument(String encoding);
45  
46      public Element createElement(QName qName);
47  
48      public Element createElement(String name);
49  
50      public Entity createEntity(String name, String text);
51  
52      public ProcessingInstruction createProcessingInstruction(
53          String target, Map<String, String> data);
54  
55      public ProcessingInstruction createProcessingInstruction(
56          String target, String data);
57  
58      public Namespace createNamespace(String uri);
59  
60      public Namespace createNamespace(String prefix, String uri);
61  
62      public QName createQName(String localName);
63  
64      public QName createQName(String localName, Namespace namespace);
65  
66      public Text createText(String text);
67  
68      public XPath createXPath(String xpathExpression);
69  
70      public Document read(File file) throws DocumentException;
71  
72      public Document read(File file, boolean validate)
73          throws DocumentException;
74  
75      public Document read(InputStream is) throws DocumentException;
76  
77      public Document read(InputStream is, boolean validate)
78          throws DocumentException;
79  
80      public Document read(Reader reader) throws DocumentException;
81  
82      public Document read(Reader reader, boolean validate)
83          throws DocumentException;
84  
85      public Document read(String xml) throws DocumentException;
86  
87      public Document read(String xml, boolean validate)
88          throws DocumentException;
89  
90      public Document read(URL url) throws DocumentException;
91  
92      public Document read(URL url, boolean validate) throws DocumentException;
93  
94      public Document readURL(String url)
95          throws DocumentException, MalformedURLException;
96  
97      public Document readURL(String url, boolean validate)
98          throws DocumentException, MalformedURLException;
99  
100     public List<Node> selectNodes(
101         String xpathFilterExpression, List<Node> nodes);
102 
103     public List<Node> selectNodes(String xpathFilterExpression, Node node);
104 
105     public void sort(List<Node> nodes, String xpathExpression);
106 
107     public void sort(
108         List<Node> nodes, String xpathExpression, boolean distinct);
109 
110 }