1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.kernel.xml;
21  
22  import java.io.File;
23  import java.io.InputStream;
24  import java.io.Reader;
25  
26  import java.net.MalformedURLException;
27  import java.net.URL;
28  
29  import java.util.List;
30  import java.util.Map;
31  
32  /**
33   * <a href="SAXReader.java.html"><b><i>View Source</i></b></a>
34   *
35   * @author Brian Wing Shun Chan
36   *
37   */
38  public interface SAXReader {
39  
40      public Attribute createAttribute(
41          Element element, QName qName, String value);
42  
43      public Attribute createAttribute(
44          Element element, String name, String value);
45  
46      public Document createDocument();
47  
48      public Document createDocument(Element rootElement);
49  
50      public Document createDocument(String encoding);
51  
52      public Element createElement(QName qName);
53  
54      public Element createElement(String name);
55  
56      public Entity createEntity(String name, String text);
57  
58      public ProcessingInstruction createProcessingInstruction(
59          String target, Map<String, String> data);
60  
61      public ProcessingInstruction createProcessingInstruction(
62          String target, String data);
63  
64      public Namespace createNamespace(String uri);
65  
66      public Namespace createNamespace(String prefix, String uri);
67  
68      public QName createQName(String localName);
69  
70      public QName createQName(String localName, Namespace namespace);
71  
72      public Text createText(String text);
73  
74      public XPath createXPath(String xpathExpression);
75  
76      public Document read(File file) throws DocumentException;
77  
78      public Document read(File file, boolean validate)
79          throws DocumentException;
80  
81      public Document read(InputStream is) throws DocumentException;
82  
83      public Document read(InputStream is, boolean validate)
84          throws DocumentException;
85  
86      public Document read(Reader reader) throws DocumentException;
87  
88      public Document read(Reader reader, boolean validate)
89          throws DocumentException;
90  
91      public Document read(String xml) throws DocumentException;
92  
93      public Document read(String xml, boolean validate)
94          throws DocumentException;
95  
96      public Document read(URL url) throws DocumentException;
97  
98      public Document read(URL url, boolean validate) throws DocumentException;
99  
100     public Document readURL(String url)
101         throws DocumentException, MalformedURLException;
102 
103     public Document readURL(String url, boolean validate)
104         throws DocumentException, MalformedURLException;
105 
106     public List<Node> selectNodes(
107         String xpathFilterExpression, List<Node> nodes);
108 
109     public List<Node> selectNodes(String xpathFilterExpression, Node node);
110 
111     public void sort(List<Node> nodes, String xpathExpression);
112 
113     public void sort(
114         List<Node> nodes, String xpathExpression, boolean distinct);
115 
116 }