类org.w3c.dom.ls.LSSerializerFilter源码实例Demo

下面列出了怎么用org.w3c.dom.ls.LSSerializerFilter的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lams   文件: XMLHelper.java
/**
 * Obtain a the DOM, level 3, Load/Save serializer {@link LSSerializer} instance from the
 * given {@link DOMImplementationLS} instance.
 * 
 * <p>
 * The serializer instance will be configured with the parameters passed as the <code>serializerParams</code>
 * argument. It will also be configured with an {@link LSSerializerFilter} that shows all nodes to the filter, 
 * and accepts all nodes shown.
 * </p>
 * 
 * @param domImplLS the DOM Level 3 Load/Save implementation to use
 * @param serializerParams parameters to pass to the {@link DOMConfiguration} of the serializer
 *         instance, obtained via {@link LSSerializer#getDomConfig()}. May be null.
 *         
 * @return a new LSSerializer instance
 */
public static LSSerializer getLSSerializer(DOMImplementationLS domImplLS, Map<String, Object> serializerParams) {
    LSSerializer serializer = domImplLS.createLSSerializer();
    
    serializer.setFilter(new LSSerializerFilter() {

        public short acceptNode(Node arg0) {
            return FILTER_ACCEPT;
        }

        public int getWhatToShow() {
            return SHOW_ALL;
        }
    });
    
    
    if (serializerParams != null) {
        DOMConfiguration serializerDOMConfig = serializer.getDomConfig();
        for (String key : serializerParams.keySet()) {
            serializerDOMConfig.setParameter(key, serializerParams.get(key));
        }
    }
    
    return serializer;
}
 
源代码2 项目: Bytecoder   文件: DOM3TreeWalker.java
/**
 * Constructor.
 * @param   contentHandler serialHandler The implemention of the SerializationHandler interface
 */
DOM3TreeWalker(
    SerializationHandler serialHandler,
    DOMErrorHandler errHandler,
    LSSerializerFilter filter,
    String newLine) {
    fSerializer = serialHandler;
    //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default?
    fErrorHandler = errHandler;
    fFilter = filter;
    fLexicalHandler = null;
    fNewLine = newLine;

    fNSBinder = new NamespaceSupport();
    fLocalNSBinder = new NamespaceSupport();

    fDOMConfigProperties = fSerializer.getOutputFormat();
    fSerializer.setDocumentLocator(fLocator);
    initProperties(fDOMConfigProperties);
}
 
源代码3 项目: openjdk-jdk9   文件: DOM3TreeWalker.java
/**
 * Constructor.
 * @param   contentHandler serialHandler The implemention of the SerializationHandler interface
 */
DOM3TreeWalker(
    SerializationHandler serialHandler,
    DOMErrorHandler errHandler,
    LSSerializerFilter filter,
    String newLine) {
    fSerializer = serialHandler;
    //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default?
    fErrorHandler = errHandler;
    fFilter = filter;
    fLexicalHandler = null;
    fNewLine = newLine;

    fNSBinder = new NamespaceSupport();
    fLocalNSBinder = new NamespaceSupport();

    fDOMConfigProperties = fSerializer.getOutputFormat();
    fSerializer.setDocumentLocator(fLocator);
    initProperties(fDOMConfigProperties);
}
 
源代码4 项目: saml-client   文件: XMLHelper.java
/**
 * Obtain a the DOM, level 3, Load/Save serializer {@link LSSerializer} instance from the
 * given {@link DOMImplementationLS} instance.
 *
 * <p>
 * The serializer instance will be configured with the parameters passed as the <code>serializerParams</code>
 * argument. It will also be configured with an {@link LSSerializerFilter} that shows all nodes to the filter,
 * and accepts all nodes shown.
 * </p>
 *
 * @param domImplLS the DOM Level 3 Load/Save implementation to use
 * @param serializerParams parameters to pass to the {@link DOMConfiguration} of the serializer
 *         instance, obtained via {@link LSSerializer#getDomConfig()}. May be null.
 *
 * @return a new LSSerializer instance
 */
