1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.xml;
24  
25  import java.io.File;
26  import java.io.InputStream;
27  import java.io.Reader;
28  
29  import java.net.MalformedURLException;
30  import java.net.URL;
31  
32  import java.util.List;
33  import java.util.Map;
34  
35  /**
36   * <a href="SAXReader.java.html"><b><i>View Source</i></b></a>
37   *
38   * @author Brian Wing Shun Chan
39   *
40   */
41  public interface SAXReader {
42  
43      public Attribute createAttribute(
44          Element element, QName qName, String value);
45  
46      public Attribute createAttribute(
47          Element element, String name, String value);
48  
49      public Document createDocument();
50  
51      public Document createDocument(Element rootElement);
52  
53      public Document createDocument(String encoding);
54  
55      public Element createElement(QName qName);
56  
57      public Element createElement(String name);
58  
59      public Entity createEntity(String name, String text);
60  
61      public ProcessingInstruction createProcessingInstruction(
62          String target, Map<String, String> data);
63  
64      public ProcessingInstruction createProcessingInstruction(
65          String target, String data);
66  
67      public Namespace createNamespace(String uri);
68  
69      public Namespace createNamespace(String prefix, String uri);
70  
71      public QName createQName(String localName);
72  
73      public QName createQName(String localName, Namespace namespace);
74  
75      public Text createText(String text);
76  
77      public XPath createXPath(String xpathExpression);
78  
79      public Document read(File file) throws DocumentException;
80  
81      public Document read(File file, boolean validate)
82          throws DocumentException;
83  
84      public Document read(InputStream is) throws DocumentException;
85  
86      public Document read(InputStream is, boolean validate)
87          throws DocumentException;
88  
89      public Document read(Reader reader) throws DocumentException;
90  
91      public Document read(Reader reader, boolean validate)
92          throws DocumentException;
93  
94      public Document read(String xml) throws DocumentException;
95  
96      public Document read(String xml, boolean validate)
97          throws DocumentException;
98  
99      public Document read(URL url) throws DocumentException;
100 
101     public Document read(URL url, boolean validate) throws DocumentException;
102 
103     public Document readURL(String url)
104         throws DocumentException, MalformedURLException;
105 
106     public Document readURL(String url, boolean validate)
107         throws DocumentException, MalformedURLException;
108 
109     public List<Node> selectNodes(
110         String xpathFilterExpression, List<Node> nodes);
111 
112     public List<Node> selectNodes(String xpathFilterExpression, Node node);
113 
114     public void sort(List<Node> nodes, String xpathExpression);
115 
116     public void sort(
117         List<Node> nodes, String xpathExpression, boolean distinct);
118 
119 }