Package org.apache.xalan.xsltc.compiler.util

Examples of org.apache.xalan.xsltc.compiler.util.ErrorMsg


      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


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

      String currLoadedDoc = context.getSystemId();
      SourceLoader loader = context.getSourceLoader();
      InputSource input = null;
      XMLReader reader = null;

      if (loader != null) {
    final XSLTC xsltc = parser.getXSLTC();
    input = loader.loadSource(docToLoad, currLoadedDoc, xsltc);
    reader = xsltc.getXMLReader();
      }
      else {
    File file = new File(currLoadedDoc);
    if (file.exists()) currLoadedDoc = "file:"+currLoadedDoc;
    final URL url = new URL(new URL(currLoadedDoc), docToLoad);
    docToLoad = url.toString();
    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

     */
    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);
  }

  // Parse the first argument - the document URI
  _uri = argument(0);
  if (_uri instanceof LiteralExpr) {
      LiteralExpr expr = (LiteralExpr)_uri;
      if (expr.getValue().equals(EMPTYSTRING)) {
    Stylesheet stylesheet = getStylesheet();
    if (stylesheet == null) {
        ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ARG_ERR, this);
        throw new TypeCheckError(msg);
    }
    _uri = new LiteralExpr(stylesheet.getSystemId(), EMPTYSTRING);
      }
  }

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

  // Parse the second argument - the document URI base
  if (ac == 2) {
      _base = argument(1);
      final Type baseType = _base.typeCheck(stable);
     
      if (baseType.identicalTo(Type.Node)) {
    _base = new CastExpr(_base, Type.NodeSet);
      }
      else if (baseType.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

  // 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);
      }
  }

  parser.setTemplate(this)// set current template
View Full Code Here

  final Template template = stable.lookupTemplate(_name);
  if (template != null) {
      typeCheckContents(stable);
  }
  else {
      ErrorMsg err = new ErrorMsg(ErrorMsg.TEMPLATE_UNDEF_ERR,_name,this);
      throw new TypeCheckError(err);
  }
  return Type.Void;
    }
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

    OutputStreamWriter writer =
        new OutputStreamWriter(System.out,
           StreamOutput.getCanonicalEncoding(_encoding));
      }
      catch (java.io.UnsupportedEncodingException e) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_ENCODING,
              _encoding, this);
    parser.reportError(Constants.WARNING, msg);
      }
      outputProperties.setProperty(OutputKeys.ENCODING, _encoding);
  }
View Full Code Here

    public void setFeature(String name, boolean value)
        throws TransformerConfigurationException {

  // feature name cannot be null
  if (name == null) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
          throw new NullPointerException(err.toString());
  }   
  // secure processing?
  else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
      _isSecureProcessing = value;   
      // all done processing feature
      return;
  }
  else
      // unknown feature
            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
            throw new TransformerConfigurationException(err.toString());
        }
    }
View Full Code Here

      SAXTransformerFactory.FEATURE_XMLFILTER
  };

  // feature name cannot be null
  if (name == null) {
          ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
          throw new NullPointerException(err.toString());
  }

  // Inefficient, but array is small
  for (int i =0; i < features.length; i++) {
      if (name.equals(features[i])) {
View Full Code Here

      return;
  }
  // Pass messages to listener, one by one
  final int count = messages.size();
  for (int pos = 0; pos < count; pos++) {
      ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
      // Workaround for the TCK failure ErrorListener.errorTests.error001.
      if (msg.isWarningError())
          _errorListener.error(
        new TransformerConfigurationException(msg.toString()));
      else
        _errorListener.warning(
        new TransformerConfigurationException(msg.toString()));
  }
    }
View Full Code Here

TOP

Related Classes of org.apache.xalan.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.