⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ixml.h

📁 电驴下载工具eMule0.47aVeryCD的源代码,可作分析测试也可用于P2P软件的开发研究.
💻 H
📖 第 1 页 / 共 5 页
字号:
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2003 Intel Corporation 
// All rights reserved. 
//
// Redistribution and use in source and binary forms, with or without 
// modification, are permitted provided that the following conditions are met: 
//
// * Redistributions of source code must retain the above copyright notice, 
// this list of conditions and the following disclaimer. 
// * Redistributions in binary form must reproduce the above copyright notice, 
// this list of conditions and the following disclaimer in the documentation 
// and/or other materials provided with the distribution. 
// * Neither name of Intel Corporation nor the names of its contributors 
// may be used to endorse or promote products derived from this software 
// without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////

#ifndef _IXML_H_
#define _IXML_H_

#include <stdio.h>
#include <string.h>
#include <malloc.h>
#include <assert.h>

#ifdef _WIN32
#define EXPORT_SPEC __declspec(dllexport)
#else
#define EXPORT_SPEC
#endif

typedef int BOOL;

#define DOMString   char *


#ifndef TRUE
#define TRUE 1
#endif

#ifndef FALSE
#define FALSE 0
#endif

#ifndef IN
#define IN
#endif

#ifndef OUT
#define OUT
#endif

#ifndef INOUT
#define INOUT
#endif

/**@name DOM Interfaces 
 * The Document Object Model consists of a set of objects and interfaces
 * for accessing and manipulating documents.  IXML does not implement all
 * the interfaces documented in the DOM2-Core recommendation but defines
 * a subset of the most useful interfaces.  A description of the supported
 * interfaces and methods is presented in this section.
 *
 * For a complete discussion on the object model, the object hierarchy,
 * etc., refer to section 1.1 of the DOM2-Core recommendation.
 */

//@{

/*================================================================
*
*   DOM node type 
*
*
*=================================================================*/
typedef enum
{
    eINVALID_NODE                   = 0,
    eELEMENT_NODE                   = 1,
    eATTRIBUTE_NODE                 = 2,
    eTEXT_NODE                      = 3,
    eCDATA_SECTION_NODE             = 4,
    eENTITY_REFERENCE_NODE          = 5,
    eENTITY_NODE                    = 6,                
    ePROCESSING_INSTRUCTION_NODE    = 7,
    eCOMMENT_NODE                   = 8,
    eDOCUMENT_NODE                  = 9,
    eDOCUMENT_TYPE_NODE             = 10,
    eDOCUMENT_FRAGMENT_NODE         = 11,
    eNOTATION_NODE                  = 12,

}   IXML_NODE_TYPE;

/*================================================================
*
*   error code 
*
*
*=================================================================*/
typedef enum 
{   // see DOM spec
    IXML_INDEX_SIZE_ERR                 = 1,
    IXML_DOMSTRING_SIZE_ERR             = 2,
    IXML_HIERARCHY_REQUEST_ERR          = 3,
    IXML_WRONG_DOCUMENT_ERR             = 4,
    IXML_INVALID_CHARACTER_ERR          = 5,
    IXML_NO_DATA_ALLOWED_ERR            = 6,
    IXML_NO_MODIFICATION_ALLOWED_ERR    = 7,
    IXML_NOT_FOUND_ERR                  = 8,
    IXML_NOT_SUPPORTED_ERR              = 9,
    IXML_INUSE_ATTRIBUTE_ERR            = 10,
    IXML_INVALID_STATE_ERR              = 11,
    IXML_SYNTAX_ERR                     = 12,
    IXML_INVALID_MODIFICATION_ERR       = 13,
    IXML_NAMESPACE_ERR                  = 14,
    IXML_INVALID_ACCESS_ERR             = 15,

    IXML_SUCCESS                        = 0,
    IXML_NO_SUCH_FILE                   = 101,
    IXML_INSUFFICIENT_MEMORY            = 102,
    IXML_FILE_DONE                      = 104,
    IXML_INVALID_PARAMETER              = 105,
    IXML_FAILED                         = 106,
    IXML_INVALID_ITEM_NUMBER            = 107,

} IXML_ERRORCODE;


#define DOCUMENTNODENAME    "#document"
#define TEXTNODENAME        "#text"
#define CDATANODENAME       "#cdata-section"

/*================================================================
*
*   DOM data structures
*
*
*=================================================================*/
typedef struct _IXML_Document *Docptr;

typedef struct _IXML_Node    *Nodeptr;
typedef struct _IXML_Node
{
    DOMString       nodeName;
    DOMString       nodeValue;
    IXML_NODE_TYPE  nodeType;
    DOMString       namespaceURI;
    DOMString       prefix;
    DOMString       localName;
    BOOL            readOnly;

    Nodeptr         parentNode;
    Nodeptr         firstChild;
    Nodeptr         prevSibling;
    Nodeptr         nextSibling;
    Nodeptr         firstAttr;
    Docptr          ownerDocument;

} IXML_Node;

typedef struct _IXML_Document
{
    IXML_Node    n;
} IXML_Document;

typedef struct _IXML_CDATASection
{
    IXML_Node    n;
} IXML_CDATASection;

typedef struct _IXML_Element
{
    IXML_Node   n;
    DOMString   tagName;

} IXML_Element;

typedef struct _IXML_ATTR
{
    IXML_Node   n;
    BOOL        specified;
    IXML_Element *ownerElement;
} IXML_Attr;

