FDO .NET API Reference | Feature Data Objects |
00001 /* 00002 * Copyright (C) 2004-2006 Autodesk, Inc. 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of version 2.1 of the GNU Lesser 00006 * General Public License as published by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 */ 00018 00019 #pragma once 00020 00021 #include "Runtime\Disposable.h" 00022 00023 class FdoXmlReader; 00024 00025 BEGIN_NAMESPACE_OSGEO_COMMON_IO 00026 public __gc class IoStream; 00027 public __gc class IoTextReader; 00028 END_NAMESPACE_OSGEO_COMMON_IO 00029 00030 BEGIN_NAMESPACE_OSGEO_COMMON 00031 public __gc class DictionaryElementCollection; 00032 END_NAMESPACE_OSGEO_COMMON 00033 00034 using namespace NAMESPACE_OSGEO_COMMON_IO; 00035 using namespace NAMESPACE_OSGEO_COMMON; 00036 00037 BEGIN_NAMESPACE_OSGEO_COMMON_XML 00038 public __gc __interface IXmlSaxHandler; 00039 public __gc class XmlSaxContext; 00040 00041 /// \ingroup (OSGeoFDOCommonXml) 00042 /// \brief 00043 /// XmlReader reads an XML document from a text or binary stream. As various 00044 /// document fragments are read, it calls the appropriate SAX Handler callback on 00045 /// the current SAX Handler. This object maintains a stack of SAX Handlers, with the 00046 /// current one being the top handler in the stack. Callers provide this object with 00047 /// SAX Handlers to customize the processing of the XML document. 00048 /// SAXHandler callbacks also provide a means to push other handlers onto the stack. 00049 /// For example, a SAX Handler for a particular XML element might push another handler 00050 /// to read a particular sub-element. 00051 public __gc class XmlReader : public NAMESPACE_OSGEO_RUNTIME::Disposable 00052 { 00053 public: 00054 /// \brief 00055 /// Constructs an XML reader on a file 00056 /// 00057 /// \param fileName 00058 /// Input name of the file to read. 00059 /// 00060 /// \return 00061 /// Returns XmlReader 00062 /// 00063 XmlReader( System::String* fileName ); 00064 00065 /// \brief 00066 /// Constructs an XML reader on a stream 00067 /// 00068 /// \param stream 00069 /// Input the stream to read. 00070 /// 00071 /// \return 00072 /// Returns XmlReader 00073 /// 00074 XmlReader(NAMESPACE_OSGEO_COMMON_IO::IoStream* stream); 00075 00076 /// \brief 00077 /// Constructs an XML reader on a text reader 00078 /// 00079 /// \param reader 00080 /// Input the text reader. 00081 /// 00082 /// \return 00083 /// Returns XmlReader 00084 /// 00085 XmlReader( NAMESPACE_OSGEO_COMMON_IO::IoTextReader* reader ); 00086 00087 /// \brief 00088 /// Gets the underlying text reader. If a text reader was passed to this object 00089 /// then this text reader is returned. 00090 /// Otherwise, an auto-generated text reader is returned (a text reader 00091 /// wrapped around the file name or stream that was passed to this object) 00092 /// 00093 /// \return 00094 /// Returns the underlying text reader 00095 /// 00096 __property NAMESPACE_OSGEO_COMMON_IO::IoTextReader* get_TextReader(); 00097 00098 /// \brief 00099 /// Gets the underlying stream. If a text reader was passed to this object 00100 /// then the stream for this text reader is returned. 00101 /// If a stream was passed to this object then this stream is returned. 00102 /// If a file name as passed then a auto-generated stream (wrapped around 00103 /// the file) is returned. 00104 /// 00105 /// \return 00106 /// Returns the underlying stream 00107 /// 00108 __property NAMESPACE_OSGEO_COMMON_IO::IoStream* get_Stream(); 00109 00110 /// \brief 00111 /// Parses the XML document. 00112 /// 00113 /// \return 00114 /// Returns true if the end of the document has not yet been reached 00115 /// 00116 System::Boolean Parse(); 00117 00118 /// \brief 00119 /// Parses the XML document. 00120 /// 00121 /// \param saxHandler 00122 /// Input SAX Handler to receive the SaxHandler events. 00123 /// This object is pushed onto the SAX Handler stack when parse() starts and popped 00124 /// when parse() is finished. If NULL then no handler is pushed, meaning that 00125 /// the current top SAX Handler receives the events. If saxHander is NULL 00126 /// and there is on current top SAX Handler then this function does a 00127 /// parse and reports syntax errors, but does no semantic processing. 00128 /// 00129 /// \return 00130 /// Returns true if the end of the document has not yet been reached 00131 /// 00132 System::Boolean Parse(NAMESPACE_OSGEO_COMMON_XML::IXmlSaxHandler* saxHandler); 00133 00134 /// \brief 00135 /// Parses the XML document. 00136 /// 00137 /// \param saxHandler 00138 /// Input SAX Handler to receive the SaxHandler events. 00139 /// This object is pushed onto the SAX Handler stack when parse() starts and popped 00140 /// when parse() is finished. If NULL then no handler is pushed, meaning that 00141 /// the current top SAX Handler receives the events. If saxHander is NULL 00142 /// and there is on current top SAX Handler then this function does a 00143 /// parse and reports syntax errors, but does no semantic processing. 00144 /// \param saxContext 00145 /// Input Caller-specific contextual information that is 00146 /// pass to all SAX callbacks. 00147 /// 00148 /// \return 00149 /// Returns true if the end of the document has not yet been reached 00150 /// 00151 System::Boolean Parse(NAMESPACE_OSGEO_COMMON_XML::IXmlSaxHandler* saxHandler, NAMESPACE_OSGEO_COMMON_XML::XmlSaxContext* saxContext); 00152 00153 /// \brief 00154 /// Parses the XML document. 00155 /// 00156 /// \param saxHandler 00157 /// Input SAX Handler to receive the SaxHandler events. 00158 /// This object is pushed onto the SAX Handler stack when parse() starts and popped 00159 /// when parse() is finished. If NULL then no handler is pushed, meaning that 00160 /// the current top SAX Handler receives the events. If saxHander is NULL 00161 /// and there is on current top SAX Handler then this function does a 00162 /// parse and reports syntax errors, but does no semantic processing. 00163 /// \param saxContext 00164 /// Input Caller-specific contextual information that is 00165 /// pass to all SAX callbacks. 00166 /// \param incremental 00167 /// Input 00168 /// true: an incremental (progressive) parse is performed. The first call 00169 /// to XmlReader::Parse() causes the XML document to be read from the current 00170 /// position until the XmlSaxHandler::EndElement() callback returns false 00171 /// or the end of the document is reached. On subsequent calls to Parse() the 00172 /// read continues where the previous call left off. 00173 /// false: the whole document is parsed in a single call to XmlReader::Parse(). 00174 /// The XmlSaxHandler::EndElement() return value is ignored. If a previous call 00175 /// was made to XmlReader::Parse(), with incremental = true, then the rest of the 00176 /// document is parsed ( the EndElement() return value is ignored ). 00177 /// 00178 /// \return 00179 /// Returns true if the end of the document has not yet been reached 00180 /// 00181 System::Boolean Parse(NAMESPACE_OSGEO_COMMON_XML::IXmlSaxHandler* saxHandler, NAMESPACE_OSGEO_COMMON_XML::XmlSaxContext* saxContext, System::Boolean incremental); 00182 00183 /// \brief 00184 /// Utility function that is typically called for element names or 00185 /// name type attributes that were adjusted when they were written to XML. 00186 /// FDO names that correspond to XML names, but aren't valid XML names, are 00187 /// adjusted. This function undoes the name adjustment. 00188 /// 00189 /// \param name 00190 /// Input the name to decode. 00191 /// 00192 /// \return 00193 /// Returns the decoded name. 00194 /// 00195 System::String* DecodeName(System::String* name); 00196 00197 /// \brief 00198 /// Indicates whether the end of the XML document has been reached. 00199 /// 00200 /// \return 00201 /// Returns true if this reader is at the end of the document, false otherwise 00202 /// 00203 __property System::Boolean get_EOD(); 00204 00205 /// \brief 00206 /// Returns all of the XML namespace declarations that are currently 00207 /// in-scope for the current position in the XML document being read. 00208 /// 00209 /// \return 00210 /// Returns DictionaryElementCollection. The dictionary has one DictionaryElement 00211 /// entry per namespace declaration. DictionaryElement->GetName() returns 00212 /// the namespace prefix. DictionaryElement->GetValue() returns the URI. 00213 /// 00214 __property DictionaryElementCollection* get_Namespaces(); 00215 00216 /// \brief 00217 /// Gets the URI for a namespace prefix. 00218 /// 00219 /// \param prefix 00220 /// Input the namespace prefix. 00221 /// 00222 /// \return 00223 /// Returns the URI; L"" if the prefix is not in-scope at the 00224 /// current position in the XML document. 00225 /// 00226 System::String* PrefixToUri( System::String* prefix ); 00227 00228 /// \cond DOXYGEN-IGNORE 00229 protected: 00230 System::Void ReleaseUnmanagedObject(); 00231 00232 public private: 00233 XmlReader(System::IntPtr unmanaged, System::Boolean autoDelete); 00234 00235 inline FdoXmlReader* GetImpObj(); 00236 /// \endcond 00237 }; 00238 00239 END_NAMESPACE_OSGEO_COMMON_XML 00240 00241
Comments or suggestions? Send us feedback. |