39 |
|
|
40 |
import java.io.InputStream; |
import java.io.InputStream; |
41 |
import java.io.IOException; |
import java.io.IOException; |
42 |
|
import java.io.Reader; |
43 |
|
import java.net.URL; |
44 |
import javax.xml.parsers.DocumentBuilder; |
import javax.xml.parsers.DocumentBuilder; |
45 |
import org.w3c.dom.Document; |
import org.w3c.dom.Document; |
46 |
import org.w3c.dom.DOMConfiguration; |
import org.w3c.dom.DOMConfiguration; |
142 |
throws SAXException, IOException |
throws SAXException, IOException |
143 |
{ |
{ |
144 |
LSInput input = ls.createLSInput(); |
LSInput input = ls.createLSInput(); |
145 |
|
String systemId = is.getSystemId(); |
146 |
InputStream in = is.getByteStream(); |
InputStream in = is.getByteStream(); |
147 |
if (in != null) |
if (in != null) |
148 |
{ |
{ |
150 |
} |
} |
151 |
else |
else |
152 |
{ |
{ |
153 |
input.setCharacterStream(is.getCharacterStream()); |
Reader reader = is.getCharacterStream(); |
154 |
|
if (reader != null) |
155 |
|
{ |
156 |
|
input.setCharacterStream(reader); |
157 |
|
} |
158 |
|
else |
159 |
|
{ |
160 |
|
URL url = new URL(systemId); |
161 |
|
input.setByteStream(url.openStream()); |
162 |
|
} |
163 |
} |
} |
164 |
input.setPublicId(is.getPublicId()); |
input.setPublicId(is.getPublicId()); |
165 |
input.setSystemId(is.getSystemId()); |
input.setSystemId(systemId); |
166 |
input.setEncoding(is.getEncoding()); |
input.setEncoding(is.getEncoding()); |
167 |
return parser.parse(input); |
return parser.parse(input); |
168 |
} |
} |