當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。