public static LSSerializer getLSSerializer(
    DOMImplementationLS domImplLS, Map<String, Object> serializerParams) {
  LSSerializer serializer = domImplLS.createLSSerializer();

  serializer.setFilter(
      new LSSerializerFilter() {

        @Override
        public short acceptNode(Node arg0) {
          return FILTER_ACCEPT;
        }

        @Override
        public int getWhatToShow() {
          return SHOW_ALL;
        }
      });

  if (serializerParams != null) {
    DOMConfiguration serializerDOMConfig = serializer.getDomConfig();
    for (String key : serializerParams.keySet()) {
      serializerDOMConfig.setParameter(key, serializerParams.get(key));
    }
  }

  return serializer;
}
 
源代码5 项目: j2objc   文件: DOM3TreeWalker.java
/**
 * Constructor.
 * @param   contentHandler serialHandler The implemention of the SerializationHandler interface
 */
DOM3TreeWalker(
    SerializationHandler serialHandler,
    DOMErrorHandler errHandler,
    LSSerializerFilter filter,
    String newLine) {
    fSerializer = serialHandler;
    //fErrorHandler = errHandler == null ? new DOMErrorHandlerImpl() : errHandler; // Should we be using the default?
    fErrorHandler = errHandler;
    fFilter = filter;
    fLexicalHandler = null;
    fNewLine = newLine;

    fNSBinder = new NamespaceSupport();
    fLocalNSBinder = new NamespaceSupport();
    
    fDOMConfigProperties = fSerializer.getOutputFormat();
    fSerializer.setDocumentLocator(fLocator);
    initProperties(fDOMConfigProperties);
    
    try {
        // Bug see Bugzilla  26741
        fLocator.setSystemId(
            System.getProperty("user.dir") + File.separator + "dummy.xsl");
    } catch (SecurityException se) { // user.dir not accessible from applet

    }
}
 
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码8 项目: TencentKona-8   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
源代码9 项目: TencentKona-8   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码10 项目: jdk8u60   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
源代码11 项目: jdk8u60   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码12 项目: JDKSourceCode1.8   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
源代码13 项目: JDKSourceCode1.8   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码14 项目: openjdk-jdk8u   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
源代码15 项目: openjdk-jdk8u   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter(){
    return serializer.fDOMFilter;
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: DOMSerializerImpl.java
/**
 *  When the application provides a filter, the serializer will call out
 * to the filter before serializing each Node. Attribute nodes are never
 * passed to the filter. The filter implementation can choose to remove
 * the node from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter){
    serializer.fDOMFilter = filter;
}
 
源代码18 项目: Bytecoder   文件: DOMSerializerImpl.java
/**
 * When the application provides a filter, the serializer will call out to
 * the filter before serializing each Node. Attribute nodes are never passed
 * to the filter. The filter implementation can choose to remove the node
 * from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter() {
    return serializer.fDOMFilter;
}
 
源代码19 项目: Bytecoder   文件: DOMSerializerImpl.java
/**
 * When the application provides a filter, the serializer will call out to
 * the filter before serializing each Node. Attribute nodes are never passed
 * to the filter. The filter implementation can choose to remove the node
 * from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter) {
    serializer.fDOMFilter = filter;
}
 
源代码20 项目: Bytecoder   文件: LSSerializerImpl.java
/**
 * Returns the DOMConfiguration of the LSSerializer.
 *
 * @see org.w3c.dom.ls.LSSerializer#getFilter()
 * @since DOM Level 3
 * @return A LSSerializerFilter object.
 */
public LSSerializerFilter getFilter() {
    return fSerializerFilter;
}
 
源代码21 项目: Bytecoder   文件: LSSerializerImpl.java
/**
 * Set a LSSerilizerFilter on the LSSerializer.  When set, the filter is
 * called before each node is serialized which depending on its implemention
 * determines if the node is to be serialized or not.
 *
 * @see org.w3c.dom.ls.LSSerializer#setFilter
 * @since DOM Level 3
 * @param filter A LSSerializerFilter to be applied to the stream to serialize.
 */
public void setFilter(LSSerializerFilter filter) {
    fSerializerFilter = filter;
}
 
源代码22 项目: Bytecoder   文件: DOM3SerializerImpl.java
/**
 * Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes
 * during serialization.
 *
 * This interface is a public API.
 *
 * @return The Level 3 LSSerializerFilter
 */
public LSSerializerFilter getNodeFilter() {
    return fSerializerFilter;
}
 
源代码23 项目: Bytecoder   文件: DOM3SerializerImpl.java
/**
 * Sets a LSSerializerFilter on the DOM Level 3 Serializer to filter nodes
 * during serialization.
 *
 * This interface is a public API.
 *
 * @param filter the Level 3 LSSerializerFilter
 */
public void setNodeFilter(LSSerializerFilter filter) {
    fSerializerFilter = filter;
}
 
源代码24 项目: Bytecoder   文件: DOM3Serializer.java
/**
 * Sets a LSSerializerFilter on the DOM Level 3 Serializer to filter nodes
 * during serialization.
 *
 * This interface is a public API.
 *
 * @param filter the Level 3 LSSerializerFilter
 */
public void setNodeFilter(LSSerializerFilter filter);
 
源代码25 项目: Bytecoder   文件: DOM3Serializer.java
/**
 * Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes
 * during serialization.
 *
 * This interface is a public API.
 *
 * @return The Level 3 LSSerializerFilter
 */
public LSSerializerFilter getNodeFilter();
 
源代码26 项目: openjdk-jdk9   文件: DOMSerializerImpl.java
/**
 * When the application provides a filter, the serializer will call out to
 * the filter before serializing each Node. Attribute nodes are never passed
 * to the filter. The filter implementation can choose to remove the node
 * from the stream or to terminate the serialization early.
 */
public LSSerializerFilter getFilter() {
    return serializer.fDOMFilter;
}
 
源代码27 项目: openjdk-jdk9   文件: DOMSerializerImpl.java
/**
 * When the application provides a filter, the serializer will call out to
 * the filter before serializing each Node. Attribute nodes are never passed
 * to the filter. The filter implementation can choose to remove the node
 * from the stream or to terminate the serialization early.
 */
public void setFilter(LSSerializerFilter filter) {
    serializer.fDOMFilter = filter;
}
 
源代码28 项目: openjdk-jdk9   文件: LSSerializerImpl.java
/**
 * Returns the DOMConfiguration of the LSSerializer.
 *
 * @see org.w3c.dom.ls.LSSerializer#getFilter()
 * @since DOM Level 3
 * @return A LSSerializerFilter object.
 */
public LSSerializerFilter getFilter() {
    return fSerializerFilter;
}
 
源代码29 项目: openjdk-jdk9   文件: LSSerializerImpl.java
/**
 * Set a LSSerilizerFilter on the LSSerializer.  When set, the filter is
 * called before each node is serialized which depending on its implemention
 * determines if the node is to be serialized or not.
 *
 * @see org.w3c.dom.ls.LSSerializer#setFilter
 * @since DOM Level 3
 * @param filter A LSSerializerFilter to be applied to the stream to serialize.
 */
public void setFilter(LSSerializerFilter filter) {
    fSerializerFilter = filter;
}
 
源代码30 项目: openjdk-jdk9   文件: DOM3SerializerImpl.java
/**
 * Returns a LSSerializerFilter set on the DOM Level 3 Serializer to filter nodes
 * during serialization.
 *
 * This interface is a public API.
 *
 * @return The Level 3 LSSerializerFilter
 */
public LSSerializerFilter getNodeFilter() {
    return fSerializerFilter;
}
 
 类所在包
 同包方法