|
|
|
|
|
|
|
*/ |
|
/* |
|
* Licensed to the Apache Software Foundation (ASF) under one |
|
* or more contributor license agreements. See the NOTICE file |
|
* distributed with this work for additional information |
|
* regarding copyright ownership. The ASF licenses this file |
|
* to you under the Apache License, Version 2.0 (the "License"); |
|
* you may not use this file except in compliance with the License. |
|
* You may obtain a copy of the License at |
|
* |
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
* |
|
* Unless required by applicable law or agreed to in writing, software |
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
* See the License for the specific language governing permissions and |
|
* limitations under the License. |
|
*/ |
|
|
|
package com.sun.org.apache.xml.internal.serializer.dom3; |
|
|
|
import java.io.IOException; |
|
|
|
import com.sun.org.apache.xml.internal.serializer.DOM3Serializer; |
|
import com.sun.org.apache.xml.internal.serializer.SerializationHandler; |
|
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; |
|
import org.w3c.dom.DOMErrorHandler; |
|
import org.w3c.dom.Node; |
|
import org.w3c.dom.ls.LSSerializerFilter; |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public final class DOM3SerializerImpl implements DOM3Serializer { |
|
|
|
/** |
|
* Private class members |
|
*/ |
|
|
|
private DOMErrorHandler fErrorHandler; |
|
|
|
|
|
private LSSerializerFilter fSerializerFilter; |
|
|
|
|
|
private String fNewLine; |
|
|
|
|
|
private SerializationHandler fSerializationHandler; |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public DOM3SerializerImpl(SerializationHandler handler) { |
|
fSerializationHandler = handler; |
|
} |
|
|
|
// Public memebers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public DOMErrorHandler getErrorHandler() { |
|
return fErrorHandler; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public LSSerializerFilter getNodeFilter() { |
|
return fSerializerFilter; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void serializeDOM3(Node node) throws IOException { |
|
try { |
|
DOM3TreeWalker walker = new DOM3TreeWalker(fSerializationHandler, |
|
fErrorHandler, fSerializerFilter, fNewLine); |
|
|
|
walker.traverse(node); |
|
} catch (org.xml.sax.SAXException se) { |
|
throw new WrappedRuntimeException(se); |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void setErrorHandler(DOMErrorHandler handler) { |
|
fErrorHandler = handler; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void setNodeFilter(LSSerializerFilter filter) { |
|
fSerializerFilter = filter; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void setSerializationHandler(SerializationHandler handler) { |
|
fSerializationHandler = handler; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void setNewLine(String newLine) { |
|
fNewLine = newLine; |
|
} |
|
} |