262 #ifndef __INCLUDE_IXML_NODE__
263 #define __INCLUDE_IXML_NODE__
267 #if defined(UNICODE) || defined(_UNICODE)
276 #if defined(WIN32) || defined(UNDER_CE) || defined(_WIN32) || defined(WIN64) || defined(__BORLANDC__)
284 #ifdef _USE_XMLPARSER_DLL
286 #define XMLDLLENTRY __declspec(dllexport)
288 #define XMLDLLENTRY __declspec(dllimport)
297 #ifdef XML_NO_WIDE_CHAR
306 #ifndef XML_NO_WIDE_CHAR
316 #define _CXML(c) L ## c
398 virtual int read(
unsigned char *buffer,
int nbyte)=0;
421 int read(
unsigned char *buffer,
int nbyte);
430 int read(
unsigned char *buffer,
int nbyte);
457 char setBufferSize(
int _szByteBuffer);
462 virtual void reset();
465 virtual void clear()=0;
470 IXMLToken_StartDocument=0,
471 IXMLToken_StartTag=1,
475 IXMLToken_ProcessingInstruction=5,
476 IXMLToken_EndDocument=6,
480 virtual IXMLToken nextToken()=0;
481 IXMLToken currentToken()
const;
487 bool isEmptyNode()
const;
503 bool isArrayStart()
const;
507 int nAttribute()
const;
509 IXMLCStr getAttributeName(
int i=0)
const;
510 IXMLCStr getAttributeValue(
int i=0)
const;
511 int szAttributeValue(
int i=0)
const;
515 bool isTextWhiteSpace()
const;
520 long long getLineNumber()
const;
521 virtual int getColumnNumber()
const;
522 int getDepth()
const;
525 void setAutoDetectSourceEncoding(
bool autoDetectSource=
false);
526 bool getAutoDetectSourceEncoding();
542 char_encoding_error=0,
543 char_encoding_UTF16=1,
544 char_encoding_UTF8=2,
545 char_encoding_System=3,
546 char_encoding_legacy=4,
547 char_encoding_ShiftJIS=5,
548 char_encoding_GB2312=6,
549 char_encoding_Big5=7,
554 virtual char setSourceCharEncoding(IXMLCharEncoding e=char_encoding_UTF16);
561 virtual char setCharEncoding(IXMLCharEncoding sourceEncoding=char_encoding_UTF8, IXMLCharEncoding destinationEncoding=char_encoding_UTF8);
562 virtual IXMLCharEncoding getCharEncodingDestination();
589 bool skipBranch(
int skipVar);
595 void setNormalBufferSize(
int nbyte);
598 int read(
unsigned char *buffer,
int nbyte);
609 void setNormalBufferSize(
int nbyte);
612 int read(
unsigned char *buffer,
int nbyte);
622 int read(
unsigned char *buffer,
int nbyte);
623 unsigned char b[512],*
pos,*bEnd;
674 static IXMLCStr guessXMLCharEncoding(
unsigned char *b,
int l,
IXMLChar out[200]);
680 int nextChar,nextDepth;
682 char parseNameAndAttributes(
IXMLStr *_ptr,
int *c);
683 inline char parseEndTag(
IXMLStr *_ptr);
684 char processText(
IXMLChar delim,
IXMLStr *_ptr,
int *nextChar,
int *len);
704 void setTagNameForArrays(
IXMLCStr arrayName);
707 static IXMLCStr guessJSONCharEncoding(
unsigned char *b,
int l);
713 int nextChar,tagBufferSize;
714 char parseStartList(
IXMLStr *ptr);
715 char parseString(
IXMLStr *ptr);
716 char parseNumber(
IXMLStr *ptr,
int *nextChar);
717 void addToTagList(
IXMLStr p,
int l);
736 void setDomMemoryBlockSize(
int blockSize=1024*1024);
746 int getDomMemoryBlockSize();
748 void setDomMaxMemorySize(
size_t maxMem=0);
753 int getDomMaxMemorySize();
755 void setDefaultPullParserWorkspaceMemorySize(
int memSize=1024*1024);
761 int getDefaultPullParserWorkspaceMemorySize();
763 void setSkipIgnorableSpaces(
bool skipIgnorableSpaces=
true);
773 bool getSkipIgnorableSpaces();
775 void setTrimTexts(
bool trimTexts=
true);
784 void setTrimAttributes(
bool trimAttributes=
true);
791 bool getTrimAttributes();
793 void setRemoveClears(
bool removeClears=
true);
799 bool getRemoveClears();
801 void setRemoveProcessingInstructions(
bool removeProcessingInstructions=
true);
807 bool getRemoveProcessingInstructions();
809 bool getAutoDetectSourceEncoding();
886 void setAutoDetectSourceEncoding(
bool autoDetectSource=
true);
897 void setAutoDetectSourceEncoding(
bool autoDetectSource=
false);
916 int memBufferSz,pullParserMemSz;
917 bool autoDetectSource,skipIgnorableSpaces,requiresTrimText,trimAttribute,
918 removeClears,removeProcessingInstructions;
922 char genericParseRecur(
int iChild,
int iText,
int iOrder,
int iClear,
void *td,
bool getOneChild);
930 int *vOrder;
int nOrder;
984 int nChildNode(
IXMLCStr name)
const;
985 int nChildNode()
const;
987 IXMLCStr getAttributeName(
int i=0)
const;
988 IXMLCStr getAttributeValue(
int i=0)
const;
989 char isAttributeSet(
IXMLCStr name)
const;
992 int nAttribute()
const;
995 int nElement()
const;
996 char isEmpty()
const;
997 char isProcessInstruction()
const;
1013 typedef struct IXMLNodeData
1020 char isProcessInstruction;
1021 struct IXMLNodeData *pParent;
1032 inline void init(
struct IXMLNodeData *pParent,
char isDeclaration);
1036 typedef enum IXMLElementType
1043 int deepCopyConstantR1()
const;
1044 ICXMLNode deepCopyConstantR2(
int *nref,
unsigned char **_p)
const;
1090 inline void emptyTheNode();
1182 void deleteNodeContent();
1184 void deleteAttribute(
int i=0);
1185 void deleteAttribute(
IXMLCStr pName);
1187 void deleteText(
int i=0);
1189 void deleteClear(
int i=0);
1259 void *addToOrder(
int *_pos,
int nc,
void *p,
int size, IXMLElementType xtype);
1260 int indexText(
IXMLCStr pValue)
const;
1261 int indexClear(
IXMLCStr pValue)
const;
1266 void emptyTheNode(
char force);
1267 static inline IXMLElementPosition findPosition(IXMLNodeData *d,
int index, IXMLElementType xtype);
1268 static int removeOrderElement(IXMLNodeData *d, IXMLElementType t,
int index);
1269 static int detachFromParent(IXMLNodeData *d);
1293 IXMLStringLocation_unknown=0,
1294 IXMLStringLocation_inAttribute=1,
1295 IXMLStringLocation_inText=2
1296 } IXMLStringLocation;
1301 void setLocation(IXMLStringLocation loc=IXMLStringLocation_unknown);
1302 IXMLStringLocation getLocation();
1310 int lengthXMLString(
IXMLCStr source);
1312 #ifndef _XMLWIDECHAR
1317 const char *XML_ByteTable;
1324 IXMLStringLocation loc;
1325 void *curXMLEntities;
1375 #ifndef _XMLWIDECHAR
1387 int getStringR(ITCXMLNode::IXMLNodeData *pEntry,
IXMLStr lpcMarker,
int nFormat);
1445 static int encodeLength(
int inBufLen,
char formatted=0);
1452 IXMLStr encode(
unsigned char *inByteBuf,
unsigned int inByteLen,
char formatted=0);
1462 unsigned char* decode(
IXMLCStr inString,
int *outByteLen=NULL,
IXMLError *xe=NULL);
1468 static unsigned char decode(
IXMLCStr inString,
unsigned char *outByteBuf,
int inMaxByteOutBuflen,
IXMLError *xe=NULL);
1473 void alloc(
int newsize);