本文整理汇总了Java中com.sun.org.apache.xerces.internal.dom.DOMErrorImpl类的典型用法代码示例。如果您正苦于以下问题:Java DOMErrorImpl类的具体用法?Java DOMErrorImpl怎么用?Java DOMErrorImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DOMErrorImpl类属于com.sun.org.apache.xerces.internal.dom包,在下文中一共展示了DOMErrorImpl类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: reportDOMFatalError
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
void reportDOMFatalError(Exception e) {
if (fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fException = e;
error.fMessage = e.getMessage();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler().handleError(error);
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:XMLSchemaLoader.java
示例2: handleBaseURI
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
/**
* Record baseURI information for the Element (by adding xml:base attribute)
* or for the ProcessingInstruction (by setting a baseURI field)
* Non deferred DOM.
*
* @param node
*/
protected final void handleBaseURI (Node node){
if (fDocumentImpl != null) {
// REVISIT: remove dependency on our implementation when
// DOM L3 becomes REC
String baseURI = null;
short nodeType = node.getNodeType ();
if (nodeType == Node.ELEMENT_NODE) {
// if an element already has xml:base attribute
// do nothing
if (fNamespaceAware) {
if (((Element)node).getAttributeNodeNS ("http://www.w3.org/XML/1998/namespace","base")!=null) {
return;
}
} else if (((Element)node).getAttributeNode ("xml:base") != null) {
return;
}
// retrive the baseURI from the entity reference
baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI ();
if (baseURI !=null && !baseURI.equals (fDocumentImpl.getDocumentURI ())) {
if (fNamespaceAware) {
((Element)node).setAttributeNS ("http://www.w3.org/XML/1998/namespace", "xml:base", baseURI);
} else {
((Element)node).setAttribute ("xml:base", baseURI);
}
}
}
else if (nodeType == Node.PROCESSING_INSTRUCTION_NODE) {
baseURI = ((EntityReferenceImpl)fCurrentNode).getBaseURI ();
if (baseURI !=null && fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl ();
error.fType = "pi-base-uri-not-preserved";
error.fRelatedData = baseURI;
error.fSeverity = DOMError.SEVERITY_WARNING;
fErrorHandler.getErrorHandler ().handleError (error);
}
}
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:AbstractDOMParser.java
示例3: parseURI
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
/**
* Parse an XML document from a location identified by an URI reference.
* If the URI contains a fragment identifier (see section 4.1 in ), the
* behavior is not defined by this specification.
*
*/
public Document parseURI (String uri) throws LSException {
//If DOMParser insstance is already busy parsing another document when this
// method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
if ( fBusy ) {
String msg = DOMMessageFormatter.formatMessage (
DOMMessageFormatter.DOM_DOMAIN,
"INVALID_STATE_ERR",null);
throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
}
XMLInputSource source = new XMLInputSource (null, uri, null);
try {
currentThread = Thread.currentThread();
fBusy = true;
parse (source);
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
//reset interrupt state
abortNow = false;
Thread.interrupted();
}
} catch (Exception e){
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
Thread.interrupted();
}
if (abortNow) {
abortNow = false;
restoreHandlers();
return null;
}
// Consume this exception if the user
// issued an interrupt or an abort.
if (e != Abort.INSTANCE) {
if (!(e instanceof XMLParseException) && fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl ();
error.fException = e;
error.fMessage = e.getMessage ();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler ().handleError (error);
}
if (DEBUG) {
e.printStackTrace ();
}
throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
}
}
Document doc = getDocument();
dropDocumentReferences();
return doc;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:59,代码来源:DOMParserImpl.java
示例4: parse
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
/**
* Parse an XML document from a resource identified by an
* <code>LSInput</code>.
*
*/
public Document parse (LSInput is) throws LSException {
// need to wrap the LSInput with an XMLInputSource
XMLInputSource xmlInputSource = dom2xmlInputSource (is);
if ( fBusy ) {
String msg = DOMMessageFormatter.formatMessage (
DOMMessageFormatter.DOM_DOMAIN,
"INVALID_STATE_ERR",null);
throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
}
try {
currentThread = Thread.currentThread();
fBusy = true;
parse (xmlInputSource);
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
//reset interrupt state
abortNow = false;
Thread.interrupted();
}
} catch (Exception e) {
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
Thread.interrupted();
}
if (abortNow) {
abortNow = false;
restoreHandlers();
return null;
}
// Consume this exception if the user
// issued an interrupt or an abort.
if (e != Abort.INSTANCE) {
if (!(e instanceof XMLParseException) && fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl ();
error.fException = e;
error.fMessage = e.getMessage ();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler().handleError (error);
}
if (DEBUG) {
e.printStackTrace ();
}
throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
}
}
Document doc = getDocument();
dropDocumentReferences();
return doc;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:57,代码来源:DOMParserImpl.java
示例5: parseURI
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
/**
* Parse an XML document from a location identified by an URI reference.
* If the URI contains a fragment identifier (see section 4.1 in ), the
* behavior is not defined by this specification.
*
*/
public Document parseURI (String uri) throws LSException {
//If DOMParser insstance is already busy parsing another document when this
// method is called, then raise INVALID_STATE_ERR according to DOM L3 LS spec
if ( fBusy ) {
String msg = DOMMessageFormatter.formatMessage (
DOMMessageFormatter.DOM_DOMAIN,
"INVALID_STATE_ERR",null);
throw new DOMException ( DOMException.INVALID_STATE_ERR,msg);
}
XMLInputSource source = new XMLInputSource (null, uri, null, false);
try {
currentThread = Thread.currentThread();
fBusy = true;
parse (source);
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
//reset interrupt state
abortNow = false;
Thread.interrupted();
}
} catch (Exception e){
fBusy = false;
if (abortNow && currentThread.isInterrupted()) {
Thread.interrupted();
}
if (abortNow) {
abortNow = false;
restoreHandlers();
return null;
}
// Consume this exception if the user
// issued an interrupt or an abort.
if (e != Abort.INSTANCE) {
if (!(e instanceof XMLParseException) && fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl ();
error.fException = e;
error.fMessage = e.getMessage ();
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler ().handleError (error);
}
if (DEBUG) {
e.printStackTrace ();
}
throw (LSException) DOMUtil.createLSException(LSException.PARSE_ERR, e).fillInStackTrace();
}
}
Document doc = getDocument();
dropDocumentReferences();
return doc;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:DOMParserImpl.java
示例6: dom2xmlInputSource
import com.sun.org.apache.xerces.internal.dom.DOMErrorImpl; //导入依赖的package包/类
/**
* NON-DOM: convert LSInput to XNIInputSource
*
* @param is
* @return
*/
XMLInputSource dom2xmlInputSource (LSInput is) {
// need to wrap the LSInput with an XMLInputSource
XMLInputSource xis = null;
// check whether there is a Reader
// according to DOM, we need to treat such reader as "UTF-16".
if (is.getCharacterStream () != null) {
xis = new XMLInputSource (is.getPublicId (), is.getSystemId (),
is.getBaseURI (), is.getCharacterStream (),
"UTF-16");
}
// check whether there is an InputStream
else if (is.getByteStream () != null) {
xis = new XMLInputSource (is.getPublicId (), is.getSystemId (),
is.getBaseURI (), is.getByteStream (),
is.getEncoding ());
}
// if there is a string data, use a StringReader
// according to DOM, we need to treat such data as "UTF-16".
else if (is.getStringData () != null && is.getStringData().length() > 0) {
xis = new XMLInputSource (is.getPublicId (), is.getSystemId (),
is.getBaseURI (), new StringReader (is.getStringData ()),
"UTF-16");
}
// otherwise, just use the public/system/base Ids
else if ((is.getSystemId() != null && is.getSystemId().length() > 0) ||
(is.getPublicId() != null && is.getPublicId().length() > 0)) {
xis = new XMLInputSource (is.getPublicId (), is.getSystemId (),
is.getBaseURI ());
}
else {
// all inputs are null
if (fErrorHandler != null) {
DOMErrorImpl error = new DOMErrorImpl();
error.fType = "no-input-specified";
error.fMessage = "no-input-specified";
error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
fErrorHandler.getErrorHandler().handleError(error);
}
throw new LSException(LSException.PARSE_ERR, "no-input-specified");
}
return xis;
}
开发者ID:campolake,项目名称:openjdk9,代码行数:49,代码来源:DOMParserImpl.java
注:本文中的com.sun.org.apache.xerces.internal.dom.DOMErrorImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论