1 /*
2 * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Oct 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xml.internal.serializer;
23
32 import org.w3c.dom.Node;
33 import org.xml.sax.Attributes;
34 import org.xml.sax.ContentHandler;
35 import org.xml.sax.Locator;
36 import org.xml.sax.SAXException;
37
38 /**
39 *This class wraps another SerializationHandler. The wrapped object will either
40 * handler XML or HTML, which is not known until a little later when the first XML
41 * tag is seen. If the first tag is <html> then the wrapped object is an HTML
42 * handler, otherwise it is an XML handler.
43 *
44 * This class effectively caches the first few calls to it then passes them
45 * on to the wrapped handler (once it exists). After that subsequent calls a
46 * simply passed directly to the wrapped handler.
47 *
48 * The user of this class doesn't know if the output is ultimatley XML or HTML.
49 *
50 * This class is not a public API, it is public because it is used within Xalan.
51 * @xsl.usage internal
52 */
53 public final class ToUnknownStream extends SerializerBase
54 {
55 /**
56 * The wrapped handler, initially XML but possibly switched to HTML
57 */
58 private SerializationHandler m_handler;
59
60 /**
61 * A String with no characters
62 */
63 private static final String EMPTYSTRING = "";
64
65 /**
66 * true if the underlying handler (XML or HTML) is fully initialized
67 */
68 private boolean m_wrapped_handler_not_initialized = false;
69
70 /**
71 * the prefix of the very first tag in the document
|
1 /*
2 * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xml.internal.serializer;
22
31 import org.w3c.dom.Node;
32 import org.xml.sax.Attributes;
33 import org.xml.sax.ContentHandler;
34 import org.xml.sax.Locator;
35 import org.xml.sax.SAXException;
36
37 /**
38 *This class wraps another SerializationHandler. The wrapped object will either
39 * handler XML or HTML, which is not known until a little later when the first XML
40 * tag is seen. If the first tag is <html> then the wrapped object is an HTML
41 * handler, otherwise it is an XML handler.
42 *
43 * This class effectively caches the first few calls to it then passes them
44 * on to the wrapped handler (once it exists). After that subsequent calls a
45 * simply passed directly to the wrapped handler.
46 *
47 * The user of this class doesn't know if the output is ultimatley XML or HTML.
48 *
49 * This class is not a public API, it is public because it is used within Xalan.
50 * @xsl.usage internal
51 * @LastModified: Oct 2017
52 */
53 public final class ToUnknownStream extends SerializerBase
54 {
55 /**
56 * The wrapped handler, initially XML but possibly switched to HTML
57 */
58 private SerializationHandler m_handler;
59
60 /**
61 * A String with no characters
62 */
63 private static final String EMPTYSTRING = "";
64
65 /**
66 * true if the underlying handler (XML or HTML) is fully initialized
67 */
68 private boolean m_wrapped_handler_not_initialized = false;
69
70 /**
71 * the prefix of the very first tag in the document
|