Examples of XMLError


Examples of org.apache.xmlbeans.XmlError

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

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

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

            _context.startElement(_locale.makeQualifiedQName(uri, qName));

            if (_wantLineNumbers)
            {
                _context.bookmark(
                    new XmlLineNumber(_startLocator.getLineNumber(),
                        _startLocator.getColumnNumber() - 1, -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 attrUri = atts.getValue(i);

                    if (attrUri.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, attrUri);
                }
View Full Code Here

Examples of org.apache.xmlbeans.XmlError

            throws SAXException
        {
            if (beginsWithXml(prefix) &&
                !("xml".equals(prefix) && _xml1998Uri.equals(uri)))
            {
                XmlError err =
                    XmlError.forMessage(
                        "Prefix can't begin with XML: " + prefix,
                        XmlError.SEVERITY_ERROR);

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

Examples of org.apache.xmlbeans.XmlError

    }

    // Error
    StringBuilder stringBuilder = new StringBuilder();
    for (int i = 0; i < errorList.size(); i++) {
      XmlError error = (XmlError) errorList.get(i);
      logger.warning("Message: " + error.getMessage());
      logger.warning("Location of invalid XML: "
          + error.getCursorLocation().xmlText());
      stringBuilder.append("Message:" + error.getMessage());
      stringBuilder.append("Location of invalid XML: "
          + error.getCursorLocation().xmlText());
    }
    throw new XBayaRuntimeException(stringBuilder.toString());
  }
View Full Code Here

Examples of org.apache.xmlbeans.XmlError

        public boolean add(Object o)
        {
            if (o instanceof XmlError)
            {
                XmlError err = (XmlError)o;
                if (err.getSeverity() == XmlError.SEVERITY_ERROR)
                    log(err.toString(_baseURI), Project.MSG_ERR);
                else if (err.getSeverity() == XmlError.SEVERITY_WARNING)
                    log(err.toString(_baseURI), Project.MSG_WARN);
                else if (_noisy)
                    log(err.toString(_baseURI), Project.MSG_INFO);
            }
            return false;
        }
View Full Code Here

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

Examples of org.apache.xmlbeans.XmlError

    {
      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

Examples of org.apache.xmlbeans.XmlError

    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

Examples of org.apache.xmlbeans.XmlError

    }

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

Examples of org.apache.xmlbeans.XmlError

    }
    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

Examples of org.apache.xmlbeans.XmlError

        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
TOP
Copyright © 2018 www.massapi.com. 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.