001
014
015 package com.liferay.portal.kernel.xml;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
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
032 public class SAXReaderUtil {
033
034 public static Attribute createAttribute(
035 Element element, QName qName, String value) {
036
037 return getSAXReader().createAttribute(element, qName, value);
038 }
039
040 public static Attribute createAttribute(
041 Element element, String name, String value) {
042
043 return getSAXReader().createAttribute(element, name, value);
044 }
045
046 public static Document createDocument() {
047 return getSAXReader().createDocument();
048 }
049
050 public static Document createDocument(Element rootElement) {
051 return getSAXReader().createDocument(rootElement);
052 }
053
054 public static Document createDocument(String encoding) {
055 return getSAXReader().createDocument(encoding);
056 }
057
058 public static Element createElement(QName qName) {
059 return getSAXReader().createElement(qName);
060 }
061
062 public static Element createElement(String name) {
063 return getSAXReader().createElement(name);
064 }
065
066 public static Entity createEntity(String name, String text) {
067 return getSAXReader().createEntity(name, text);
068 }
069
070 public static Namespace createNamespace(String uri) {
071 return getSAXReader().createNamespace(uri);
072 }
073
074 public static Namespace createNamespace(String prefix, String uri) {
075 return getSAXReader().createNamespace(prefix, uri);
076 }
077
078 public static ProcessingInstruction createProcessingInstruction(
079 String target, Map<String, String> data) {
080
081 return getSAXReader().createProcessingInstruction(target, data);
082 }
083
084 public static ProcessingInstruction createProcessingInstruction(
085 String target, String data) {
086
087 return getSAXReader().createProcessingInstruction(target, data);
088 }
089
090 public static QName createQName(String localName) {
091 return getSAXReader().createQName(localName);
092 }
093
094 public static QName createQName(String localName, Namespace namespace) {
095 return getSAXReader().createQName(localName, namespace);
096 }
097
098 public static Text createText(String text) {
099 return getSAXReader().createText(text);
100 }
101
102 public static XPath createXPath(String xPathExpression) {
103 return getSAXReader().createXPath(xPathExpression);
104 }
105
106 public static XPath createXPath(
107 String xPathExpression, Map<String, String> namespaceContextMap) {
108
109 return getSAXReader().createXPath(xPathExpression, namespaceContextMap);
110 }
111
112 public static XPath createXPath(
113 String xPathExpression, String prefix, String namespace) {
114
115 return getSAXReader().createXPath(xPathExpression, prefix, namespace);
116 }
117
118 public static SAXReader getSAXReader() {
119 PortalRuntimePermission.checkGetBeanProperty(SAXReaderUtil.class);
120
121 return _saxReader;
122 }
123
124 public static Document read(File file) throws DocumentException {
125 return getSAXReader().read(file);
126 }
127
128 public static Document read(File file, boolean validate)
129 throws DocumentException {
130
131 return getSAXReader().read(file, validate);
132 }
133
134 public static Document read(InputStream is) throws DocumentException {
135 return getSAXReader().read(is);
136 }
137
138 public static Document read(InputStream is, boolean validate)
139 throws DocumentException {
140
141 return getSAXReader().read(is, validate);
142 }
143
144 public static Document read(Reader reader) throws DocumentException {
145 return getSAXReader().read(reader);
146 }
147
148 public static Document read(Reader reader, boolean validate)
149 throws DocumentException {
150
151 return getSAXReader().read(reader, validate);
152 }
153
154 public static Document read(String xml) throws DocumentException {
155 return getSAXReader().read(xml);
156 }
157
158 public static Document read(String xml, boolean validate)
159 throws DocumentException {
160
161 return getSAXReader().read(xml, validate);
162 }
163
164 public static Document read(URL url) throws DocumentException {
165 return getSAXReader().read(url);
166 }
167
168 public static Document read(URL url, boolean validate)
169 throws DocumentException {
170
171 return getSAXReader().read(url, validate);
172 }
173
174 public static Document readURL(String url)
175 throws DocumentException, MalformedURLException {
176
177 return getSAXReader().readURL(url);
178 }
179
180 public static Document readURL(String url, boolean validate)
181 throws DocumentException, MalformedURLException {
182
183 return getSAXReader().readURL(url, validate);
184 }
185
186 public static List<Node> selectNodes(
187 String xPathFilterExpression, List<Node> nodes) {
188
189 return getSAXReader().selectNodes(xPathFilterExpression, nodes);
190 }
191
192 public static List<Node> selectNodes(
193 String xPathFilterExpression, Node node) {
194
195 return getSAXReader().selectNodes(xPathFilterExpression, node);
196 }
197
198 public static void sort(List<Node> nodes, String xPathExpression) {
199 getSAXReader().sort(nodes, xPathExpression);
200 }
201
202 public static void sort(
203 List<Node> nodes, String xPathExpression, boolean distinct) {
204
205 getSAXReader().sort(nodes, xPathExpression, distinct);
206 }
207
208 public void setSAXReader(SAXReader saxReader) {
209 PortalRuntimePermission.checkSetBeanProperty(getClass());
210
211 _saxReader = saxReader;
212 }
213
214 private static SAXReader _saxReader;
215
216 }