Package com.sun.org.apache.xalan.internal.xsltc.compiler.util

Examples of com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg


     */
    public Type typeCheck(SymbolTable stable) throws TypeCheckError {
        // At least one argument - two at most
        final int ac = argumentCount();
        if ((ac < 1) || (ac > 2)) {
            ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }
        if (getStylesheet() == null) {
            ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }

        // Parse the first argument
        _arg1 = argument(0);

        if (_arg1 == null) {// should not happened
            ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
            throw new TypeCheckError(msg);
        }

        _arg1Type = _arg1.typeCheck(stable);
        if ((_arg1Type != Type.NodeSet) && (_arg1Type != Type.String)) {
            _arg1 = new CastExpr(_arg1, Type.String);
        }

        // Parse the second argument
        if (ac == 2) {
            _arg2 = argument(1);

            if (_arg2 == null) {// should not happened
                ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
                throw new TypeCheckError(msg);
            }

            final Type arg2Type = _arg2.typeCheck(stable);

            if (arg2Type.identicalTo(Type.Node)) {
                _arg2 = new CastExpr(_arg2, Type.NodeSet);
            } else if (arg2Type.identicalTo(Type.NodeSet)) {
                // falls through
            } else {
                ErrorMsg msg = new ErrorMsg(ErrorMsg.DOCUMENT_ARG_ERR, this);
                throw new TypeCheckError(msg);
            }
        }

        return _type = Type.NodeSet;
View Full Code Here


  _stylesheet = super.getStylesheet();

  if (name.length() > 0) {
            if (!XML11Char.isXML11ValidQName(name)) {
                ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, name, this);
                parser.reportError(Constants.ERROR, err);          
            }               
      _name = parser.getQNameIgnoreDefaultNs(name);
  }
 
  if (mode.length() > 0) {
            if (!XML11Char.isXML11ValidQName(mode)) {
                ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this);
                parser.reportError(Constants.ERROR, err);          
            }    
      _mode = parser.getQNameIgnoreDefaultNs(mode);
  }
 
  if (match.length() > 0) {
      _pattern = parser.parsePattern(this, "match", null);
  }

  if (priority.length() > 0) {
      _priority = Double.parseDouble(priority);
  }
  else {
      if (_pattern != null)
    _priority = _pattern.getPriority();
      else
    _priority = Double.NaN;
  }

  _position = parser.getTemplateIndex();

  // Add the (named) template to the symbol table
  if (_name != null) {
      Template other = parser.getSymbolTable().addTemplate(this);
      if (!resolveNamedTemplates(other, parser)) {
    ErrorMsg err =
        new ErrorMsg(ErrorMsg.TEMPLATE_REDEF_ERR, _name, this);
    parser.reportError(Constants.ERROR, err);
      }
      // Is this a simple named template?
      if (_pattern == null && _mode == null) {
        _isSimpleNamedTemplate = true;
View Full Code Here

  }
 
  if (mode.length() > 0) {
            if (!XML11Char.isXML11ValidQName(mode)) {
                ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, mode, this);
                parser.reportError(Constants.ERROR, err);          
            }   
      _modeName = parser.getQNameIgnoreDefaultNs(mode);
  }
 
View Full Code Here

  // The 'select' expression is a result-tree
  if ((_type != null) && (_type instanceof ResultTreeType)) {
      // <xsl:sort> cannot be applied to a result tree - issue warning
      if (sortObjects.size() > 0) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this);
    getParser().reportError(WARNING, err);
      }
      // Put the result tree (a DOM adapter) on the stack
      _select.translate(classGen, methodGen)
      // Get back the DOM and iterator (not just iterator!!!)
View Full Code Here

  final Stylesheet context = parser.getCurrentStylesheet();

  try {
      String docToLoad = getAttribute("href");
      if (context.checkForLoop(docToLoad)) {
    final ErrorMsg msg = new ErrorMsg(ErrorMsg.CIRCULAR_INCLUDE_ERR,
                                                  docToLoad, this);
    parser.reportError(Constants.FATAL, msg);
    return;
      }

      InputSource input = null;
      XMLReader reader = null;
      String currLoadedDoc = context.getSystemId();
      SourceLoader loader = context.getSourceLoader();
           
            // Use SourceLoader if available
      if (loader != null) {
    input = loader.loadSource(docToLoad, currLoadedDoc, xsltc);
                if (input != null) {
                    docToLoad = input.getSystemId();
                    reader = xsltc.getXMLReader();
                } else if (parser.errorsFound()) {
                    return;
                }
      }

            // No SourceLoader or not resolved by SourceLoader
            if (input == null) {
                docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc);
                input = new InputSource(docToLoad);
      }

      // Return if we could not resolve the URL
      if (input == null) {
    final ErrorMsg msg =
        new ErrorMsg(ErrorMsg.FILE_NOT_FOUND_ERR, docToLoad, this);
    parser.reportError(Constants.FATAL, msg);
    return;
      }
           
      final SyntaxTreeNode root;
