01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.xml;
18:
19: import org.apache.cocoon.xml.dom.DOMBuilder;
20: import org.w3c.dom.Node;
21:
22: /**
23: * Abstract implementation of {@link XMLFragment} for objects that are more
24: * easily represented as SAX events.
25: *
26: * <p>The {@link #toDOM} method is implemented by piping in a {@link DOMBuilder}
27: * the results of {@link #toSAX(ContentHandler)} that must be implemented by concrete
28: * subclasses.</p>
29: *
30: * @author <a href="mailto:sylvain.wallez@anyware-tech.com">Sylvain Wallez</a>
31: * @version CVS $Id: AbstractSAXFragment.java 479296 2006-11-26 06:28:51Z antonio $
32: */
33: public abstract class AbstractSAXFragment implements XMLFragment {
34:
35: /**
36: * Appends children representing the object's state to the given node
37: * by using the results of <code>toSAX()</code>.
38: */
39: public void toDOM(Node node) throws Exception {
40: toSAX(new DOMBuilder(node));
41: }
42: }
|