Package org.apache.xmlbeans

Examples of org.apache.xmlbeans.XmlError


    catch( Exception e )
    {
      if( e instanceof XmlException )
      {
        XmlException xe = ( XmlException )e;
        XmlError error = xe.getError();
        if( error != null )
          System.err.println( "Error at line " + error.getLine() + ", column " + error.getColumn() );
      }

      if( e instanceof RestConversionException )
      {
        log.error( "Project file needs to be updated manually, please reload the project." );
View Full Code Here


    {
      result.append( wsdlException.getMessage() );
    }
    else if( xmlException != null )
    {
      XmlError error = xmlException.getError();
      result.append( error.getMessage() ).append( " on line " ).append( error.getLine() ).append( ", column " )
          .append( error.getColumn() );
    }
    else if( schemaException != null )
    {
      ArrayList<?> errorList = schemaException.getErrorList();

      if( errorList != null )
      {
        StringToStringMap doubles = new StringToStringMap();
        boolean appended = false;

        for( int c = 0; c < errorList.size(); c++ )
        {
          Object error = errorList.get( c );
          if( error instanceof XmlError )
          {
            XmlError xmlError = ( XmlError )error;
            String sourceName = xmlError.getSourceName();
            String message = xmlError.getMessage();

            if( !doubles.containsKey( message ) || !doubles.get( message ).equalsIgnoreCase( sourceName ) )
            {
              if( appended )
                result.append( "<hr>" );
View Full Code Here

    if( errors.size() > 0 )
    {
      List<AssertionError> response = new ArrayList<AssertionError>();
      for( Iterator<XmlError> i = errors.iterator(); i.hasNext(); )
      {
        XmlError error = i.next();

        if( error instanceof XmlValidationError )
        {
          XmlValidationError e = ( ( XmlValidationError )error );
          QName offendingQName = e.getOffendingQName();
View Full Code Here

    }

    // transfer errors for "real" line numbers
    for( int c = 0; c < list.size(); c++ )
    {
      XmlError error = ( XmlError )list.get( c );

      if( error instanceof XmlValidationError )
      {
        XmlValidationError validationError = ( ( XmlValidationError )error );

        if( wsdlContext.getSoapVersion().shouldIgnore( validationError ) )
          continue;

        // ignore cid: related errors
        if( validationError.getErrorCode().equals( "base64Binary" )
            || validationError.getErrorCode().equals( "hexBinary" ) )
        {
          XmlCursor cursor = validationError.getCursorLocation();
          if( cursor.toParent() )
          {
            String text = cursor.getTextValue();

            // special handling for soapui/MTOM -> add option for
            // disabling?
            if( text.startsWith( "cid:" ) || text.startsWith( "file:" ) )
            {
              // ignore
              continue;
            }
          }
        }
      }

      int line = error.getLine() == -1 ? 0 : error.getLine() - 1;
      errors.add( XmlError.forLocation( error.getMessage(), error.getSourceName(), getLine( msg ) + line,
          error.getColumn(), error.getOffset() ) );
    }
  }
View Full Code Here

    }
    catch( Exception e )
    {
      if( e instanceof XmlException )
      {
        XmlError error = ( ( XmlException )e ).getError();
        if( error != null )
        {
          InvalidDefinitionException ex = new InvalidDefinitionException( ( XmlException )e );
          ex.setMessage( "Error loading [" + url + "]" );
          throw ex;
View Full Code Here

        try {
            SchemaTypeSystem schemaTypeSystem = XmlBeans.compileXsd(schemas, basicTypeSystem, xmlOptions);
            if (errors.size() > 0) {
                boolean wasError = false;
                for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
                    XmlError xmlError = (XmlError) iterator.next();
                    if(xmlError.getSeverity() == XmlError.SEVERITY_ERROR) {
                        log.error(xmlError);
                        wasError = true;
                    } else if(xmlError.getSeverity() == XmlError.SEVERITY_WARNING) {
                        log.warn(xmlError);
                    } else if(xmlError.getSeverity() == XmlError.SEVERITY_INFO) {
                        log.debug(xmlError);
                    }
                }
                if (wasError) {
                    throw new DeploymentException("Could not compile schema type system, see log for errors");
View Full Code Here

            return _expr.startsWith( s, _offset + offset );
        }

        private XPathCompileException newError ( String msg )
        {
            XmlError err =
                XmlError.forLocation(
                    msg, XmlError.SEVERITY_ERROR, null,
                    _line, _column, _offset );
                                    
            return new XPathCompileException( err );
View Full Code Here

            }
            catch ( SAXParseException e )
            {
                context.abort();

                XmlError err =
                    XmlError.forLocation(
                        e.getMessage(),
                        (String) XmlOptions.safeGet( options, XmlOptions.DOCUMENT_SOURCE_NAME ),
                        e.getLineNumber(), e.getColumnNumber(), -1 );

                throw new XmlException( err.toString(), e, err );
            }
            catch ( SAXException e )
            {
                context.abort();
               
                XmlError err = XmlError.forMessage( e.getMessage() );
               
                throw new XmlException( err.toString(), e, err );
            }
            catch ( RuntimeException e )
            {
                context.abort();
                throw e;
View Full Code Here

            // Out current parser (Piccolo) does not error when a
            // namespace is used and not defined.  Check for these here

            if (qName.indexOf( ':' ) >= 0 && namespaceURI.length() == 0)
            {
                XmlError err =
                    XmlError.forMessage(
                        "Use of undefined namespace prefix: " +
                            qName.substring( 0, qName.indexOf( ':' ) ));

                throw new XmlRuntimeException( err.toString(), null, err );
            }

            _context.begin( localName, namespaceURI );

            // BUGBUG - do more of the following to get line number for
            // as many parts of the XML as we can
            if (_wantLineNumbers)
            {
                _context.lineNumberAnnotation(
                    _startLocator.getLineNumber(),
                    _startLocator.getColumnNumber(),
                    -1 );
            }

            for ( int i = 0, len = atts.getLength() ; i < len ; i++ )
            {
                String aqn = atts.getQName( i );

                if (aqn.equals( "xmlns" ))
                {
                    _context.xmlns( "", atts.getValue( i ) );
                }
                else if (aqn.startsWith( "xmlns:" ))
                {
                    String prefix = aqn.substring( 6 );

                    if (prefix.length() == 0)
                    {
                        XmlError err =
                            XmlError.forMessage( "Prefix not specified", XmlError.SEVERITY_ERROR );

                        throw new XmlRuntimeException( err.toString(), null, err );
                    }

                    String uri = atts.getValue( i );

                    if (uri.length() == 0)
                    {
                        XmlError err =
                            XmlError.forMessage(
                                "Prefix can't be mapped to no namespace: " + prefix,
                                XmlError.SEVERITY_ERROR );

                        throw new XmlRuntimeException( err.toString(), null, err );
                    }

                    _context.xmlns( prefix, uri );
                }
                else
View Full Code Here

            throw e;
        }

        public void error ( SAXParseException e ) throws SAXException
        {
            XmlError err =
                XmlError.forMessage( "Error: " + e.getMessage(), XmlError.SEVERITY_ERROR );

            throw new XmlRuntimeException( err.toString(), null, err );
        }
View Full Code Here

TOP

Related Classes of org.apache.xmlbeans.XmlError

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.