286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2001-2004 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * @author Jacek Ambroziak 286N/A * @author Santiago Pericas-Geertsen 286N/A * @author G. Todd Miller 286N/A * @author Morten Jorgensen 286N/A * @author John Howard (johnh@schemasoft.com) 286N/A // A reference to the main stylesheet parser object. 286N/A // A reference to an external XMLReader (SAX parser) passed to us 286N/A // A reference to the stylesheet being compiled. 286N/A // Counters used by various classes to generate unique names. 286N/A // private int _variableSerial = 1; 286N/A // Namespace index tables 286N/A // All literal text in the stylesheet 286N/A // These define the various methods for outputting the translet 286N/A // Compiler options (passed from command line or XSLTC client) 286N/A * Set to true if template inlining is requested. Template 286N/A * inlining used to be the default, but we have found that 286N/A * Hotspots does a better job with shorter methods, so the 286N/A * default is *not* to inline now. 286N/A * State of the secure processing feature. 559N/A * protocols allowed for external references set by the stylesheet processing instruction, Import and Include element. 559N/A * protocols allowed for external DTD references in source file and/or stylesheet. 286N/A * XSLTC compiler constructor 286N/A * Set the state of the secure processing feature. 286N/A * Return the state of the secure processing feature. 286N/A * Return the state of the services mechanism feature. 286N/A * Set the state of the services mechanism feature. 559N/A * Return allowed protocols for accessing external stylesheet. 559N/A * Set allowed protocols for accessing external stylesheet. 286N/A * Only for user by the internal TrAX implementation. 286N/A * Only for user by the internal TrAX implementation. 286N/A * Only for user by the internal TrAX implementation. 286N/A * Initializes the compiler to compile a new stylesheet 286N/A * Initializes the compiler to produce a new translet 286N/A * Defines an external SourceLoader to provide the compiler with documents 286N/A * Set a flag indicating if templates are to be inlined or not. The 286N/A * default is to do inlining, but this causes problems when the 286N/A * stylesheets have a large number of templates (e.g. branch targets 286N/A * exceeding 64K or a length of a method exceeding 64K). 286N/A * Return the state of the template inlining feature. 286N/A * Set the parameters to use to locate the correct <?xml-stylesheet ...?> 286N/A * processing instruction in the case where the input document to the 286N/A * compiler (and parser) is an XML document. 286N/A * @param media The media attribute to be matched. May be null, in which 286N/A * case the prefered templates will be used (i.e. alternate = no). 286N/A * @param title The value of the title attribute to match. May be null. 286N/A * @param charset The value of the charset attribute to match. May be null. 286N/A * Compiles an XSL stylesheet pointed to by a URL 286N/A * @param url An URL containing the input XSL stylesheet 286N/A // Open input stream from URL and wrap inside InputSource 286N/A * Compiles an XSL stylesheet pointed to by a URL 286N/A * @param url An URL containing the input XSL stylesheet 286N/A * @param name The name to assign to the translet class 286N/A // Open input stream from URL and wrap inside InputSource 286N/A * Compiles an XSL stylesheet passed in through an InputStream 286N/A * @param stream An InputStream that will pass in the stylesheet contents 286N/A * @param name The name of the translet class to generate 286N/A * @return 'true' if the compilation was successful 286N/A * Compiles an XSL stylesheet passed in through an InputStream 286N/A * @param input An InputSource that will pass in the stylesheet contents 286N/A * @param name The name of the translet class to generate - can be null 286N/A * @return 'true' if the compilation was successful 286N/A // Reset globals in case we're called by compile(Vector v); 286N/A // The systemId may not be set, so we'll have to check the URL 286N/A // Set the translet class name if not already set 286N/A // Ensure we have a non-empty class name at this point 286N/A // Get the root node of the abstract syntax tree 286N/A // Compile the translet - this is where the work is done! 286N/A // Create a Stylesheet element from the root node 286N/A // Create AST under the Stylesheet element (parse & type-check) 286N/A // Generate the bytecodes and output the translet class(es) 286N/A // Class synchronization is needed for BCEL 286N/A * Compiles a set of stylesheets pointed to by a Vector of URLs 286N/A * @param stylesheets A Vector containing URLs pointing to the stylesheets 286N/A * @return 'true' if the compilation was successful 286N/A // Get the number of stylesheets (ie. URLs) in the vector 286N/A // Return straight away if the vector is empty 286N/A // Special handling needed if the URL count is one, becuase the 286N/A // _className global must not be reset if it was set explicitly 286N/A // Traverse all elements in the vector and compile 286N/A * Returns an array of bytecode arrays generated by a compilation. 286N/A * @return JVM bytecodes that represent translet class definition 286N/A * Compiles a stylesheet pointed to by a URL. The result is put in a 286N/A * set of byte arrays. One byte array for each generated class. 286N/A * @param name The name of the translet class to generate 286N/A * @param input An InputSource that will pass in the stylesheet contents 286N/A * @param outputType The output type 286N/A * @return JVM bytecodes that represent translet class definition 286N/A * Compiles a stylesheet pointed to by a URL. The result is put in a 286N/A * set of byte arrays. One byte array for each generated class. 286N/A * @param name The name of the translet class to generate 286N/A * @param input An InputSource that will pass in the stylesheet contents 286N/A * @return JVM bytecodes that represent translet class definition 286N/A * Set the XMLReader to use for parsing the next input stylesheet 286N/A * @param reader XMLReader (SAX2 parser) to use 286N/A * Get the XMLReader to use for parsing the next input stylesheet 286N/A * Get a Vector containing all compile error messages 286N/A * @return A Vector containing all compile error messages 286N/A * Get a Vector containing all compile warning messages 286N/A * @return A Vector containing all compile error messages 286N/A * Print all compile error messages to standard output 286N/A * Print all compile warning messages to standard output 286N/A * This method is called by the XPathParser when it encounters a call 286N/A * to the document() function. Affects the DOM used by the translet. 286N/A * This method is called by the XPathParser when it encounters a call 286N/A * to the nodeset() extension function. Implies multi document. 286N/A * Set the class name for the generated translet. This class name is 286N/A * overridden if multiple stylesheets are compiled in one go using the 286N/A * compile(Vector urls) method. 286N/A * @param className The name to assign to the translet class 286N/A * Get the class name for the generated translet. 286N/A * Convert for Java class name of local system file name. 286N/A * Generate an output File object to send the translet to 286N/A * Set the destination directory for the translet. 286N/A * The current working directory will be used by default. 286N/A * Set an optional package name for the translet and auxiliary classes 286N/A * Set the name of an optional JAR-file to dump the translet and 286N/A * Set the top-level stylesheet 286N/A * Returns the top-level stylesheet 286N/A * Registers an attribute and gives it a type so that it can be mapped to 286N/A * DOM attribute types at run-time. 286N/A * Registers an element and gives it a type so that it can be mapped to 286N/A * DOM element types at run-time. 286N/A // Register element (full QName) 286N/A * Registers a namespace prefix and gives it a type so that it can be mapped to 286N/A * DOM namespace types at run-time. 286N/A // namespace::ext2:ped2 will be made empty in TypedNamespaceIterator 286N/A * Registers a namespace and gives it a type so that it can be mapped to 286N/A * DOM namespace types at run-time. 286N/A * Returns a unique name for every helper class needed to 286N/A * File separators are converted to forward slashes for ZIP files. 286N/A * Generate output JAR-file and packages 286N/A * Get current debugging message setting 286N/A * Retrieve a string representation of the character data to be stored 286N/A * in the translet as a <code>char[]</code>. There may be more than 286N/A * one such array required. 286N/A * @param index The index of the <code>char[]</code>. Zero-based. 286N/A * @return String The character data to be stored in the corresponding 286N/A * Get the number of char[] arrays, thus far, that will be created to 286N/A * store literal text in the stylesheet. 286N/A * Add literal text to char arrays that will be used to store character 286N/A * data in the stylesheet. 286N/A * @param newData String data to be added to char arrays. 286N/A * Pre-condition: <code>newData.length() ≤ 21845</code> 286N/A * @return int offset at which character data will be stored 286N/A // Character data could take up to three-times as much space when 286N/A // written to the class file as UTF-8. The maximum size for a 286N/A // constant is 65535/3. If we exceed that, 286N/A // (We really should use some "bin packing".)