资源目录
压缩包内文档预览:(预览前20页/共33页)
编号:516510
类型:共享资源
大小:176.04KB
格式:RAR
上传时间:2015-11-12
上传人:QQ28****1120
认证信息
个人认证
孙**(实名认证)
辽宁
IP属地:辽宁
6
积分
- 关 键 词:
-
机械毕业设计
- 资源描述:
-
tx092XML 解析器分析研究,机械毕业设计
- 内容简介:
-
江苏大学毕业设计 XML解析器 1 Attributes.hpp #ifndef ATTRIBUTES_HPP #define ATTRIBUTES_HPP class SAX2_EXPORT Attributes public: / Constructors and Destructor /* Default constructor */ Attributes() /* Destructor */ virtual Attributes() virtual unsigned int getLength() const = 0; virtual const XMLCh* getURI(const unsigned int index) const = 0; virtual const XMLCh* getLocalName(const unsigned int index) const = 0; virtual const XMLCh* getQName(const unsigned int index) const = 0; virtual const XMLCh* getType(const unsigned int index) const = 0; virtual const XMLCh* getValue(const unsigned int index) const = 0; virtual int getIndex(const XMLCh* const uri, const XMLCh* const localPart ) const = 0 ; virtual int getIndex(const XMLCh* const qName ) const = 0 ; virtual const XMLCh* getType(const XMLCh* const uri, const XMLCh* const localPart ) const = 0 ; virtual const XMLCh* getType(const XMLCh* const qName) const = 0; virtual const XMLCh* getValue(const XMLCh* const uri, const XMLCh* const localPart ) const = 0 ; virtual const XMLCh* getValue(const XMLCh* const qName) const = 0; private : /* Constructors and operators */ /* Copy constructor */ Attributes(const Attributes&); /* Assignment operator */ Attributes& operator=(const Attributes&); ; #endif nts江苏大学毕业设计 XML解析器 2 DefaultHandler.hpp #ifndef DEFAULTHANDLER_HPP #define DEFAULTHANDLER_HPP #include ContentHandler.hpp #include ErrorHandler.hpp #include SAXParseException.hpp class Locator; class Attributes; class SAX2_EXPORT DefaultHandler : public ContentHandler, public ErrorHandler, public: virtual void characters ( const XMLCh* const chars , const unsigned int length ); virtual void endDocument(); virtual void endElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname ); virtual void ignorableWhitespace ( const XMLCh* const chars , const unsigned int length ); virtual void processingInstruction ( const XMLCh* const target , const XMLCh* const data ); virtual void resetDocument(); virtual void setDocumentLocator(const Locator* const locator); virtual void startDocument(); virtual void startElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname nts江苏大学毕业设计 XML解析器 3 , const Attributes& attrs ); virtual void startPrefixMapping ( const XMLCh* const prefix, const XMLCh* const uri ) ; virtual void endPrefixMapping ( const XMLCh* const prefix ) ; virtual void error(const SAXParseException& exception); virtual void fatalError(const SAXParseException& exception); virtual void warning(const SAXParseException& exception); virtual void resetErrors(); / HandlerBase: Inline default implementations inline void DefaultHandler:characters(const XMLCh* const ,const unsigned int) inline void DefaultHandler:endDocument() inline void DefaultHandler:endElement(const XMLCh* const , const XMLCh* const , const XMLCh* const) inline void DefaultHandler:error(const SAXParseException&) inline void DefaultHandler:fatalError(const SAXParseException& exception) throw exception; inline void DefaultHandler:ignorableWhitespace( const XMLCh* const , const unsigned int) DefaultHandler:processingInstruction( const XMLCh* const , const XMLCh* const) nts江苏大学毕业设计 XML解析器 4 inline void DefaultHandler:resetErrors() inline void DefaultHandler:resetDocument() inline void DefaultHandler:setDocumentLocator(const Locator* const) inline void DefaultHandler:startDocument() inline void DefaultHandler:startElement( const XMLCh* const , const XMLCh* const , const XMLCh* const , const Attributes& ) inline void DefaultHandler:warning(const SAXParseException&) inline void DefaultHandler:startPrefixMapping ( const XMLCh* const ,const XMLCh* const) inline void DefaultHandler:endPrefixMapping ( const XMLCh* const) #endif / ! DEFAULTHANDLER_HPP nts江苏大学毕业设计 XML解析器 5 ContentHandler.hpp #ifndef CONTENTHANDLER_HPP #define CONTENTHANDLER_HPP class Attributes; class Locator; class SAX2_EXPORT ContentHandler public: /* Default constructor */ ContentHandler() /* Destructor */ virtual ContentHandler() virtual void characters ( const XMLCh* const chars , const unsigned int length ) = 0; virtual void endDocument () = 0; virtual void endElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname ) = 0; virtual void ignorableWhitespace ( const XMLCh* const chars , const unsigned int length ) = 0; virtual void processingInstruction ( const XMLCh* const target , const XMLCh* const data ) = 0; virtual void setDocumentLocator(const Locator* const locator) = 0; virtual void startDocument() = 0; virtual void startElement ( const XMLCh* const uri, nts江苏大学毕业设计 XML解析器 6 const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs ) = 0; virtual void startPrefixMapping ( const XMLCh* const prefix, const XMLCh* const uri ) = 0 ; virtual void endPrefixMapping ( const XMLCh* const prefix ) = 0 ; private : /* Unimplemented Constructors and operators */ /* Copy constructor */ ContentHandler(const ContentHandler&); /* Assignment operator */ ContentHandler& operator=(const ContentHandler&); ; #endif nts江苏大学毕业设计 XML解析器 7 ErrorHandler.hpp #ifndef ERRORHANDLER_HPP #define ERRORHANDLER_HPP class SAXParseException; class SAX_EXPORT ErrorHandler public: /* name Constructors and Destructor */ / /* Default constructor */ ErrorHandler() /* Desctructor */ virtual ErrorHandler() / /* name The error handler interface */ / virtual void warning(const SAXParseException& exception) = 0; virtual void error(const SAXParseException& exception) = 0; virtual void fatalError(const SAXParseException& exception) = 0; /* * Reset the Error handler object on its reuse * * This method helps in reseting the Error handler object * implementational defaults each time the Error handler is begun. * */ virtual void resetErrors() = 0; / private : /* Unimplemented constructors and operators */ /* Copy constructor */ ErrorHandler(const ErrorHandler&); /* Assignment operator */ ErrorHandler& operator=(const ErrorHandler&); ; #endif nts江苏大学毕业设计 XML解析器 8 InputSource .hpp #ifndef INPUTSOURCE_HPP #define INPUTSOURCE_HPP class BinInputStream; class SAX_EXPORT InputSource : public XMemory public: / - / All constructors are hidden, just the destructor is available /* * Destructor */ virtual InputSource(); virtual BinInputStream* makeStream() const = 0; virtual const XMLCh* getEncoding() const; virtual const XMLCh* getPublicId() const; virtual const XMLCh* getSystemId() const; virtual const bool getIssueFatalErrorIfNotFound() const; MemoryManager* getMemoryManager() const; virtual void setEncoding(const XMLCh* const encodingStr); virtual void setPublicId(const XMLCh* const publicId); virtual void setSystemId(const XMLCh* const systemId); virtual void setIssueFatalErrorIfNotFound(const bool flag) protected : / Hidden constructors /* Default constructor */ InputSource(MemoryManager* const manager = XMLPlatformUtils:fgMemoryManager); /* Constructor with a system identifier as XMLCh type. * param systemId The system identifier (URI). */ InputSource(const XMLCh* const systemId, MemoryManager* const manager = XMLPlatformUtils:fgMemoryManager); /* Constructor with a system and public identifiers * param systemId The system identifier (URI). * param publicId The public identifier as in the entity definition. */ InputSource ( const XMLCh* const systemId nts江苏大学毕业设计 XML解析器 9 , const XMLCh* const publicId , MemoryManager* const manager = XMLPlatformUtils:fgMemoryManager ); /* Constructor witha system identifier as string * param systemId The system identifier (URI). */ InputSource(const char* const systemId, MemoryManager* const manager = XMLPlatformUtils:fgMemoryManager); /* Constructor witha system and public identifiers. Both as string * param systemId The system identifier (URI). * param publicId The public identifier as in the entity definition. */ InputSource ( const char* const systemId , const char* const publicId , MemoryManager* const manager = XMLPlatformUtils:fgMemoryManager ); private: / Unimplemented constructors and operators InputSource(const InputSource&); InputSource& operator=(const InputSource&); / Private data members / fEncoding / This is the encoding to use. Usually this is null, which means / to use the information found in the file itself. But, if set, / this encoding will be used without question. / fPublicId / This is the optional public id for the input source. It can / be null if none is desired. / fSystemId / This is the system id for the input source. This is what is / actually used to open the source. / fFatalErrorIfNotFound MemoryManager* fMemoryManager; XMLCh* fEncoding; XMLCh* fPublicId; XMLCh* fSystemId; bool fFatalErrorIfNotFound; ; nts江苏大学毕业设计 XML解析器 10 / InputSource: Getter methods inline const XMLCh* InputSource:getEncoding() const return fEncoding; inline const XMLCh* InputSource:getPublicId() const return fPublicId; inline const XMLCh* InputSource:getSystemId() const return fSystemId; inline const bool InputSource:getIssueFatalErrorIfNotFound() const return fFatalErrorIfNotFound; inline MemoryManager* InputSource:getMemoryManager() const return fMemoryManager; / InputSource: Setter methods inline void InputSource:setIssueFatalErrorIfNotFound(const bool flag) fFatalErrorIfNotFound = flag; #endif nts江苏大学毕业设计 XML解析器 11 SAXException.hpp #include SAXException.hpp / SAXNotSupportedException Constructors SAXNotSupportedException:SAXNotSupportedException() : SAXException() SAXNotSupportedException:SAXNotSupportedException(const XMLCh* const msg) : SAXException(msg) SAXNotSupportedException:SAXNotSupportedException(const char* const msg) : SAXException(msg) SAXNotSupportedException:SAXNotSupportedException(const SAXException& toCopy) : SAXException(toCopy) / SAXNotRecognizedException Constructors SAXNotRecognizedException:SAXNotRecognizedException() : SAXException() SAXNotRecognizedException:SAXNotRecognizedException(const XMLCh* const msg) : SAXException(msg) SAXNotRecognizedException:SAXNotRecognizedException(const char* const msg) : SAXException(msg) SAXNotRecognizedException:SAXNotRecognizedException(const SAXException& toCopy) : SAXException(toCopy) nts江苏大学毕业设计 XML解析器 12 SAXParseException.hpp #ifndef SAXPARSEEXCEPTION_HPP #define SAXPARSEEXCEPTION_HPP class Locator; /* * Encapsulate an XML parse error or warning. * * This exception will include information for locating the error * in the original XML document. Note that although the application * will receive a SAXParseException as the argument to the handlers * in the ErrorHandler interface, the application is not actually * required to throw the exception; instead, it can simply read the * information in it and take a different action. * * Since this exception is a subclass of SAXException, it * inherits the ability to wrap another exception. */ class SAX_EXPORT SAXParseException : public SAXException public: /* name Constructors and Destructor */ / /* * Create a new SAXParseException from a message and a Locator. * * This constructor is especially useful when an application is * creating its own exception from within a DocumentHandler * callback. */ SAXParseException(const XMLCh* const message, const Locator& locator); /* * Create a new SAXParseException. * * This constructor is most useful for parser writers. * * If the system identifier is a URL, the parser must resolve it * fully before creating the exception. * * param message The error or warning message. * param publicId The public identifer of the entity that generated * the error or warning. * param systemId The system identifer of the entity that generated * the error or warning. nts江苏大学毕业设计 XML解析器 13 * param lineNumber The line number of the end of the text that * caused the error or warning. * param columnNumber The column number of the end of the text that * caused the error or warning. * see Parser#setLocale */ SAXParseException ( const XMLCh* const message , const XMLCh* const publicId , const XMLCh* const systemId , const XMLSSize_t lineNumber , const XMLSSize_t columnNumber ); /* * Copy constructor * * param toCopy The object to be copied */ SAXParseException(const SAXParseException& toCopy); /* * Destructor */ SAXParseException(); / /* name Assignment operator */ / /* * Assignment operator * * param toAssign The object to be copied through assignment * */ SAXParseException& operator=(const SAXParseException& toAssign); / /* name Getter methods */ / /* * The column number of the end of the text where the exception occurred. * * The first column in a line is position 1. * nts江苏大学毕业设计 XML解析器 14 * return An integer representing the column number, or -1 * if none is available. * see Locator#getColumnNumber */ XMLSSize_t getColumnNumber() const; /* * The line number of the end of the text where the exception occurred. * return An integer representing the line number, or -1 * if none is available. * see Locator#getLineNumber */ XMLSSize_t getLineNumber() const; /* * Get the public identifier of the entity where the exception occurred. * * return A string containing the public identifier, or null * if none is available. * see Locator#getPublicId */ const XMLCh* getPublicId() const; /* * Get the system identifier of the entity where the exception occurred. * If the system identifier is a URL, it will be resolved * fully. * return A string containing the system identifier, or null * if none is available. * see Locator#getSystemId */ const XMLCh* getSystemId() const; / private: /* Data Members */ /* The column in the source text where the error occured. */ XMLSSize_t fColumnNumber; /* The line in the source text where the error occured. */ XMLSSize_t fLineNumber; /* The public id of the file where the error occured. */ XMLCh* fPublicId; /* The system id of the file where the error occured. */ XMLCh* fSystemId; ; #endif nts江苏大学毕业设计 XML解析器 15 XMLPScanToken.hpp #if !defined(XMLPSCANTOKEN_HPP) #define XMLPSCANTOKEN_HPP class XMLScanner; class XMLPARSER_EXPORT XMLPScanToken public : / - / Constructors and Destructor / - /* name Constructor */ XMLPScanToken(); XMLPScanToken(const XMLPScanToken& toCopy); /* name Destructor */ XMLPScanToken(); / - / Public operators / - XMLPScanToken& operator=(const XMLPScanToken& toCopy); protected : friend class XMLScanner; void set ( const XMLUInt32 scannerId , const XMLUInt32 sequenceId ); private : / - / Private data members / / fScannerId / This field is set to the id of the scanner, to catch problems nts江苏大学毕业设计 XML解析器 16 / where a token is gotten from one scanner and passed to another. / Each scanner is assigned an incrementing id. / / fSequenceId / In order to avoid problems such as calling scanNext() without / a call to scanFirst() and such, this value is set when scanFirst() / is called and matches this token to the current sequence id of / the scanner. / - XMLUInt32 fScannerId; XMLUInt32 fSequenceId; ; / - / XMLPScanToken: Constructors and Operators / - inline XMLPScanToken:XMLPScanToken() : fScannerId(0) , fSequenceId(0) inline XMLPScanToken:XMLPScanToken(const XMLPScanToken& toCopy) : fScannerId(toCopy.fScannerId) , fSequenceId(toCopy.fSequenceId) inline XMLPScanToken:XMLPScanToken() / - / XMLPScanToken: Public operators / -nts江苏大学毕业设计 XML解析器 17 - inline XMLPScanToken& XMLPScanToken:operator=(const XMLPScanToken& toCopy) if (this = &toCopy) return *this; fSc
- 温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

人人文库网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。