Package org.xml.sax

Examples of org.xml.sax.SAXParseException


            rule.setConsequence( consequence );
        }
        catch ( FactoryException e )
        {
            throw new SAXParseException( "error constructing consequence",
                    this.ruleSetReader.getLocator( ), e );
        }
        return null;
    }
View Full Code Here


   * @param text the error message text.
   */
  XmlParseException error(String text)
  {
    if (_errorHandler != null) {
      SAXParseException e = new SAXParseException(text, _locator);

      try {
        _errorHandler.fatalError(e);
      } catch (SAXException e1) {
      }
View Full Code Here

    {
    if (errorHandler == null) {
        return;
    }

    SAXParseException e;
    if (locator != null) {
        e = new SAXParseException(message, locator);
    } else {
        e = new SAXParseException(message, null, null, -1, -1);
    }
    errorHandler.error(e);
    }
View Full Code Here

          // If we don't do this, and the exception is a RuntimeException,
          // good line numbers of where the exception occured in the stylesheet
          // won't get reported.  I tried just catching RuntimeException, but
          // for whatever reason it didn't seem to catch.
          // Fix for Christina's DOMException error problem.
          throw new SAXParseException(re.getMessage(),
          m_transformer.getCurrentElement().getPublicId(),
          m_transformer.getCurrentElement().getSystemId(),
          m_transformer.getCurrentElement().getLineNumber(),
          m_transformer.getCurrentElement().getColumnNumber(),
          re);
View Full Code Here

      XsQName name = pReferencedType.getName();
      TypeSG result;
      if (pReferencedType.isGlobal()) {
          result = pFactory.getTypeSG(pReferencedType);
          if (result == null) {
              throw new SAXParseException("Unknown global type " + name,
                                        pReferencingType.getLocator());
          }
      } else {
          throw new IllegalStateException("A referenced type must be global.");
      }
View Full Code Here

        JavaQName runtimeType;
        if (simpleType.isAtomic()) {
          result = newGlobalAtomicTypeSG(pFactory, pSchema, pType);
            if (result == null) {
                if (!simpleType.isRestriction()) {
                    throw new SAXParseException("Atomic type must be either a builtin or a restriction of another atomic type",
                                                pType.getLocator());
                }
                TypeSG type = pSchema.getType(simpleType.getRestrictedType().getName());
                runtimeType = type.getSimpleTypeSG().getRuntimeType();
                result = newAtomicTypeRestriction(pController, pFactory, pSchema, pType);
View Full Code Here

    public TypedValue getCastFromString(SimpleTypeSG pController, String pValue)
            throws SAXException {
      if (javaType.getParseMethod() == null) {
        return super.getCastFromString(pController, pValue);
        } else {
          throw new SAXParseException("Use of the parse method at compile time is unsupported.",
                                  javaType.getLocator());
        }
    }
View Full Code Here

    public void reportError(Locator locator, String errorDomain,
                            int majorCode, int minorCode, Object args[],
                            int errorType) throws Exception {

        // create the appropriate message
        SAXParseException spe;
        if (errorDomain.equals(XMLMessages.XML_DOMAIN)) {
            spe = new SAXParseException(fgXMLMessages.createMessage(fLocale, majorCode, minorCode, args), locator);
        }
        else if (errorDomain.equals(XMLMessages.XMLNS_DOMAIN)) {
            spe = new SAXParseException(fgXMLMessages.createMessage(fLocale, majorCode, minorCode, args), locator);
        }
        else if (errorDomain.equals(ImplementationMessages.XERCES_IMPLEMENTATION_DOMAIN)) {
            spe = new SAXParseException(fgImplementationMessages.createMessage(fLocale, majorCode, minorCode, args), locator);
        } else if (errorDomain.equals(SchemaMessageProvider.SCHEMA_DOMAIN)) {
            spe = new SAXParseException(fgSchemaMessages.createMessage(fLocale, majorCode, minorCode, args), locator);
        } else if (errorDomain.equals(DatatypeMessageProvider.DATATYPE_DOMAIN)) {
            spe = new SAXParseException(fgDatatypeMessages.createMessage(fLocale, majorCode, minorCode, args), locator);
        } else {
            throw new RuntimeException("FWK007 Unknown error domain \"" + errorDomain + "\"."+"\n"+errorDomain);
        }

        // default error handling
        if (fErrorHandler == null) {
            if (errorType == XMLErrorReporter.ERRORTYPE_FATAL_ERROR &&
                !fContinueAfterFatalError) {
                throw spe;
            }
            return;
        }

        // make appropriate callback
        if (errorType == XMLErrorReporter.ERRORTYPE_WARNING) {
            fErrorHandler.warning(spe);
        }
        else if (errorType == XMLErrorReporter.ERRORTYPE_FATAL_ERROR) {
            fErrorHandler.fatalError(spe);
            if (!fContinueAfterFatalError) {
                Object[] fatalArgs = { spe.getMessage() };
                throw new SAXException(fgImplementationMessages.createMessage(fLocale, ImplementationMessages.FATAL_ERROR, 0, fatalArgs));
            }
        }
        else {
            fErrorHandler.error(spe);
View Full Code Here

        String msg = e.getMessage();
        if (msg == null)
            msg = e.toString();
        if (!(e instanceof SAXParseException))
            return msg;
        SAXParseException sax = (SAXParseException) e;
        String file = sax.getSystemId();
        if (file == null)
            file = sax.getPublicId();
        String rslt = file == null ? "" : file;
        if (sax.getLineNumber() == -1)
            return (file != null ? (file + ": ") : "") + msg;

        if (sax.getColumnNumber() == -1) {
            return rslt + "(line " + sax.getLineNumber() + "): " + msg;
        }
        return rslt + "(line " + sax.getLineNumber() + " column " + sax.getColumnNumber()
                + "): " + msg;

    }
View Full Code Here

            return;
        }

        // jsp:text must not have any subelements
        if (current instanceof Node.JspText) {
            throw new SAXParseException(
                Localizer.getMessage("jsp.error.text.has_subelement"),
                locator);
        }

        startMark = new Mark(ctxt, path, locator.getLineNumber(),
View Full Code Here

TOP

Related Classes of org.xml.sax.SAXParseException

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.