1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public interface SAXReader {
41  
42      public Attribute createAttribute(
43          Element element, QName qName, String value);
44  
45      public Attribute createAttribute(
46          Element element, String name, String value);
47  
48      public Document createDocument();
49  
50      public Document createDocument(Element rootElement);
51  
52      public Document createDocument(String encoding);
53  
54      public Element createElement(QName qName);
55  
56      public Element createElement(String name);
57  
58      public Entity createEntity(String name, String text);
59  
60      public ProcessingInstruction createProcessingInstruction(
61          String target, Map<String, String> data);
62  
63      public ProcessingInstruction createProcessingInstruction(
64          String target, String data);
65  
66      public Namespace createNamespace(String uri);
67  
68      public Namespace createNamespace(String prefix, String uri);
69  
70      public QName createQName(String localName);
71  
72      public QName createQName(String localName, Namespace namespace);
73  
74      public Text createText(String text);
75  
76      public XPath createXPath(String xpathExpression);
77  
78      public Document read(File file) throws DocumentException;
79  
80      public Document read(File file, boolean validate)
81          throws DocumentException;
82  
83      public Document read(InputStream is) throws DocumentException;
84  
85      public Document read(InputStream is, boolean validate)
86          throws DocumentException;
87  
88      public Document read(Reader reader) throws DocumentException;
89  
90      public Document read(Reader reader, boolean validate)
91          throws DocumentException;
92  
93      public Document read(String xml) throws DocumentException;
94  
95      public Document read(String xml, boolean validate)
96          throws DocumentException;
97  
98      public Document read(URL url) throws DocumentException;
99  
100     public Document read(URL url, boolean validate) throws DocumentException;
101 
102     public Document readURL(String url)
103         throws DocumentException, MalformedURLException;
104 
105     public Document readURL(String url, boolean validate)
106         throws DocumentException, MalformedURLException;
107 
108     public List<Node> selectNodes(
109         String xpathFilterExpression, List<Node> nodes);
110 
111     public List<Node> selectNodes(String xpathFilterExpression, Node node);
112 
113     public void sort(List<Node> nodes, String xpathExpression);
114 
115     public void sort(
116         List<Node> nodes, String xpathExpression, boolean distinct);
117 
118 }