org.w3c.dom.ls.LSSerializerFilter Java Examples

The following examples show how to use org.w3c.dom.ls.LSSerializerFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DOM3TreeWalker.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: DOM3TreeWalker.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #3
Source File: XMLHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: DOM3TreeWalker.java    From j2objc with Apache License 2.0 5 votes vote down vote up
/**
 * 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

    }
}
 
Example #5
Source File: XMLHelper.java    From saml-client with MIT License 5 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: DOMSerializerImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #7
Source File: LSSerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #8
Source File: LSSerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #9
Source File: DOM3SerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #10
Source File: DOM3SerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #11
Source File: DOM3Serializer.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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);
 
Example #12
Source File: DOM3Serializer.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
 
Example #13
Source File: DOMSerializerImpl.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #14
Source File: DOMSerializerImpl.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #15
Source File: DOMSerializerImpl.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #16
Source File: DOMSerializerImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #17
Source File: DOMSerializerImpl.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #18
Source File: DOMSerializerImpl.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #19
Source File: LSSerializerImpl.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/** 
 * 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;
}
 
Example #20
Source File: LSSerializerImpl.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/** 
 * 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;
}
 
Example #21
Source File: DOM3SerializerImpl.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #22
Source File: DOM3SerializerImpl.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #23
Source File: DOM3Serializer.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
 
Example #24
Source File: DOM3Serializer.java    From j2objc with Apache License 2.0 2 votes vote down vote up
/**
 * 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();
 
Example #25
Source File: DOMSerializerImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #26
Source File: DOMSerializerImpl.java    From jdk1.8-source-analysis with Apache License 2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #27
Source File: DOMSerializerImpl.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #28
Source File: DOMSerializerImpl.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #29
Source File: DOMSerializerImpl.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}
 
Example #30
Source File: DOMSerializerImpl.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 *  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;
}