当前位置: 首页>>代码示例>>Java>>正文


Java SAXParseException类代码示例

本文整理汇总了Java中org.xml.sax.SAXParseException的典型用法代码示例。如果您正苦于以下问题:Java SAXParseException类的具体用法?Java SAXParseException怎么用?Java SAXParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SAXParseException类属于org.xml.sax包,在下文中一共展示了SAXParseException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCompletedChild

import org.xml.sax.SAXParseException; //导入依赖的package包/类
@Override
public void addCompletedChild(
  ParseContext context,
  String       namespaceURI,
  String       localName,
  Object       child) throws SAXParseException
{
  if (child instanceof String)
  {
    String s = (String) child;
    if ("component-type".equals(localName))
      _info.componentType = s;
    else if ("component-class".equals(localName))
      _info.componentClass = s;
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:17,代码来源:FacesConfigParser.java

示例2: createXMLParseException

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/** Creates an XMLParseException from a SAXParseException. */
protected static XMLParseException createXMLParseException(SAXParseException exception) {
    final String fPublicId = exception.getPublicId();
    final String fExpandedSystemId = exception.getSystemId();
    final int fLineNumber = exception.getLineNumber();
    final int fColumnNumber = exception.getColumnNumber();
    XMLLocator location = new XMLLocator() {
        public String getPublicId() { return fPublicId; }
        public String getExpandedSystemId() { return fExpandedSystemId; }
        public String getBaseSystemId() { return null; }
        public String getLiteralSystemId() { return null; }
        public int getColumnNumber() { return fColumnNumber; }
        public int getLineNumber() { return fLineNumber; }
        public int getCharacterOffset() { return -1; }
        public String getEncoding() { return null; }
        public String getXMLVersion() { return null; }
    };
    return new XMLParseException(location, exception.getMessage(),exception);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:ErrorHandlerWrapper.java

示例3: getLocationString

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Returns a string of the location.
 */
private String getLocationString(SAXParseException ex) {
  StringBuilder str = new StringBuilder();

  String systemId = ex.getSystemId();
  if (systemId != null) {
    int index = systemId.lastIndexOf('/');
    if (index != -1) {
      systemId = systemId.substring(index + 1);
    }
    str.append(systemId);
  }
  str.append(':');
  str.append(ex.getLineNumber());
  str.append(':');
  str.append(ex.getColumnNumber());

  return str.toString();

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:PatternParser.java

示例4: getFromMetadataResolver

import org.xml.sax.SAXParseException; //导入依赖的package包/类
private @Nullable Element getFromMetadataResolver(String systemId, Exception ex) {
    //try MEX
    MetaDataResolver resolver;
    ServiceDescriptor serviceDescriptor = null;
    for (MetadataResolverFactory resolverFactory : ServiceFinder.find(MetadataResolverFactory.class)) {
        resolver = resolverFactory.metadataResolver(options.entityResolver);
        try {
            serviceDescriptor = resolver.resolve(new URI(systemId));
            //we got the ServiceDescriptor, now break
            if (serviceDescriptor != null)
                break;
        } catch (URISyntaxException e) {
            throw new ParseException(e);
        }
    }

    if (serviceDescriptor != null) {
        errorReceiver.warning(new SAXParseException(WsdlMessages.TRY_WITH_MEX(ex.getMessage()), null, ex));
        return parseMetadata(systemId, serviceDescriptor);
    } else {
        errorReceiver.error(null, WsdlMessages.PARSING_UNABLE_TO_GET_METADATA(ex.getMessage(), WscompileMessages.WSIMPORT_NO_WSDL(systemId)), ex);
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:MetadataFinder.java

示例5: fatalError

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Filter a fatal error event.
 *
 * @param e The error as an exception.
 * @exception org.xml.sax.SAXException The client may throw
 *            an exception during processing.
 */
public void fatalError (SAXParseException e)
    throws SAXException
{
    if (errorHandler != null) {
        errorHandler.fatalError(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XMLFilterImpl.java

示例6: error

import org.xml.sax.SAXParseException; //导入依赖的package包/类
private void error(SAXParseException message) throws BuildException {
    noteError();
    try {
        if (eh != null) {
            eh.error(message);
        }
    } catch (SAXException e) {
        throw new BuildException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:SchemaBuilderImpl.java

示例7: error

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Forward notification of a parsing error to the application supplied
 * error handler (if any).
 *
 * @param exception The error information
 *
 * @exception SAXException if a parsing exception occurs
 */
@Override
public void error(SAXParseException exception) throws SAXException {

    log.error("Parse Error at line " + exception.getLineNumber() +
            " column " + exception.getColumnNumber() + ": " +
            exception.getMessage(), exception);
    if (errorHandler != null) {
        errorHandler.error(exception);
    }

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:20,代码来源:Digester.java

示例8: error

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Forward notification of a parsing error to the application supplied error
 * handler (if any).
 *
 * @param exception
 *            The error information
 *
 * @exception SAXException
 *                if a parsing exception occurs
 */
@Override
public void error(SAXParseException exception) throws SAXException {

	log.error("Parse Error at line " + exception.getLineNumber() + " column " + exception.getColumnNumber() + ": "
			+ exception.getMessage(), exception);
	if (errorHandler != null) {
		errorHandler.error(exception);
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:21,代码来源:Digester.java

示例9: fatalError

import org.xml.sax.SAXParseException; //导入依赖的package包/类
@Override
public void fatalError(SAXParseException e) throws SAXException {
    if (fatalErrors == null) {
        fatalErrors = new LinkedList<SAXParseException>();
    }
    fatalErrors.add(e);
    if (fatalErrors.size() > 100) {
        throw e;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:LogRecords.java

示例10: fatalError

import org.xml.sax.SAXParseException; //导入依赖的package包/类
public void fatalError(SAXParseException exception) throws SAXException
{
    try
    {
        targetHandler.error(exception);
    }
    finally
    {
        importer.error(exception);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:12,代码来源:DefaultContentHandler.java

示例11: testValidation

import org.xml.sax.SAXParseException; //导入依赖的package包/类
public void testValidation() throws Exception {
    Game game = ServerTestHelper.startServerGame(getTestMap(true));

    Colony colony = getStandardColony(6);
    Player player = game.getPlayerByNationId("model.nation.dutch");

    ServerTestHelper.newTurn();
    ServerTestHelper.newTurn();

    String serialized = null;
    try {
        Validator validator = buildValidator("schema/data/data-game.xsd");
        serialized = game.serialize();
        validator.validate(new StreamSource(new StringReader(serialized)));
    } catch (SAXParseException e) {
        int col = e.getColumnNumber();
        String errMsg = e.getMessage()
            + "\nAt line=" + e.getLineNumber()
            + ", column=" + col + ":\n";
        if (serialized != null) {
            errMsg += serialized.substring(Math.max(0, col - 100),
                                           Math.min(col + 100, serialized.length()));
        }
        fail(errMsg);
    }

    ServerTestHelper.stopServerGame();
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:29,代码来源:SerializationTest.java

示例12: warning

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Issues a SAX warning.
 *
 * @param poParseException the parse exception to warn about
 * @throws SAXException
 */
public void warning(SAXParseException poParseException)
        throws SAXException {
    this.oOut.println
            (
                    "WARNING: "
                            + getParseExceptionInfo(poParseException)
            );
}
 
开发者ID:souhaib100,项目名称:MARF-for-Android,代码行数:15,代码来源:NeuralNetwork.java

示例13: getParseExceptionInfo

import org.xml.sax.SAXParseException; //导入依赖的package包/类
/**
 * Returns a string describing parse exception details.
 *
 * @param poParseException exception to get info from
 * @return string representation of the info
 */
private String getParseExceptionInfo(SAXParseException poParseException) {
    String strSystemId = poParseException.getSystemId();

    if (strSystemId == null) {
        strSystemId = "null";
    }

    String strErrInfo =
            "URI=" + strSystemId +
                    " Line=" + poParseException.getLineNumber() +
                    ": " + poParseException.getMessage();

    return strErrInfo;
}
 
开发者ID:souhaib100,项目名称:MARF-for-Android,代码行数:21,代码来源:NeuralNetwork.java

示例14: endElement

import org.xml.sax.SAXParseException; //导入依赖的package包/类
@Override
public Object endElement(
  ParseContext context,
  String       namespaceURI,
  String       localName) throws SAXParseException
{
  return _info;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:9,代码来源:FacesConfigParser.java

示例15: toSAXParseException

import org.xml.sax.SAXParseException; //导入依赖的package包/类
public static SAXParseException toSAXParseException( XMLParseException e ) {
    if( e.getException() instanceof SAXParseException )
        return (SAXParseException)e.getException();
    return new SAXParseException( e.getMessage(),
    e.getPublicId(), e.getExpandedSystemId(),
    e.getLineNumber(), e.getColumnNumber(),
    e.getException() );
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:Util.java


注:本文中的org.xml.sax.SAXParseException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。