typedef struct _IXML_Text
{
    IXML_Node   n;
} IXML_Text;

typedef struct _IXML_NodeList
{
    IXML_Node    *nodeItem;
    struct  _IXML_NodeList *next;
} IXML_NodeList;


typedef struct _IXML_NamedNodeMap
{
    IXML_Node                 *nodeItem;
    struct _IXML_NamedNodeMap *next;
} IXML_NamedNodeMap;

#ifdef __cplusplus
extern "C" {
#endif

/*================================================================
*
*   NODE interfaces
*
*
*=================================================================*/

/**@name Interface {\it Node}
 * The {\bf Node} interface forms the primary datatype for all other DOM 
 * objects.  Every other interface is derived from this interface, inheriting 
 * its functionality.  For more information, refer to DOM2-Core page 34.
 */

//@{

  /** Returns the name of the {\bf Node}, depending on what type of 
   *  {\bf Node} it is, in a read-only string. Refer to the table in the 
   *  DOM2-Core for a description of the node names for various interfaces.
   *
   *  @return [const DOMString] A constant {\bf DOMString} of the node name.
   */

EXPORT_SPEC const DOMString
ixmlNode_getNodeName(IXML_Node *nodeptr 
		       /** Pointer to the node to retrieve the name. */
                    );

  /** Returns the value of the {\bf Node} as a string.  Note that this string 
   *  is not a copy and modifying it will modify the value of the {\bf Node}.
   *
   *  @return [DOMString] A {\bf DOMString} of the {\bf Node} value.
   */

EXPORT_SPEC DOMString               
ixmlNode_getNodeValue(IXML_Node *nodeptr  
		        /** Pointer to the {\bf Node} to retrieve the value. */
                     );

  /** Assigns a new value to a {\bf Node}.  The {\bf newNodeValue} string is
   *  duplicated and stored in the {\bf Node} so that the original does not
   *  have to persist past this call.
   *
   *  @return [int] An integer representing one of the following:
   *    \begin{itemize}
   *      \item {\tt IXML_SUCCESS}: The operation completed successfully.
   *      \item {\tt IXML_INVALID_PARAMETER}: The {\bf Node*} is not a valid 
   *            pointer.
   *      \item {\tt IXML_INSUFFICIENT_MEMORY}: Not enough free memory exists 
   *            to complete this operation.
   *    \end{itemize}
   */

EXPORT_SPEC int                     
ixmlNode_setNodeValue(IXML_Node *nodeptr, 
		        /** The {\bf Node} to which to assign a new value. */
                      char *newNodeValue  
		        /** The new value of the {\bf Node}. */
                  );

  /** Retrieves the type of a {\bf Node}.  The defined {\bf Node} constants 
   *  are:
   *  \begin{itemize}
   *    \item {\tt eATTRIBUTE_NODE} 
   *    \item {\tt eCDATA_SECTION_NODE}
   *    \item {\tt eCOMMENT_NODE}
   *    \item {\tt eDOCUMENT_FRAGMENT_NODE} 
   *    \item {\tt eDOCUMENT_NODE} 
   *    \item {\tt eDOCUMENT_TYPE_NODE} 
   *    \item {\tt eELEMENT_NODE} 
   *    \item {\tt eENTITY_NODE}
   *    \item {\tt eENTITY_REFERENCE_NODE}
   *    \item {\tt eNOTATION_NODE} 
   *    \item {\tt ePROCESSING_INSTRUCTION_NODE}
   *    \item {\tt eTEXT_NODE}
   *  \end{itemize}
   *
   *  @return [const unsigned short] An integer representing the type of the 
   *          {\bf Node}.
   */

EXPORT_SPEC const unsigned short    
ixmlNode_getNodeType(IXML_Node *nodeptr  
		       /** The {\bf Node} from which to retrieve the type. */
                    );

  /** Retrieves the parent {\bf Node} for a {\bf Node}.
   *
   *  @return [Node*] A pointer to the parent {\bf Node} or {\tt NULL} if the 
   *          {\bf Node} has no parent.
   */

EXPORT_SPEC IXML_Node*                   
ixmlNode_getParentNode(IXML_Node *nodeptr  
		         /** The {\bf Node} from which to retrieve the 
			     parent. */ 
                      );

  /** Retrieves the list of children of a {\bf Node} in a {\bf NodeList} 
   *  structure.  If a {\bf Node} has no children, {\bf ixmlNode_getChildNodes} 
   *  returns a {\bf NodeList} structure that contains no {\bf Node}s.
   *
   *  @return [NodeList*] A {\bf NodeList} of the children of the {\bf Node}.
   */

EXPORT_SPEC IXML_NodeList*               
ixmlNode_getChildNodes(IXML_Node *nodeptr  
		         /** The {\bf Node} from which to retrieve the 
			     children. */
                   );

  /** Retrieves the first child {\bf Node} of a {\bf Node}.
   *
   *  @return [Node*] A pointer to the first child {\bf Node} or {\tt NULL} 
   *                  if the {\bf Node} does not have any children.
   */

EXPORT_SPEC IXML_Node*                   
ixmlNode_getFirstChild(IXML_Node *nodeptr  
		         /** The {\bf Node} from which to retrieve the first 
			     child.  */ 
);

  /** Retrieves the last child {\bf Node} of a {\bf Node}.
   *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -