001package com.hfg.xml.rdf;
002
003
004import com.hfg.util.collection.CollectionUtil;
005import com.hfg.xml.XMLAttribute;
006import com.hfg.xml.XMLName;
007import com.hfg.xml.XMLNamespace;
008import com.hfg.xml.XMLTag;
009import com.hfg.xml.creativecommons.CreativeCommons;
010import com.hfg.xml.creativecommons.CreativeCommons_Work;
011
012import java.util.List;
013
014//------------------------------------------------------------------------------
015/**
016 Resource Description Framework (RDF) 'RDF' tag.
017 <div>
018 See <a href='http://www.w3.org/RDF/'>http://www.w3.org/RDF/</a>
019 </div>
020 <div>
021 @author J. Alex Taylor, hairyfatguy.com
022 </div>
023 */
024//------------------------------------------------------------------------------
025// com.hfg XML/HTML Coding Library
026//
027// This library is free software; you can redistribute it and/or
028// modify it under the terms of the GNU Lesser General Public
029// License as published by the Free Software Foundation; either
030// version 2.1 of the License, or (at your option) any later version.
031//
032// This library is distributed in the hope that it will be useful,
033// but WITHOUT ANY WARRANTY; without even the implied warranty of
034// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
035// Lesser General Public License for more details.
036//
037// You should have received a copy of the GNU Lesser General Public
038// License along with this library; if not, write to the Free Software
039// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
040//
041// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
042// jataylor@hairyfatguy.com
043//------------------------------------------------------------------------------
044
045public class RDF extends XMLTag
046{
047   public static final XMLNamespace RDF_NAMESPACE = XMLNamespace.getNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
048
049   // Tag names
050   public static final XMLName RDF             = new XMLName("RDF",            RDF_NAMESPACE);
051
052   //##########################################################################
053   // CONSTRUCTORS
054   //##########################################################################
055
056   //---------------------------------------------------------------------------
057   public RDF()
058   {
059      super(RDF);
060   }
061
062   //---------------------------------------------------------------------------
063   public RDF(XMLTag inXMLTag)
064   {
065      super(RDF);
066
067      inXMLTag.verifyTagName(RDF);
068
069
070      if (CollectionUtil.hasValues(inXMLTag.getAttributes()))
071      {
072         for (XMLAttribute attr : inXMLTag.getAttributes())
073         {
074            setAttribute(attr.clone());
075         }
076      }
077
078      List subtagsAndContent = inXMLTag.getContentPlusSubtagList();
079      if (CollectionUtil.hasValues(subtagsAndContent))
080      {
081         for (Object object : subtagsAndContent)
082         {
083            if (object instanceof XMLTag)
084            {
085               XMLTag subtag = (XMLTag) object;
086               if (subtag.getTagName().equals(CreativeCommons.WORK.getLocalName()))
087               {
088                  addSubtag(new CreativeCommons_Work(subtag));
089               }
090               else
091               {
092                  addSubtag(subtag);
093               }
094            }
095            else
096            {
097               addContent((String)object);
098            }
099         }
100      }
101
102   }
103
104}