本文整理汇总了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() );
}