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

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


    }
      }

      // If nothing was changed in this pass then we have a circular ref
      if (!changed) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.CIRCULAR_VARIABLE_ERR,
              input.toString(), this);
    getParser().reportError(Constants.ERROR, err);
    return(result);
      }
  }
View Full Code Here


  final SymbolTable stable = parser.getSymbolTable();

  // Handle the 'name' attribute
  String name = getAttribute("name");
  if (name == EMPTYSTRING) {
      ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ELEM_NAME_ERR,
          name, this);
      parser.reportError(WARNING, msg);
      parseChildren(parser);
      _ignore = true;   // Ignore the element if the QName is invalid
      return;
  }

  // Get namespace attribute
  String namespace = getAttribute("namespace");

  // Optimize compilation when name is known at compile time
        _isLiteralName = Util.isLiteral(name);
  if (_isLiteralName) {
            if (!XML11Char.isXML11ValidQName(name)) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_ELEM_NAME_ERR,
              name, this);
    parser.reportError(WARNING, msg);
    parseChildren(parser);
    _ignore = true;   // Ignore the element if the QName is invalid
    return;
      }

      final QName qname = parser.getQNameSafe(name);
      String prefix = qname.getPrefix();
      String local = qname.getLocalPart();
     
      if (prefix == null) {
    prefix = EMPTYSTRING;
      }

      if (!hasAttribute("namespace")) {
    namespace = lookupNamespace(prefix);
    if (namespace == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR,
            prefix, this);
        parser.reportError(WARNING, err);
        parseChildren(parser);
        _ignore = true;   // Ignore the element if prefix is undeclared
        return;
    }
    _prefix = prefix;
    _namespace = new AttributeValueTemplate(namespace, parser, this);
      }
      else {
    if (prefix == EMPTYSTRING) {
              if (Util.isLiteral(namespace)) {
      prefix = lookupPrefix(namespace);
      if (prefix == null) {
          prefix = stable.generateNamespacePrefix();
      }
        }

        // Prepend prefix to local name
        final StringBuffer newName = new StringBuffer(prefix);
        if (prefix != EMPTYSTRING) {
      newName.append(':');
        }
        name = newName.append(local).toString();
    }
    _prefix = prefix;
    _namespace = new AttributeValueTemplate(namespace, parser, this);
      }
  }
  else {
            // name attribute contains variable parts.  If there is no namespace
            // attribute, the generated code needs to be prepared to look up
            // any prefix in the stylesheet at run-time.
            _namespace = (namespace == EMPTYSTRING) ? null :
       new AttributeValueTemplate(namespace, parser, this);
  }

  _name = new AttributeValueTemplate(name, parser, this);

  final String useSets = getAttribute("use-attribute-sets");
  if (useSets.length() > 0) {
            if (!Util.isValidQNames(useSets)) {
                ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this);
                parser.reportError(Constants.ERROR, err)
            }
      setFirstElement(new UseAttributeSets(useSets, parser));
  }
View Full Code Here

     * @param error The error code (from util/ErrorMsg).
     * @param message Any additional error message.
     */
    protected void reportError(SyntaxTreeNode element, Parser parser,
             String errorCode, String message) {
  final ErrorMsg error = new ErrorMsg(errorCode, message, element);
        parser.reportError(Constants.ERROR, error);
    }
View Full Code Here

     * @param error The error code (from util/ErrorMsg).
     * @param message Any additional error message.
     */
    protected  void reportWarning(SyntaxTreeNode element, Parser parser,
          String errorCode, String message) {
  final ErrorMsg error = new ErrorMsg(errorCode, message, element);
        parser.reportError(Constants.WARNING, error);
    }
View Full Code Here

  Stylesheet context = parser.getCurrentStylesheet();
       
  String docToLoad = getAttribute("href");
  try {
      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();
                }
      }

            // 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

  _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

    public void parseContents(Parser parser) {
        final String name = getAttribute("name");
        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);
        }
        else {
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

    public void transform(Source source, Result result)
  throws TransformerException
    {
  if (!_isIdentity) {
      if (_translet == null) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_TRANSLET_ERR);
    throw new TransformerException(err.toString());
      }
      // Pass output properties to the translet
      transferOutputProperties(_translet);
  }
     
  final TransletOutputHandler toHandler = getOutputHandler(result);
  if (toHandler == null) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
      throw new TransformerException(err.toString());
  }

  if (_uriResolver != null && !_isIdentity) {
      _translet.setDOMCache(this);
  }
View Full Code Here

    }

    // or try to get just a systemId string from Result object
    String systemId = result.getSystemId();
    if (systemId == null) {
        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
                    throw new TransformerException(err.toString());
    }

    // System Id may be in one of several forms, (1) a uri
    // that starts with 'file:', (2) uri that starts with 'http:'
    // or (3) just a filename on the local system.
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.