View Full Code Here

      _expression = expression;
      _lineNumber = lineNumber;
      return super.parse();
        }
        catch (IllegalCharException e) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.ILLEGAL_CHAR_ERR,
                                        lineNumber, e.getMessage());
            _parser.reportError(Constants.FATAL, err);
        }
        return null;
    }
View Full Code Here

    public final void addError(ErrorMsg error) {
  _parser.reportError(Constants.ERROR, error);
    }
          
    public void report_error(String message, Object info) {
  final ErrorMsg err = new ErrorMsg(ErrorMsg.SYNTAX_ERR, _lineNumber,
      _expression);
  _parser.reportError(Constants.FATAL, err);
    }
View Full Code Here

      final ParentLocationPath plp = (ParentLocationPath) rlp;
      final RelativeLocationPath newrlp = insertStep(step, plp.getPath());
      return new ParentLocationPath(newrlp, plp.getStep());
  }
  else {
      addError(new ErrorMsg(ErrorMsg.INTERNAL_ERR, "XPathParser.insertStep"));
      return rlp;
  }
    }
View Full Code Here

      // Store existing DOM on stack - must be restored when loop is done
      il.append(methodGen.loadDOM());

      // <xsl:sort> cannot be applied to a result tree - issue warning
      if (sortObjects.size() > 0) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.RESULT_TREE_SORT_ERR,this);
    getParser().reportError(WARNING, msg);
      }

      // Put the result tree on the stack (DOM)
      _select.translate(classGen, methodGen);
View Full Code Here

                canonicalEncoding = Encodings.convertMime2JavaEncoding(_encoding);
    OutputStreamWriter writer =
        new OutputStreamWriter(System.out, canonicalEncoding);
      }
      catch (java.io.UnsupportedEncodingException e) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_ENCODING,
              _encoding, this);
    parser.reportError(Constants.WARNING, msg);
      }
      outputProperties.setProperty(OutputKeys.ENCODING, _encoding);
  }

  // Should the XML header be omitted - translate to true/false
  attrib = getAttribute("omit-xml-declaration");
  if (!attrib.equals(Constants.EMPTYSTRING)) {
      if (attrib.equals("yes")) {
    _omitHeader = true;
      }
      outputProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, attrib);
  }

  // Add 'standalone' decaration to output - use text as is
  _standalone = getAttribute("standalone");
  if (_standalone.equals(Constants.EMPTYSTRING)) {
      _standalone = null;
  }
  else {
      outputProperties.setProperty(OutputKeys.STANDALONE, _standalone);
  }

  // Get system/public identifiers for output DOCTYPE declaration
  _doctypeSystem = getAttribute("doctype-system");
  if (_doctypeSystem.equals(Constants.EMPTYSTRING)) {
      _doctypeSystem = null;
  }
  else {
      outputProperties.setProperty(OutputKeys.DOCTYPE_SYSTEM, _doctypeSystem);
  }


  _doctypePublic = getAttribute("doctype-public");
  if (_doctypePublic.equals(Constants.EMPTYSTRING)) {
      _doctypePublic = null;
  }
  else {
      outputProperties.setProperty(OutputKeys.DOCTYPE_PUBLIC, _doctypePublic);
  }

  // Names the elements of whose text contents should be output as CDATA
  _cdata = getAttribute("cdata-section-elements");
  if (_cdata.equals(Constants.EMPTYSTRING)) {
      _cdata = null;
  }
  else {
      StringBuffer expandedNames = new StringBuffer();
      StringTokenizer tokens = new StringTokenizer(_cdata);

      // Make sure to store names in expanded form
      while (tokens.hasMoreTokens()) {
              String qname = tokens.nextToken();
                if (!XML11Char.isXML11ValidQName(qname)) {
                    ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, qname, this);
                    parser.reportError(Constants.ERROR, err)
                }       
    expandedNames.append(
             parser.getQName(qname).toString()).append(' ');
      }
View Full Code Here

TOP

Related Classes of com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.