001: package org.apache.dvsl;
002:
003: /*
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021:
022: import java.util.List;
023: import java.util.Map;
024:
025: /**
026: * wrapper interface for nodes exposed in the
027: * template. Isolates the in-VSL DOM from that
028: * of the underlying implementation
029: *
030: * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
031: */
032: public interface DVSLNode {
033: /**
034: * returns the name of the node
035: */
036: public String name();
037:
038: /**
039: * returns the 'value' of the node
040: */
041: public String value();
042:
043: /**
044: * returns the value of the XPAth
045: * expression
046: */
047: public Object valueOf(String xpath);
048:
049: /**
050: * returns attribute
051: */
052: public String attrib(String attribute);
053:
054: /**
055: * returns a list of nodes that satisfy
056: * the xpath
057: */
058: public List selectNodes(String xpath);
059:
060: /**
061: * returns a single node that satisfies
062: * the xpath
063: */
064: public DVSLNode selectSingleNode(String xpath);
065:
066: public DVSLNode get(String xpath);
067:
068: /**
069: * renders a deep copy of the XML tree
070: * below the current node to the output
071: */
072: public String copy();
073:
074: /**
075: * renders a deep copy of the nodes in
076: * the list ot the output
077: */
078: public String copy(List nodeList);
079:
080: /**
081: * returns a list of all children of the current
082: * node
083: */
084: public List children();
085:
086: /**
087: * returns the 'value' of the node
088: */
089: public String toString();
090:
091: /* ====================== */
092:
093: /**
094: * returns the object corresponding to the node
095: * in the implementaion that we are using.
096: * use only with the greatest of care
097: */
098:
099: Object getNodeImpl();
100:
101: Map getAttribMap();
102: }
|