本文整理匯總了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;
}
}
示例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);
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例10: fatalError
import org.xml.sax.SAXParseException; //導入依賴的package包/類
public void fatalError(SAXParseException exception) throws SAXException
{
try
{
targetHandler.error(exception);
}
finally
{
importer.error(exception);
}
}
示例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();
}
示例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)
);
}
示例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;
}
示例14: endElement
import org.xml.sax.SAXParseException; //導入依賴的package包/類
@Override
public Object endElement(
ParseContext context,
String namespaceURI,
String localName) throws SAXParseException
{
return _info;
}
示例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() );
}