1 /* |
1 /* |
2 * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 * @LastModified: Oct 2017 |
3 */ |
4 */ |
4 /* |
5 /* |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
31 import com.sun.org.apache.xalan.internal.xsltc.dom.KeyIndex; |
32 import com.sun.org.apache.xalan.internal.xsltc.dom.KeyIndex; |
32 import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory; |
33 import com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory; |
33 import com.sun.org.apache.xml.internal.dtm.DTM; |
34 import com.sun.org.apache.xml.internal.dtm.DTM; |
34 import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator; |
35 import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator; |
35 import com.sun.org.apache.xml.internal.serializer.SerializationHandler; |
36 import com.sun.org.apache.xml.internal.serializer.SerializationHandler; |
36 import com.sun.org.apache.xml.internal.serializer.ToStream; |
|
37 import java.io.BufferedOutputStream; |
37 import java.io.BufferedOutputStream; |
38 import java.io.File; |
38 import java.io.File; |
39 import java.io.FileOutputStream; |
39 import java.io.FileOutputStream; |
40 import java.text.DecimalFormat; |
40 import java.text.DecimalFormat; |
41 import java.text.DecimalFormatSymbols; |
41 import java.text.DecimalFormatSymbols; |
42 import java.util.ArrayList; |
42 import java.util.ArrayList; |
43 import java.util.Enumeration; |
|
44 import java.util.HashMap; |
43 import java.util.HashMap; |
|
44 import java.util.List; |
45 import java.util.Map; |
45 import java.util.Map; |
46 import javax.xml.parsers.DocumentBuilderFactory; |
46 import javax.xml.parsers.DocumentBuilderFactory; |
47 import javax.xml.parsers.ParserConfigurationException; |
47 import javax.xml.parsers.ParserConfigurationException; |
48 import javax.xml.transform.Templates; |
48 import javax.xml.transform.Templates; |
49 import org.w3c.dom.DOMImplementation; |
49 import org.w3c.dom.DOMImplementation; |
69 public boolean _isStandalone = false; |
69 public boolean _isStandalone = false; |
70 public String _doctypePublic = null; |
70 public String _doctypePublic = null; |
71 public String _doctypeSystem = null; |
71 public String _doctypeSystem = null; |
72 public boolean _indent = false; |
72 public boolean _indent = false; |
73 public String _mediaType = null; |
73 public String _mediaType = null; |
74 public ArrayList<String> _cdata = null; |
74 public List<String> _cdata = null; |
75 public int _indentamount = -1; |
75 public int _indentamount = -1; |
76 |
76 |
77 public static final int FIRST_TRANSLET_VERSION = 100; |
77 public static final int FIRST_TRANSLET_VERSION = 100; |
78 public static final int VER_SPLIT_NAMES_ARRAY = 101; |
78 public static final int VER_SPLIT_NAMES_ARRAY = 101; |
79 public static final int CURRENT_TRANSLET_VERSION = VER_SPLIT_NAMES_ARRAY; |
79 public static final int CURRENT_TRANSLET_VERSION = VER_SPLIT_NAMES_ARRAY; |
147 ************************************************************************/ |
147 ************************************************************************/ |
148 |
148 |
149 // Parameter's stack: <tt>pbase</tt> and <tt>pframe</tt> are used |
149 // Parameter's stack: <tt>pbase</tt> and <tt>pframe</tt> are used |
150 // to denote the current parameter frame. |
150 // to denote the current parameter frame. |
151 protected int pbase = 0, pframe = 0; |
151 protected int pbase = 0, pframe = 0; |
152 protected ArrayList paramsStack = new ArrayList(); |
152 protected List<Object> paramsStack = new ArrayList<>(); |
153 |
153 |
154 /** |
154 /** |
155 * Push a new parameter frame. |
155 * Push a new parameter frame. |
156 */ |
156 */ |
157 public final void pushParamFrame() { |
157 public final void pushParamFrame() { |
162 /** |
162 /** |
163 * Pop the topmost parameter frame. |
163 * Pop the topmost parameter frame. |
164 */ |
164 */ |
165 public final void popParamFrame() { |
165 public final void popParamFrame() { |
166 if (pbase > 0) { |
166 if (pbase > 0) { |
167 final int oldpbase = ((Integer)paramsStack.get(--pbase)).intValue(); |
167 final int oldpbase = ((Integer)paramsStack.get(--pbase)); |
168 for (int i = pframe - 1; i >= pbase; i--) { |
168 for (int i = pframe - 1; i >= pbase; i--) { |
169 paramsStack.remove(i); |
169 paramsStack.remove(i); |
170 } |
170 } |
171 pframe = pbase; pbase = oldpbase; |
171 pframe = pbase; pbase = oldpbase; |
172 } |
172 } |
714 } |
714 } |
715 } |
715 } |
716 |
716 |
717 private Map<String, Class<?>> _auxClasses = null; |
717 private Map<String, Class<?>> _auxClasses = null; |
718 |
718 |
719 public void addAuxiliaryClass(Class auxClass) { |
719 public void addAuxiliaryClass(Class<?> auxClass) { |
720 if (_auxClasses == null) _auxClasses = new HashMap<>(); |
720 if (_auxClasses == null) _auxClasses = new HashMap<>(); |
721 _auxClasses.put(auxClass.getName(), auxClass); |
721 _auxClasses.put(auxClass.getName(), auxClass); |
722 } |
722 } |
723 |
723 |
724 public void setAuxiliaryClasses(Map<String, Class<?>> auxClasses) { |
724 public void setAuxiliaryClasses(Map<String, Class<?>> auxClasses) { |
725 _auxClasses = auxClasses; |
725 _auxClasses = auxClasses; |
726 } |
726 } |
727 |
727 |
728 public Class getAuxiliaryClass(String className) { |
728 public Class<?> getAuxiliaryClass(String className) { |
729 if (_auxClasses == null) return null; |
729 if (_auxClasses == null) return null; |
730 return((Class)_auxClasses.get(className)); |
730 return((Class)_auxClasses.get(className)); |
731 } |
731 } |
732 |
732 |
733 // GTM added (see pg 110) |
733 // GTM added (see pg 110) |