p6xmlnode.h

Go to the documentation of this file.
00001 
00010 #ifndef P6XMLNODE_H__
00011 #define P6XMLNODE_H__ 1
00012 
00013 #include "p6err.h"
00014 #include "p6comdef.h"
00015 #include "p6datastream.h"
00016 #include "p6sax2types.h"
00017 #include "p6domxmltypes.h"
00018 #include "p6xpathtime.h"
00019 #include "p6xpathatomized.h"
00020 
00021 namespace P6R { 
00022 
00023 #ifdef  __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 // Need to know what each node in the tree is used for
00028 typedef enum {
00029   P6XML_NULL           = 0x00,      // -> no value
00030   P6XML_ROOT           = 0x01,      // -> top of the P6R document tree; the document root node is one below this node
00031   P6XML_LEAF           = 0x02,      // -> XML (or JSON) element, bottom of the tree for our skeleton, may still have P6XML_CHARS and P6XML_DYNAMICCHARS as children
00032   P6XML_NONLEAF        = 0x03,      // -> connector nodes
00033   P6XML_CHARS          = 0x04,      // -> The value of an XML (or JSON) element
00034   P6XML_DYNAMICLEAF    = 0x05,      // -> Node created dynamically (not from XML file), all children free automatically when node is freed
00035   P6XML_DYNAMICNONLEAF = 0x06,      // -> Node created dynamically, all children free automatically when node is freed
00036   P6XML_DYNAMICCHARS   = 0x07,      // -> Node created dynamically, all children free automatically when node is freed                  
00037   P6XML_ATTRIBUTE      = 0x08,      // -> an attribute node (part of an element)
00038   P6XML_PROCINSTRUCT   = 0x09,      // -> the node is an XML processing instruction, its data is stored as a P6XML_CHARS child
00039   P6XML_DYNAMICROOT    = 0x0A,      // -> top of document tree; when tree is dynamically created
00040   P6XML_MAX            = 0x0A       // ->    
00041 } P6XMLNodeType;
00042 
00048 typedef struct 
00049 {
00050     const P6R::P6WCHAR* pName;         // -> <book abc:isbn="0-7645-6910-4">XPath 2.0</book>
00051    P6R::P6UINT32       nameLength;    // -> name  is 'book', length is 4
00052    const P6R::P6WCHAR* pValue;        // -> value is 'XPath 2.0', length is 9
00053    P6R::P6UINT32       valueLength;   // ->
00054    const P6R::P6WCHAR* pURI;          // -> namespace URI defines the namespace for the
00055    P6R::P6UINT32       uriLength;     // -> 'abc' is the prefix
00056 } P6GenericAttrib;
00057 
00067 typedef P6UINT32 P6XMLNODEFLAGS;
00068 const P6XMLNODEFLAGS P6XMLNODE_NOFLAGS = 0x00000000;     
00069 const P6XMLNODEFLAGS P6XMLNODE_TRACEON = 0x00000001;     
00070 
00077 typedef P6UINT32 P6DOMCHARSET;
00078 const P6DOMCHARSET P6DOMCHARSET_UTF8 = 0x00000001;     
00079 
00080 
00081 
00090 interface p6IXMLNode : public p6ICom
00091 {
00110    P6COMMETHOD initialize( P6XMLNODEFLAGS flags, P6XMLNodeType type, P6BOOL bDynamic, P6UINT32 nodeId ) = 0;
00111 
00123    P6COMMETHOD setType( P6XMLNodeType type ) = 0;
00124 
00136    P6COMMETHOD getType( P6XMLNodeType* pType ) = 0;
00137 
00151    P6COMMETHOD getNodeId( P6UINT32* pId ) = 0;
00152 
00165    P6COMMETHOD getParent( p6IXMLNode** pParent ) = 0;
00166 
00186    P6COMMETHOD isChild( const P6WCHAR* pName,
00187                    P6UINT32       nameLength,
00188                    P6UINT32       instance,
00189                    p6IXMLNode**   pExist, 
00190                    P6BOOL*        pResult 
00191                    ) = 0;
00192 
00212    P6COMMETHOD isName( const P6WCHAR* pName, 
00213                         P6UINT32       nameLength,
00214                         const P6WCHAR* pURI,
00215                         P6UINT32       uriLength, 
00216                         P6BOOL*        pResult 
00217                       ) = 0;
00218 
00237     P6COMMETHOD toString( P6WCHAR* pBuffer, P6UINT32* pLength ) = 0; 
00238 
00251    P6COMMETHOD toInteger( P6INT32* pNumber ) = 0; 
00252 
00265    P6COMMETHOD toDouble( P6FLOAT* pNumber ) = 0; 
00266 
00282    P6COMMETHOD setName( const P6WCHAR* pName, P6UINT32 length ) = 0;
00283 
00296    P6COMMETHOD getName( const P6WCHAR** pName, P6UINT32* pLength ) = 0;
00297 
00310    P6COMMETHOD getLocalName( const P6WCHAR** pName, P6UINT32* pLength ) = 0;
00311 
00326    P6COMMETHOD getUniqueName( const P6WCHAR** pName, P6UINT32* pLength ) = 0;
00327 
00340    P6COMMETHOD setURI( const P6WCHAR* pURI, P6UINT32 length ) = 0;
00341 
00354    P6COMMETHOD getURI( const P6WCHAR** pURI, P6UINT32* pLength ) = 0;
00355 
00371    P6COMMETHOD setValue( const P6WCHAR* pValue, P6UINT32 length ) = 0;
00372 
00387    P6COMMETHOD getValue( const P6WCHAR** pValue, P6UINT32* pLength ) = 0;
00388 
00403    P6COMMETHOD setXpathValue( P6XPATH_ATOMIZED* pValue ) = 0;
00404 
00420    P6COMMETHOD getXpathValue( P6XPATH_ATOMIZED* pValue ) = 0;
00421 
00441    P6COMMETHOD getNextNamespace( P6UINT32*       pIndex, 
00442                           const P6WCHAR** pName, 
00443                           P6UINT32*       pNameLength, 
00444                           const P6WCHAR** pValue, 
00445                           P6UINT32*       pValueLength 
00446                         ) = 0;
00447 
00459    P6COMMETHOD getNumChildren( P6UINT32* pCount ) = 0;
00460 
00473    P6COMMETHOD addChild( p6IXMLNode* pNode ) = 0;
00474 
00488    P6COMMETHOD removeChildAt( P6UINT32 index ) = 0;
00489 
00499    P6COMMETHOD resetChild() = 0;
00500 
00514    P6COMMETHOD nextChild( p6IXMLNode** pChild ) = 0;
00515 
00531    P6COMMETHOD childAt( P6UINT32 index, p6IXMLNode** pChild ) = 0;
00532 
00544    P6COMMETHOD getNumAttributes( P6UINT32* pCount ) = 0;
00545 
00564    P6COMMETHOD addAttribute( const P6WCHAR* pName, 
00565                        P6UINT32       nameLength, 
00566                        const P6WCHAR* pValue, 
00567                        P6UINT32       valueLength, 
00568                        const P6WCHAR* pURI, 
00569                        P6UINT32       uriLength 
00570                      ) = 0;
00571 
00595    P6COMMETHOD getAttribute( const P6WCHAR*  pName, 
00596                        P6UINT32        nameLength, 
00597                        P6UINT32        instance,
00598                        const P6WCHAR** pValue, 
00599                        P6UINT32*       pValueLength, 
00600                        const P6WCHAR** pURI, 
00601                        P6UINT32*       pUriLength 
00602                      ) = 0;
00603 
00613    P6COMMETHOD resetAttribute() = 0;
00614 
00628    P6COMMETHOD nextAttribute( P6GenericAttrib* pAttrib ) = 0;
00629 
00645    P6COMMETHOD attributeAt( P6UINT32 index, P6GenericAttrib* pAttrib ) = 0;
00646 
00656    P6COMMETHOD removeWhiteSpace() = 0;
00657 
00666    P6COMMETHOD print() = 0;
00667 
00683    P6COMMETHOD outputSubTree( p6IDataStream* pOutput, 
00684                         P6DOMCHARSET   charSet,
00685                         P6BOOL         disableEscaping, 
00686                         P6BOOL         omitXMLDecl 
00687                       ) = 0;
00688 
00705    P6COMMETHOD outputSubTreeInJSON( p6IDataStream* pOutput, 
00706                             P6DOMCHARSET   charSet
00707                            ) = 0;
00708 
00724     P6COMMETHOD outputAsString( p6IDataStream* pStream, P6DOMCHARSET charSet ) = 0; 
00725 
00739    P6COMMETHOD getNumberSortKey( P6INT32* pNumber ) = 0;
00740 
00753    P6COMMETHOD setNumberSortKey( P6INT32 number ) = 0;
00754 
00768    P6COMMETHOD getFloatSortKey( P6FLOAT* pNumber ) = 0;
00769 
00782    P6COMMETHOD setFloatSortKey( P6FLOAT number ) = 0;
00783 
00797    P6COMMETHOD getLongSortKey( P6INT64* pNumber ) = 0;
00798 
00811    P6COMMETHOD setLongSortKey( P6INT64 number ) = 0;
00812 
00827    P6COMMETHOD getStringSortKey( const P6WCHAR** pString, P6UINT32* pLength ) = 0;
00828 
00843    P6COMMETHOD setStringSortKey( const P6WCHAR* pString, P6UINT32 length ) = 0;
00844 
00858    P6COMMETHOD getTimeSortKey( p6IXpathTime** pTime ) = 0;
00859 
00872    P6COMMETHOD setTimeSortKey( p6IXpathTime* pTime ) = 0;
00873 };
00874 
00875 // {C5F407A0-AEB6-4b9f-8151-FB5026A16F40}
00876 #define IF_p6IXMLNode  {0xc5f407a0,0xaeb6,0x4b9f,{0x81,0x51,0xfb,0x50,0x26,0xa1,0x6f,0x40}}
00877 
00878 // {6BD6FBC3-66F9-4e65-9603-07007FE46EF7}
00879 #define COMP_p6XMLNode {0x6bd6fbc3,0x66f9,0x4e65,{0x96,0x3,0x7,0x0,0x7f,0xe4,0x6e,0xf7}}
00880 
00881 #ifdef  __cplusplus
00882 }
00883 #endif
00884 
00885 } // namespace
00886 
00887 
00888 #endif
00889 
00890 
00891 
00892 
00893 
00894 
00895 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Copyright © 2004 - 2010 P6R Inc. - All Rights Reserved.