00001 #ifndef FDO_XML_ATTRIBUTE_H 00002 #define FDO_XML_ATTRIBUTE_H 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #include <FdoCommon.h> 00023 00024 /// \brief 00025 /// FdoXmlAttribute contains the name and value of a single attribute 00026 /// from an XML document. 00027 class FdoXmlAttribute : public FdoDictionaryElement 00028 { 00029 friend class FdoCommonInternal; 00030 00031 public: 00032 /// \brief 00033 /// Constructs an XML Attribute object 00034 /// 00035 /// \param name 00036 /// Input unique attribute name. If the attribute name is namespace qualified 00037 /// the name is {uri}:{localName}. Otherwise, it is {localName} 00038 /// \param value 00039 /// Input attribute value. 00040 /// \param localName 00041 /// Input attribute name without namespace qualification. 00042 /// \param uri 00043 /// Input uri for the attribute namespace. L"" if the attribute 00044 /// name is not namespace qualified. 00045 /// \param prefix 00046 /// Input prefix for the attribute namespace. L"" if the attribute 00047 /// name is not namespace qualified. 00048 /// \param valueUri 00049 /// Input uri for the attribute value's namespace. L"" if the attribute 00050 /// value is not namespace qualified. 00051 /// \param localValue 00052 /// Input attribute value without namespace qualification. 00053 /// \param valuePrefix 00054 /// Input prefix for the attribute value's namespace. L"" if the attribute 00055 /// value is not namespace qualified. 00056 /// 00057 /// \return 00058 /// Returns FdoXmlAttribute 00059 /// 00060 FDO_API_COMMON static FdoXmlAttribute* Create( 00061 FdoString* name, 00062 FdoString* value, 00063 FdoString* localName = NULL, 00064 FdoString* uri = NULL, 00065 FdoString* prefix = NULL, 00066 FdoString* valueUri = NULL, 00067 FdoString* localValue = NULL, 00068 FdoString* valuePrefix = NULL 00069 ); 00070 00071 /// \brief 00072 /// Gets the attribute's local name. 00073 /// 00074 /// \return 00075 /// Returns FdoStringP. Same value is GetName() when attribute name not 00076 /// qualified by namespace 00077 /// 00078 FdoStringP GetLocalName() 00079 { 00080 return mLocalName; 00081 } 00082 00083 /// \brief 00084 /// Gets the attribute's namespace URI. 00085 /// 00086 /// \return 00087 /// Returns FdoStringP. L"" when attribute name not 00088 /// qualified by namespace 00089 /// 00090 FdoStringP GetUri() 00091 { 00092 return mUri; 00093 } 00094 00095 /// \brief 00096 /// Gets the attribute's namespace prefix. 00097 /// 00098 /// \return 00099 /// Returns FdoStringP. L"" when attribute name not 00100 /// qualified by namespace 00101 /// 00102 FdoStringP GetPrefix() 00103 { 00104 return mPrefix; 00105 } 00106 00107 /// \brief 00108 /// Gets the attribute value's namespace URI. 00109 /// 00110 /// \return 00111 /// Returns FdoStringP. L"" when attribute value not 00112 /// qualified by namespace 00113 /// 00114 FdoStringP GetValueUri() 00115 { 00116 return mValueUri; 00117 } 00118 00119 /// \brief 00120 /// Gets the attribute's local value. 00121 /// 00122 /// \return 00123 /// Returns FdoStringP. Same value is GetValue() when attribute value is not 00124 /// qualified by namespace 00125 /// 00126 FdoStringP GetLocalValue() 00127 { 00128 return mLocalValue; 00129 } 00130 00131 /// \brief 00132 /// Gets the attribute value's namespace prefix. 00133 /// 00134 /// \return 00135 /// Returns FdoStringP. L"" when attribute value is not 00136 /// qualified by namespace 00137 /// 00138 FdoStringP GetValuePrefix() 00139 { 00140 return mValuePrefix; 00141 } 00142 00143 /// \brief 00144 /// Gets the attribute's qualified name. 00145 /// 00146 /// \return 00147 /// Returns {prefix}:{localName} when attribute name is qualified by namespace. 00148 /// Otherwise, returns the same value as GetLocalName(). 00149 /// 00150 FdoStringP GetQName() 00151 { 00152 return mPrefix.GetLength() > 0 ? 00153 mPrefix + L":" + mLocalName : 00154 mLocalName; 00155 } 00156 00157 protected: 00158 /// \cond DOXYGEN-IGNORE 00159 FdoXmlAttribute() 00160 : FdoDictionaryElement() 00161 { 00162 } 00163 00164 FdoXmlAttribute( 00165 FdoString* name, 00166 FdoString* value, 00167 FdoString* localName, 00168 FdoString* uri, 00169 FdoString* prefix, 00170 FdoString* valueUri, 00171 FdoString* localValue, 00172 FdoString* valuePrefix 00173 ); 00174 00175 /// \endcond 00176 00177 private: 00178 FdoStringP mLocalName; 00179 FdoStringP mUri; 00180 FdoStringP mPrefix; 00181 FdoStringP mValueUri; 00182 FdoStringP mLocalValue; 00183 FdoStringP mValuePrefix; 00184 }; 00185 00186 /// \ingroup (typedefs) 00187 /// \brief 00188 /// FdoXmlAttributeP is a FdoPtr on FdoXmlAttribute, provided for convenience. 00189 typedef FdoPtr<FdoXmlAttribute> FdoXmlAttributeP; 00190 00191 #endif 00192 00193