001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.xml;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import java.io.File;
020    import java.io.InputStream;
021    import java.io.Reader;
022    
023    import java.net.MalformedURLException;
024    import java.net.URL;
025    
026    import java.util.List;
027    import java.util.Map;
028    
029    /**
030     * @author Brian Wing Shun Chan
031     */
032    @ProviderType
033    public interface SAXReader {
034    
035            public Attribute createAttribute(
036                    Element element, QName qName, String value);
037    
038            public Attribute createAttribute(
039                    Element element, String name, String value);
040    
041            public Document createDocument();
042    
043            public Document createDocument(Element rootElement);
044    
045            public Document createDocument(String encoding);
046    
047            public Element createElement(QName qName);
048    
049            public Element createElement(String name);
050    
051            public Entity createEntity(String name, String text);
052    
053            public Namespace createNamespace(String uri);
054    
055            public Namespace createNamespace(String prefix, String uri);
056    
057            public ProcessingInstruction createProcessingInstruction(
058                    String target, Map<String, String> data);
059    
060            public ProcessingInstruction createProcessingInstruction(
061                    String target, String data);
062    
063            public QName createQName(String localName);
064    
065            public QName createQName(String localName, Namespace namespace);
066    
067            public Text createText(String text);
068    
069            public XPath createXPath(String xPathExpression);
070    
071            public XPath createXPath(
072                    String xPathExpression, Map<String, String> namespaceContextMap);
073    
074            public XPath createXPath(
075                    String xPathExpression, String prefix, String namespace);
076    
077            public Document read(File file) throws DocumentException;
078    
079            public Document read(File file, boolean validate) throws DocumentException;
080    
081            public Document read(InputStream is) throws DocumentException;
082    
083            public Document read(InputStream is, boolean validate)
084                    throws DocumentException;
085    
086            public Document read(Reader reader) throws DocumentException;
087    
088            public Document read(Reader reader, boolean validate)
089                    throws DocumentException;
090    
091            public Document read(String xml) throws DocumentException;
092    
093            public Document read(String xml, boolean validate) throws DocumentException;
094    
095            public Document read(String xml, XMLSchema xmlSchema)
096                    throws DocumentException;
097    
098            public Document read(URL url) throws DocumentException;
099    
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    }