< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToXMLStream.java

Print this page

        

@@ -1,27 +1,25 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2014, 2016 Oracle and/or its affiliates. All rights reserved.
  */
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-/*
- * $Id: ToXMLStream.java,v 1.2.4.2 2005/09/15 12:01:25 suresh_emailid Exp $
- */
+
  package com.sun.org.apache.xml.internal.serializer;
 
 import java.io.IOException;
 
 import javax.xml.transform.ErrorListener;

@@ -90,10 +88,16 @@
 
         setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration());
 
         m_ispreserve = xmlListener.m_ispreserve;
         m_preserves = xmlListener.m_preserves;
+        m_ispreserveSpace = xmlListener.m_ispreserveSpace;
+        m_preserveSpaces = xmlListener.m_preserveSpaces;
+        m_childNodeNum = xmlListener.m_childNodeNum;
+        m_childNodeNumStack = xmlListener.m_childNodeNumStack;
+        m_charactersBuffer = xmlListener.m_charactersBuffer;
+        m_inEntityRef = xmlListener.m_inEntityRef;
         m_isprevtext = xmlListener.m_isprevtext;
         m_doIndent = xmlListener.m_doIndent;
         setIndentAmount(xmlListener.getIndentAmount());
         m_startNewLine = xmlListener.m_startNewLine;
         m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl;

@@ -122,11 +126,11 @@
         if (m_needToCallStartDocument)
         {
             super.startDocumentInternal();
             m_needToCallStartDocument = false;
 
-            if (m_inEntityRef)
+            if (isInEntityRef())
                 return;
 
             m_needToOutputDocTypeDecl = true;
             m_startNewLine = false;
             /* The call to getXMLVersion() might emit an error message

@@ -195,10 +199,11 @@
      *
      * @throws org.xml.sax.SAXException
      */
     public void endDocument() throws org.xml.sax.SAXException
     {
+        flushCharactersBuffer();
         flushPending();
         if (m_doIndent && !m_isprevtext)
         {
             try
             {

@@ -263,13 +268,15 @@
      * @throws org.xml.sax.SAXException
      */
     public void processingInstruction(String target, String data)
         throws org.xml.sax.SAXException
     {
-        if (m_inEntityRef)
+        if (isInEntityRef())
             return;
 
+        m_childNodeNum++;
+        flushCharactersBuffer();
         flushPending();
 
         if (target.equals(Result.PI_DISABLE_OUTPUT_ESCAPING))
         {
             startNonEscaping();
< prev index next >