001package com.hfg.xml; 002 003 004 005import java.util.Collection; 006import java.util.List; 007import java.util.Map; 008import java.io.Writer; 009import java.util.Set; 010 011import com.hfg.util.Case; 012 013//------------------------------------------------------------------------------ 014/** 015 Interface for an XML node. See XMLTag for an implementation. 016 017 @author J. Alex Taylor, hairyfatguy.com 018 */ 019//------------------------------------------------------------------------------ 020// com.hfg XML/HTML Coding Library 021// 022// This library is free software; you can redistribute it and/or 023// modify it under the terms of the GNU Lesser General Public 024// License as published by the Free Software Foundation; either 025// version 2.1 of the License, or (at your option) any later version. 026// 027// This library is distributed in the hope that it will be useful, 028// but WITHOUT ANY WARRANTY; without even the implied warranty of 029// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 030// Lesser General Public License for more details. 031// 032// You should have received a copy of the GNU Lesser General Public 033// License along with this library; if not, write to the Free Software 034// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 035// 036// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 037// jataylor@hairyfatguy.com 038//------------------------------------------------------------------------------ 039 040public interface XMLNode extends XMLContainer 041{ 042 //-------------------------------------------------------------------------- 043 public boolean isEmptyTag(); 044 045 046 //--------------------------------------------------------------------------- 047 public XMLTag setTagName(XMLName inName); 048 049 //--------------------------------------------------------------------------- 050 public XMLNode setTagName(String inName); 051 052 //--------------------------------------------------------------------------- 053 public String getTagName(); 054 055 //--------------------------------------------------------------------------- 056 public void verifyTagName(String inTagName); 057 058 //--------------------------------------------------------------------------- 059 public void verifyTagName(String inTagName, Case inCaseSensitivity); 060 061 //--------------------------------------------------------------------------- 062 public void verifyTagName(XMLName inTagName); 063 064 //--------------------------------------------------------------------------- 065 public void verifyTagName(XMLName inTagName, Case inCaseSensitivity); 066 067 068 //--------------------------------------------------------------------------- 069 public XMLNamespace getNamespace(); 070 071 //--------------------------------------------------------------------------- 072 public XMLNode setNamespace(XMLNamespace inValue); 073 074 //--------------------------------------------------------------------------- 075 public XMLNode setAttribute(String inAttributeName, Object inValue); 076 077 //--------------------------------------------------------------------------- 078 public XMLNode setAttribute(XMLName inAttributeName, Object inValue); 079 080 //--------------------------------------------------------------------------- 081 public XMLNode setAttribute(XMLAttribute inAttribute); 082 083 //--------------------------------------------------------------------------- 084 /** 085 Takes a Collection of XMLAttribute objects as input. 086 @param inAttributes the attributes to add to the xml node 087 */ 088 public void setAttributes(Collection<XMLAttribute> inAttributes); 089 090 //--------------------------------------------------------------------------- 091 public XMLAttribute getAttribute(String inAttributeName); 092 093 //--------------------------------------------------------------------------- 094 public XMLAttribute getAttribute(XMLName inAttributeName); 095 096 //--------------------------------------------------------------------------- 097 public String getAttributeValue(String inAttributeName); 098 099 //--------------------------------------------------------------------------- 100 public String getAttributeValue(XMLName inAttributeName); 101 102 //--------------------------------------------------------------------------- 103 /** 104 Returns a Set of XMLAttribute objects. 105 @return the attribute objects from this XML node 106 */ 107 public Collection<XMLAttribute> getAttributes(); 108 109 //--------------------------------------------------------------------------- 110 public boolean hasAttributes(); 111 112 //--------------------------------------------------------------------------- 113 public boolean hasAttribute(String inAttributeName); 114 115 //--------------------------------------------------------------------------- 116 public boolean hasAttribute(XMLName inAttributeName); 117 118 //--------------------------------------------------------------------------- 119 public XMLAttribute removeAttribute(String inAttributeName); 120 121 //--------------------------------------------------------------------------- 122 public XMLAttribute removeAttribute(XMLName inAttributeName); 123 124 125 //--------------------------------------------------------------------------- 126 public List<? extends XMLNode> findNodesByAttributeValue(String inAttribute, String inValue); 127 128 //--------------------------------------------------------------------------- 129 public List<? extends XMLNode> findNodesByAttributeValue(XMLName inAttribute, String inValue); 130 131 //--------------------------------------------------------------------------- 132 public void toIndentedXML(Writer inWriter, int inInitialIndentLevel, int inIndentSize, XMLNamespaceSet inDeclaredNamespaces); 133 134 //--------------------------------------------------------------------------- 135 public void replaceCharacterEntities(); 136 137}