当前位置: 首页>>代码示例>>Java>>正文


Java LSException类代码示例

本文整理汇总了Java中org.w3c.dom.ls.LSException的典型用法代码示例。如果您正苦于以下问题:Java LSException类的具体用法?Java LSException怎么用?Java LSException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LSException类属于org.w3c.dom.ls包,在下文中一共展示了LSException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
public Document parse(InputStream in)
  throws SAXException, IOException
{
  LSInput input = ls.createLSInput();
  input.setByteStream(in);
  try
    {
      return parser.parse(input);
    }
  catch (LSException e)
    {
      Throwable e2 = e.getCause();
      if (e2 instanceof IOException)
        throw (IOException) e2;
      else
        throw e;
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:19,代码来源:DomDocumentBuilder.java

示例2: serializeDOM_LS

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
protected void serializeDOM_LS(Element elt, OutputStream out, boolean pretty) throws LSException
{
    DOMImplementationLS impl = (DOMImplementationLS)XMLImplFinder.getDOMImplementation(); 
    
    // init and configure serializer
    LSSerializer serializer = impl.createLSSerializer();
    DOMConfiguration config = serializer.getDomConfig();
    config.setParameter("format-pretty-print", pretty);
    
    // wrap output stream
    LSOutput output = impl.createLSOutput();
    output.setByteStream(out);
    
    // launch serialization
    serializer.write(elt, output);
}
 
开发者ID:sensiasoft,项目名称:lib-swe-common,代码行数:17,代码来源:XMLDocument.java

示例3: createLSException

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
public static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:DOMUtil.java

示例4: parse

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
public Document parse(LSInput input)
  throws DOMException, LSException
{
  if (async)
    {
      return doParse(input);
    }
  else
    {
      synchronized (this)
        {
          return doParse(input);
        }
    }
}
 
开发者ID:vilie,项目名称:javify,代码行数:16,代码来源:DomLSParser.java

示例5: parseURI

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
public Document parseURI(String uri)
  throws DOMException, LSException
{
  LSInput input = new DomLSInput();
  input.setSystemId(uri);
  return parse(input);
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:DomLSParser.java

示例6: writeToURI

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
public boolean writeToURI(Node node, String uri)
  throws LSException
{
  LSOutput output = new DomLSOutput();
  output.setSystemId(uri);
  return write(node, output);
}
 
开发者ID:vilie,项目名称:javify,代码行数:8,代码来源:DomLSSerializer.java

示例7: writeToString

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
public String writeToString(Node node)
  throws DOMException, LSException
{
  Writer writer = new StringWriter();
  LSOutput output = new DomLSOutput();
  output.setCharacterStream(writer);
  write(node, output);
  return writer.toString();
}
 
开发者ID:vilie,项目名称:javify,代码行数:10,代码来源:DomLSSerializer.java

示例8: createLSException

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
/**
 * Creates an LSException. On J2SE 1.4 and above the cause for the exception will be set.
 */
private static LSException createLSException(short code, Throwable cause) {
    LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
    if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
        try {
            ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
        }
        // Something went wrong. There's not much we can do about it.
        catch (Exception e) {}
    }
    return lse;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:15,代码来源:LSSerializerImpl.java

示例9: serializeTransformElement

import org.w3c.dom.ls.LSException; //导入依赖的package包/类
private static String serializeTransformElement(Element xformEl) throws DOMException, LSException {
                Document document = xformEl.getOwnerDocument();
                DOMImplementationLS domImplLS = (DOMImplementationLS) document.getImplementation();
                LSSerializer serializer = domImplLS.createLSSerializer();
//        serializer.getDomConfig().setParameter("namespaces", true);
//        serializer.getDomConfig().setParameter("namespace-declarations", true);
                serializer.getDomConfig().setParameter("canonical-form", false);
                serializer.getDomConfig().setParameter("xml-declaration", false);
                String str = serializer.writeToString(xformEl);
                return str;
        }
 
开发者ID:apache,项目名称:juddi,代码行数:12,代码来源:MappingApiToModel.java

示例10: parseURI

import org.w3c.dom.ls.LSException; //导入依赖的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

示例11: parse

import org.w3c.dom.ls.LSException; //导入依赖的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

示例12: parseURI

import org.w3c.dom.ls.LSException; //导入依赖的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


注:本文中的org.w3c.dom.ls.LSException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。