001/*
002 * Node.java July 2006
003 *
004 * Copyright (C) 2006, Niall Gallagher <niallg@users.sf.net>
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
015 * implied. See the License for the specific language governing 
016 * permissions and limitations under the License.
017 */
018
019package org.simpleframework.xml.stream;
020
021/**
022 * The <code>Node</code> is used to represent a name value pair and
023 * acts as the base form of data used within the framework. Each of
024 * the attributes and elements are represented as nodes.  
025 * 
026 * @author Niall Gallagher
027 */
028public interface Node {
029
030   /**
031    * Returns the name of the node that this represents. This is
032    * an immutable property and should not change for any node.  
033    *  
034    * @return returns the name of the node that this represents
035    */
036   String getName();
037
038   /**
039    * Returns the value for the node that this represents. This 
040    * is a modifiable property for the node and can be changed.
041    * 
042    * @return the name of the value for this node instance
043    * 
044    * @throws Exception if there is a problem getting the value
045    */
046   String getValue() throws Exception;  
047   
048   /**
049    * This is used to acquire the <code>Node</code> that is the
050    * parent of this node. This will return the node that is
051    * the direct parent of this node and allows for siblings to
052    * make use of nodes with their parents if required.  
053    *   
054    * @return this returns the parent node for this node
055    */
056   Node getParent();
057}