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

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


      theCurrentOption = (Option)theOptionsIterator.next();
      char c = theCurrentOption.getArgLetter();
      boolean shouldHaveArg = theOptionMatcher.hasArg(c);
      String arg = theCurrentOption.getArgument();
      if(!theOptionMatcher.match(c)) {
                ErrorMsg msg = new ErrorMsg(ErrorMsg.ILLEGAL_CMDLINE_OPTION_ERR,
                                            new Character(c));
    throw (new IllegalArgumentException(msg.toString()));
      }
      else if(shouldHaveArg && (arg == null)) {
                ErrorMsg msg = new ErrorMsg(ErrorMsg.CMDLINE_OPT_MISSING_ARG_ERR,
                                            new Character(c));
    throw (new MissingOptArgException(msg.toString()));
      }
      retval = c;
  }
  return retval;
    }
View Full Code Here


      // Handle xsl:use-attribute-sets. Attribute sets are placed first
      // in the vector or attributes to make sure that later local
      // attributes can override an attributes in the set.
      if (qname.equals(parser.getUseAttributeSets())) {
              if (!Util.isValidQNames(val)) {
                    ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, val, this);
                    parser.reportError(Constants.ERROR, err)
               }
    setFirstAttribute(new UseAttributeSets(val, parser));
      }
      // Handle xsl:extension-element-prefixes
View Full Code Here

      // Get the namespace uri from the symbol table
      if (prefix.equals(XMLNS_PREFIX) == false) {
    namespace = _symbolTable.lookupNamespace(prefix);
    if (namespace == null && reportError) {
        final int line = getLineNumber();
        ErrorMsg err = new ErrorMsg(ErrorMsg.NAMESPACE_UNDEF_ERR,
            line, prefix);
        reportError(ERROR, err);
    }
      }
      return getQName(namespace, prefix, localname);
View Full Code Here

      }
      stylesheet.setParser(this);
      return stylesheet;
  }
  catch (ClassCastException e) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.NOT_STYLESHEET_ERR, element);
      throw new CompilerException(err.toString());
  }
    }
View Full Code Here

    final Enumeration elements = stylesheet.elements();
    while (elements.hasMoreElements()) {
        Object child = elements.nextElement();
        if (child instanceof Text) {
      final int l = getLineNumber();
      ErrorMsg err =
          new ErrorMsg(ErrorMsg.ILLEGAL_TEXT_NODE_ERR,l,null);
      reportError(ERROR, err);
        }
    }
    if (!errorsFound()) {
        stylesheet.typeCheck(_symbolTable);
    }
      }
  }
  catch (TypeCheckError e) {
      reportError(ERROR, new ErrorMsg(e));
  }
    }
View Full Code Here

      // Find the start of the stylesheet within the tree
      return (SyntaxTreeNode)getStylesheet(_root)
  }
  catch (IOException e) {
      if (_xsltc.debug()) e.printStackTrace();
      reportError(ERROR,new ErrorMsg(e));
  }
  catch (SAXException e) {
      Throwable ex = e.getException();
      if (_xsltc.debug()) {
    e.printStackTrace();
    if (ex != null) ex.printStackTrace();
      }
      reportError(ERROR, new ErrorMsg(e));
  }
  catch (CompilerException e) {
      if (_xsltc.debug()) e.printStackTrace();
      reportError(ERROR, new ErrorMsg(e));
  }
  catch (Exception e) {
      if (_xsltc.debug()) e.printStackTrace();
      reportError(ERROR, new ErrorMsg(e));
  }
  return null;
    }
View Full Code Here

      final SAXParser parser = factory.newSAXParser();
      final XMLReader reader = parser.getXMLReader();
      return(parse(reader, input));
  }
  catch (ParserConfigurationException e) {
      ErrorMsg err = new ErrorMsg(ErrorMsg.SAX_PARSER_CONFIG_ERR);
      reportError(ERROR, err);
  }
  catch (SAXParseException e){
      reportError(ERROR, new ErrorMsg(e.getMessage(),e.getLineNumber()));
  }
  catch (SAXException e) {
      reportError(ERROR, new ErrorMsg(e.getMessage()));
  }
  return null;
    }
View Full Code Here

  // Assume that this is a pure XSL stylesheet if there is not
  // <?xml-stylesheet ....?> processing instruction
  if (_target == null) {
      if (!_rootNamespaceDef) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.MISSING_XSLT_URI_ERR);
    throw new CompilerException(msg.toString());
      }
      return(root);
  }

  // Find the xsl:stylesheet or xsl:transform with this reference
  if (_target.charAt(0) == '#') {
      SyntaxTreeNode element = findStylesheet(root, _target.substring(1));
      if (element == null) {
    ErrorMsg msg = new ErrorMsg(ErrorMsg.MISSING_XSLT_TARGET_ERR,
              _target, root);
    throw new CompilerException(msg.toString());
      }
      return(element);
  }
  else {
      return(loadExternalStylesheet(_target));
View Full Code Here

        _xsltc.setStylesheet((Stylesheet)node);
    }
    checkForSuperfluousAttributes(node, attributes);
      }
      catch (ClassNotFoundException e) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, node);
    reportError(ERROR, err);
      }
      catch (Exception e) {
    ErrorMsg err = new ErrorMsg(ErrorMsg.INTERNAL_ERR,
              e.getMessage(), node);
    reportError(FATAL, err);
      }
  }
  else {
      if (uri != null) {
    // Check if the element belongs in our namespace
    if (uri.equals(XSLT_URI)) {
        node = new UnsupportedElement(uri, prefix, local, false);
        UnsupportedElement element = (UnsupportedElement)node;
        ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_XSL_ERR,
            getLineNumber(),local);
        element.setErrorMessage(msg);
        if (versionIsOne) {
          reportError(UNSUPPORTED,msg);
         }
    }
    // Check if this is an XSLTC extension element
    else if (uri.equals(TRANSLET_URI)) {
        node = new UnsupportedElement(uri, prefix, local, true);
        UnsupportedElement element = (UnsupportedElement)node;
        ErrorMsg msg = new ErrorMsg(ErrorMsg.UNSUPPORTED_EXT_ERR,
            getLineNumber(),local);
        element.setErrorMessage(msg);
    }
    // Check if this is an extension of some other XSLT processor
    else {
        Stylesheet sheet = _xsltc.getStylesheet();
        if ((sheet != null) && (sheet.isExtension(uri))) {
      if (sheet != (SyntaxTreeNode)_parentStack.peek()) {
          node = new UnsupportedElement(uri, prefix, local, true);
          UnsupportedElement elem = (UnsupportedElement)node;
          ErrorMsg msg =
        new ErrorMsg(ErrorMsg.UNSUPPORTED_EXT_ERR,
               getLineNumber(),
               prefix+":"+local);
          elem.setErrorMessage(msg);
      }
        }
View Full Code Here

              if (attrQName.equalsIgnoreCase(legal[j])) {
            break;
       
          }
          if (j == legal.length) {
              final ErrorMsg err =
            new ErrorMsg(ErrorMsg.ILLEGAL_ATTRIBUTE_ERR,
        attrQName, node);
        // Workaround for the TCK failure ErrorListener.errorTests.error001..
              err.setWarningError(true);
        reportError(WARNING, err);
          }
      }
        } 
    }
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.