All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.caucho.xsl.JavaGenerator Maven / Gradle / Ivy

There is a newer version: 4.0.66
Show newest version
/*
 * Copyright (c) 1998-2012 Caucho Technology -- all rights reserved
 *
 * This file is part of Resin(R) Open Source
 *
 * Each copy or derived work must preserve the copyright notice and this
 * notice unmodified.
 *
 * Resin Open Source is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Resin Open Source is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
 * of NON-INFRINGEMENT.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Resin Open Source; if not, write to the
 *   Free SoftwareFoundation, Inc.
 *   59 Temple Place, Suite 330
 *   Boston, MA 02111-1307  USA
 *
 * @author Scott Ferguson
 */

package com.caucho.xsl;

import com.caucho.VersionFactory;
import com.caucho.java.JavaCompilerUtil;
import com.caucho.java.JavaWriter;
import com.caucho.loader.DynamicClassLoader;
import com.caucho.server.util.CauchoSystem;
import com.caucho.util.CharBuffer;
import com.caucho.util.IntArray;
import com.caucho.util.IntMap;
import com.caucho.vfs.Depend;
import com.caucho.vfs.Path;
import com.caucho.vfs.WriteStream;
import com.caucho.xml.QAbstractNode;
import com.caucho.xml.QAttr;
import com.caucho.xml.QElement;
import com.caucho.xml.QName;
import com.caucho.xml.XmlChar;
import com.caucho.xpath.Expr;
import com.caucho.xpath.NamespaceContext;
import com.caucho.xpath.expr.NumericExpr;
import com.caucho.xpath.pattern.*;
import com.caucho.xsl.fun.KeyFun;
import com.caucho.xsl.java.*;

import org.w3c.dom.*;

import java.io.IOException;
import java.text.DecimalFormatSymbols;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.logging.Logger;

/**
 * Generates code for a Java based stylesheet.
 *
 * 
 * package work.xsl;
 * public class foo extends JavaStylesheet {
 * }
 * 
*/ public class JavaGenerator extends Generator { private static final Logger log = Logger.getLogger(JavaGenerator.class.getName()); private static HashMap _tagMap; private static HashMap _topTagMap; private static int _count; Path _path; WriteStream _s; JavaWriter _out; ArrayList _matchPatterns = new ArrayList(); IntMap _matchMap = new IntMap(); ArrayList _selectPatterns = new ArrayList(); IntMap _selectMap = new IntMap(); ArrayList _exprs = new ArrayList(); IntMap _exprMap = new IntMap(); ArrayList _sorts = new ArrayList(); ArrayList _namespaces = new ArrayList(); ArrayList _formats = new ArrayList(); ArrayList _functions = new ArrayList(); ArrayList