1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
3 * @LastModified: Oct 2017 |
4 */ |
4 */ |
5 /* |
5 /* |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
8 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
19 * limitations under the License. |
19 * limitations under the License. |
20 */ |
20 */ |
21 |
21 |
22 package com.sun.org.apache.xml.internal.utils; |
22 package com.sun.org.apache.xml.internal.utils; |
23 |
23 |
|
24 import java.util.ArrayList; |
|
25 import java.util.List; |
24 import java.util.StringTokenizer; |
26 import java.util.StringTokenizer; |
25 import java.util.Vector; |
|
26 |
|
27 import javax.xml.transform.Source; |
27 import javax.xml.transform.Source; |
28 import javax.xml.transform.TransformerException; |
28 import javax.xml.transform.TransformerException; |
29 import javax.xml.transform.URIResolver; |
29 import javax.xml.transform.URIResolver; |
30 import javax.xml.transform.sax.SAXSource; |
30 import javax.xml.transform.sax.SAXSource; |
31 |
|
32 import com.sun.org.apache.xml.internal.utils.SystemIDResolver; |
|
33 |
|
34 import org.xml.sax.Attributes; |
31 import org.xml.sax.Attributes; |
35 import org.xml.sax.InputSource; |
32 import org.xml.sax.InputSource; |
36 import org.xml.sax.helpers.DefaultHandler; |
33 import org.xml.sax.helpers.DefaultHandler; |
37 |
34 |
38 /** |
35 /** |
39 * Search for the xml-stylesheet processing instructions in an XML document. |
36 * Search for the xml-stylesheet processing instructions in an XML document. |
40 * @see <a href="http://www.w3.org/TR/xml-stylesheet/">Associating Style Sheets with XML documents, Version 1.0</a> |
37 * @see <a href="http://www.w3.org/TR/xml-stylesheet/"> |
|
38 * Associating Style Sheets with XML documents, Version 1.0</a> |
41 */ |
39 */ |
42 public class StylesheetPIHandler extends DefaultHandler |
40 public class StylesheetPIHandler extends DefaultHandler |
43 { |
41 { |
44 /** The baseID of the document being processed. */ |
42 /** The baseID of the document being processed. */ |
45 String m_baseID; |
43 String m_baseID; |
52 |
50 |
53 /** The desired character set criteria. */ |
51 /** The desired character set criteria. */ |
54 String m_charset; |
52 String m_charset; |
55 |
53 |
56 /** A list of SAXSource objects that match the criteria. */ |
54 /** A list of SAXSource objects that match the criteria. */ |
57 Vector m_stylesheets = new Vector(); |
55 List<Source> m_stylesheets = new ArrayList<>(); |
58 |
56 |
59 // Add code to use a URIResolver. Patch from Dmitri Ilyin. |
57 // Add code to use a URIResolver. Patch from Dmitri Ilyin. |
60 |
58 |
61 /** |
59 /** |
62 * The object that implements the URIResolver interface, |
60 * The object that implements the URIResolver interface, |
134 * @param data The processing instruction data, or null if |
132 * @param data The processing instruction data, or null if |
135 * none is supplied. |
133 * none is supplied. |
136 * @throws org.xml.sax.SAXException Any SAX exception, possibly |
134 * @throws org.xml.sax.SAXException Any SAX exception, possibly |
137 * wrapping another exception. |
135 * wrapping another exception. |
138 * @see org.xml.sax.ContentHandler#processingInstruction |
136 * @see org.xml.sax.ContentHandler#processingInstruction |
139 * @see <a href="http://www.w3.org/TR/xml-stylesheet/">Associating Style Sheets with XML documents, Version 1.0</a> |
137 * @see <a href="http://www.w3.org/TR/xml-stylesheet/"> |
|
138 * Associating Style Sheets with XML documents, Version 1.0</a> |
140 */ |
139 */ |
141 public void processingInstruction(String target, String data) |
140 public void processingInstruction(String target, String data) |
142 throws org.xml.sax.SAXException |
141 throws org.xml.sax.SAXException |
143 { |
142 { |
144 |
143 |