本文整理匯總了Java中org.xml.sax.SAXParseException.getSystemId方法的典型用法代碼示例。如果您正苦於以下問題:Java SAXParseException.getSystemId方法的具體用法?Java SAXParseException.getSystemId怎麽用?Java SAXParseException.getSystemId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xml.sax.SAXParseException
的用法示例。
在下文中一共展示了SAXParseException.getSystemId方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLocationString
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/** Returns a string of the location. */
private String getLocationString(SAXParseException ex) {
StringBuffer str = new StringBuffer();
String systemId = ex.getSystemId();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
if (index != -1) {
systemId = systemId.substring(index + 1);
}
str.append(systemId);
} else {
str.append(getResource().getDisplayName());
}
str.append(':');
str.append(ex.getLineNumber());
str.append(':');
str.append(ex.getColumnNumber());
return str.toString();
}
示例2: logValidationErrors
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
public void logValidationErrors(Validator.ResultType resultType, SAXParseException sax) {
String systemId = sax.getSystemId();
DocumentModel errorModel = null;
if (systemId != null) {
errorModel = resolveResource(systemId, model);
}
Handler h = null;
if (errorModel != null && model != errorModel) {
h = relatedHandlers.get(errorModel);
if (h == null) {
h = new Handler(errorModel);
relatedHandlers.put(errorModel, h);
}
}
if (h == null) {
h = this;
}
h.logValidationErrors(resultType, sax.getMessage(), sax.getLineNumber(), sax.getColumnNumber()-1);
}
示例3: DefaultXMLProcessorDetail
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* Create new DefaultXMLProcessorMessage based on SAXParseException.
* @param spex SAX exception to be wrapped (never <code>null</code>).
*/
public DefaultXMLProcessorDetail(SAXParseException spex) {
if (spex == null) throw new NullPointerException();
this.exception = spex;
this.columnNumber = spex.getColumnNumber();
this.lineNumber = spex.getLineNumber();
this.publicId = spex.getPublicId();
this.systemId = spex.getSystemId();
if ( Util.THIS.isLoggable() ) /* then */ {
Util.THIS.debug ("DefaultXMLProcessorDetail: SAXParseException");
Util.THIS.debug (" exception= " + exception);
Util.THIS.debug (" columnNumber= " + columnNumber);
Util.THIS.debug (" lineNumber= " + lineNumber);
Util.THIS.debug (" publicId= " + publicId);
Util.THIS.debug (" systemId= " + systemId);
}
}
示例4: 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();
}
示例5: error
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
public void error(SAXParseException e) throws SAXException {
if (errorCount >= ERROR_COUNT_LIMIT) {
// Ignore all errors after reaching the limit
return;
} else if (errorCount == 0) {
// Print a warning before the first error
System.err.println(SAXMessageFormatter.formatMessage(locale,
"errorHandlerNotSet", new Object [] {errorCount}));
}
String systemId = e.getSystemId();
if (systemId == null) {
systemId = "null";
}
String message = "Error: URI=" + systemId +
" Line=" + e.getLineNumber() +
": " + e.getMessage();
System.err.println(message);
errorCount++;
}
示例6: 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);
}
示例7: 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;
}
示例8: error
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
public void error(SAXParseException e) {
if(debug)
e.printStackTrace();
hasError = true;
if((e.getSystemId() == null && e.getPublicId() == null) && (e.getCause() instanceof UnknownHostException)) {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.toString()), e);
} else {
print(WscompileMessages.WSIMPORT_ERROR_MESSAGE(e.getMessage()), e);
}
}
示例9: getLocationString
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* Returns the human readable string representation of the
* {@link org.xml.sax.Locator} part of the specified
* {@link SAXParseException}.
*
* @return non-null valid object.
*/
protected final String getLocationString( SAXParseException e ) {
if(e.getLineNumber()!=-1 || e.getSystemId()!=null) {
int line = e.getLineNumber();
return ModelMessages.CONSOLE_ERROR_REPORTER_LINE_X_OF_Y(line==-1?"?":Integer.toString( line ),
getShortName( e.getSystemId()));
} else {
return ""; //for unkown location just return empty string
}
}
示例10: getLocationString
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* Returns the human readable string representation of the
* {@link org.xml.sax.Locator} part of the specified
* {@link SAXParseException}.
*
* @return non-null valid object.
*/
protected final String getLocationString( SAXParseException e ) {
if(e.getLineNumber()!=-1 || e.getSystemId()!=null) {
int line = e.getLineNumber();
return Messages.format( Messages.LINE_X_OF_Y,
line==-1?"?":Integer.toString( line ),
getShortName( e.getSystemId() ) );
} else {
return Messages.format( Messages.UNKNOWN_LOCATION );
}
}
示例11: getMessage
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* @param ex The exception to create a message from
* @return A summary of what went wrong.
*/
private String getMessage(SAXParseException ex)
{
if (ex.getSystemId() != null)
{
return "SystemID=" + ex.getSystemId() + " Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
}
if (ex.getPublicId() != null)
{
return "PublicID=" + ex.getPublicId() + " Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
}
return "Line=" + ex.getLineNumber() + ' ' + ex.getMessage();
}
示例12: printError
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* Prints the error message.
* @param type error type
* @param ex exception that need to be printed
*/
private void printError(String type, SAXParseException ex) {
System.err.print("[" + type + "] ");
String systemId = ex.getSystemId();
if (systemId != null) {
int index = systemId.lastIndexOf('/');
if (index != -1)
systemId = systemId.substring(index + 1);
System.err.print(systemId);
}
System.err.print(':' + ex.getLineNumber());
System.err.print(':' + ex.getColumnNumber());
System.err.println(": " + ex.getMessage());
System.err.flush();
}
示例13: getParseExceptionInfo
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
systemId = "null";
}
String info = "Catalog URI=" + systemId + " Line=" + spe.getLineNumber() + ": " + spe.getMessage();
return info;
}
示例14: tryWrappedLocator
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
private void tryWrappedLocator(Exception ex) {
if ( Util.THIS.isLoggable() ) /* then */ {
Util.THIS.debug ("DefaultXMLProcessorDetail.tryWrappedLocator: " + ex);
}
// I saw SAXException wrapped in TransformerException and vice versa
Throwable wrapped = null;
if (ex instanceof TransformerException) {
wrapped = ((TransformerException) ex).getException();
} else if (ex instanceof SAXException) {
wrapped = ((SAXException) ex).getException();
} else {
return;
}
// look if wrapped exception does not provide location info
if (wrapped instanceof SAXParseException) {
SAXParseException pex = (SAXParseException) wrapped;
if (pex.getLineNumber() == -1) {
tryWrappedLocator(pex);
} else {
this.columnNumber = pex.getColumnNumber();
this.lineNumber = pex.getLineNumber();
this.publicId = pex.getPublicId();
this.systemId = pex.getSystemId();
}
} else if (wrapped instanceof TransformerException) {
TransformerException wrappedTransformerEx =
(TransformerException) wrapped;
SourceLocator locator = wrappedTransformerEx.getLocator();
if (locator == null) {
tryWrappedLocator(wrappedTransformerEx);
} else {
if (locator.getLineNumber() == -1) {
tryWrappedLocator(wrappedTransformerEx);
} else {
this.columnNumber = locator.getColumnNumber();
this.lineNumber = locator.getLineNumber();
this.publicId = locator.getPublicId();
this.systemId = locator.getSystemId();
}
}
} else if (wrapped instanceof SAXException) {
tryWrappedLocator((SAXException)wrapped);
}
}
示例15: maakGedetailleerdMessage
import org.xml.sax.SAXParseException; //導入方法依賴的package包/類
/**
* Maakt een detail message aan voor een SaxParseException.
*
* @param exception De exception.
* @return Gedetaileerd message.
*/
private String maakGedetailleerdMessage(final SAXParseException exception) {
return "XSD: " + exception.getSystemId() + ", regel: " + exception.getLineNumber() + ". ";
}