亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

XMLParser 詳解

2019-11-11 04:45:45
字體:
來源:轉載
供稿:網友
xmlParser內部通過 OSFileSource    fFile來讀取文件內容;成員變量XMLTag*         fRootTag,獲取內容后調用 fRootTag = NEW XMLTag();    Bool16 result = fRootTag->ParseTag(&theParser, fVerifier, errorBuffer, errorBufferSize);

來將xml信息填充到fRootTag中,其內部有嵌套Tag。而每一個Tag內部又能獲取到屬性。因此能夠獲取到整個xml內容。

char* theXMLFilePath = "c://PRogram Files//Darwin Streaming Server//streamingserver.xml";int main(int argc, char * argv[]) {	XMLParser  parser2(theXMLFilePath);	char erro[500] = {0};	if ( !parser2.ParseFile(erro,500))	{		return -1;	}	XMLTag *pTag = parser2.GetRootTag();	cout << pTag->GetTagName() << endl;	int nLen = pTag->GetNumEmbeddedTags();	for (int i =0;i  < nLen; i ++)	{		XMLTag *pTempTag = pTag->GetEmbeddedTag(i);		cout << pTempTag->GetTagName() << endl;	}}

/* * * @APPLE_LICENSE_HEADER_START@ *  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved. *  * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. *  * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. *  * @APPLE_LICENSE_HEADER_END@ * */#ifndef __XMLParser_h__#define __XMLParser_h__#include "StringParser.h"#include "OSQueue.h"#include "OSFileSource.h"#include "ResizeableStringFormatter.h"class DTDVerifier{public:    virtual bool IsValidSubtag(char* tagName, char* subTagName) = 0;    virtual bool IsValidAttributeName(char* tagName, char* attrName) = 0;    virtual bool IsValidAttributeValue(char* tagName, char* attrName, char* attrValue) = 0;    virtual char* GetRequiredAttribute(char* tagName, int index) = 0;    virtual bool CanHaveValue(char* tagName) = 0;};class XMLTag{public:    XMLTag();    XMLTag(char* tagName);    ~XMLTag();        bool ParseTag(StringParser* parser, DTDVerifier* verifier, char* errorBuffer = NULL, int errorBufferSize = 0);        char* GetAttributeValue(const char* attrName);    char* GetValue() { return fValue; }    char* GetTagName() { return fTag; }        UInt32 GetNumEmbeddedTags() { return fEmbeddedTags.GetLength(); }        XMLTag* GetEmbeddedTag(const UInt32 index = 0);    XMLTag* GetEmbeddedTagByName(const char* tagName, const UInt32 index = 0);    XMLTag* GetEmbeddedTagByAttr(const char* attrName, const char* attrValue, const UInt32 index = 0);    XMLTag* GetEmbeddedTagByNameAndAttr(const char* tagName, const char* attrName, const char* attrValue, const UInt32 index = 0);        void AddAttribute(char* attrName, char* attrValue);    void RemoveAttribute(char* attrName);    void AddEmbeddedTag(XMLTag* tag);    void RemoveEmbeddedTag(XMLTag* tag);        void SetTagName( char* name);    void SetValue( char* value);        void FormatData(ResizeableStringFormatter* formatter, UInt32 indent);private:    void ConsumeIfComment(StringParser* parser);    char* fTag;    char* fValue;    OSQueue fAttributes;    OSQueue fEmbeddedTags;        OSQueueElem fElem;    static UInt8 sNonNameMask[];        // stop when you hit a Word};class XMLAttribute{public:    XMLAttribute();    ~XMLAttribute();        char* fAttrName;    char* fAttrValue;        OSQueueElem fElem;};class XMLParser{public:    XMLParser( char* inPath, DTDVerifier* verifier = NULL);    ~XMLParser();        // Check for existence, man.    Bool16  DoesFileExist();    Bool16  DoesFileExistAsDirectory();    Bool16  CanWriteFile();        Bool16  ParseFile(char* errorBuffer = NULL, int errorBufferSize = 0);            XMLTag* GetRootTag() { return fRootTag; }    void SetRootTag(XMLTag* tag);        void WriteToFile(char** fileHeader);    private:    XMLTag*         fRootTag;            OSFileSource    fFile;    char*           fFilePath;    DTDVerifier*    fVerifier;};#endif
/* * * @APPLE_LICENSE_HEADER_START@ *  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved. *  * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. *  * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. *  * @APPLE_LICENSE_HEADER_END@ * */#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#ifndef __Win32__#include <unistd.h>#endif#include "XMLParser.h"#include "OSMemory.h"XMLParser::XMLParser( char* inPath, DTDVerifier* verifier)    : fRootTag(NULL), fFilePath(NULL){    StrPtrLen thePath(inPath);    fFilePath = thePath.GetAsCString();    fFile.Set(inPath);    fVerifier = verifier;}XMLParser::~XMLParser(){    if (fRootTag)        delete fRootTag;    delete [] fFilePath;}Bool16 XMLParser::ParseFile(char* errorBuffer, int errorBufferSize){    if (fRootTag != NULL)    {        delete fRootTag;    // flush old data        fRootTag = NULL;    }        fFile.Set(fFilePath);    if (errorBufferSize < 500) errorBuffer = NULL;  // Just a hack to avoid checking everywhere    if ((fFile.GetLength() == 0) || fFile.IsDir())    {        if (errorBuffer != NULL)            qtss_sprintf(errorBuffer, "Couldn't read xml file");        return false;   // we don't have a valid file;    }        char* fileData = NEW char[ (SInt32) (fFile.GetLength() + 1)];    UInt32 theLengthRead = 0;    fFile.Read(0, fileData, (UInt32) fFile.GetLength(), &theLengthRead);     StrPtrLen theDataPtr(fileData, theLengthRead);    StringParser theParser(&theDataPtr);        fRootTag = NEW XMLTag();    Bool16 result = fRootTag->ParseTag(&theParser, fVerifier, errorBuffer, errorBufferSize);    if (!result)    {        // got error parsing file        delete fRootTag;        fRootTag = NULL;    }        delete fileData;        fFile.Close();    return result;}Bool16  XMLParser::DoesFileExist(){    Bool16 itExists = false;    fFile.Set(fFilePath);    if ((fFile.GetLength() > 0) && (!fFile.IsDir()))        itExists = true;    fFile.Close();        return itExists;}Bool16  XMLParser::DoesFileExistAsDirectory(){    Bool16 itExists = false;    fFile.Set(fFilePath);    if (fFile.IsDir())        itExists = true;    fFile.Close();        return itExists;}Bool16  XMLParser::CanWriteFile(){    //    // First check if it exists for reading    FILE* theFile = ::fopen(fFilePath, "r");    if (theFile == NULL)        return true;        ::fclose(theFile);        //    // File exists for reading, check if we can write it    theFile = ::fopen(fFilePath, "a");    if (theFile == NULL)        return false;            //    // We can read and write    ::fclose(theFile);    return true;}void XMLParser::SetRootTag(XMLTag* tag){    if (fRootTag != NULL)        delete fRootTag;    fRootTag = tag;}    void XMLParser::WriteToFile(char** fileHeader){    char theBuffer[8192];    ResizeableStringFormatter formatter(theBuffer, 8192);        //    // Write the file header    for (UInt32 a = 0; fileHeader[a] != NULL; a++)    {        formatter.Put(fileHeader[a]);        formatter.Put(kEOLString);    }            if (fRootTag)                fRootTag->FormatData(&formatter, 0);    //    // New libC code. This seems to work better on Win32    formatter.PutTerminator();    FILE* theFile = ::fopen(fFilePath, "w");    if (theFile == NULL)        return;            qtss_fprintf(theFile, "%s", formatter.GetBufPtr());    ::fclose(theFile);    #if __MacOSX__    (void) ::chown(fFilePath,76,80);//owner qtss, group admin#endif#ifndef __Win32__    ::chmod(fFilePath, S_IRUSR | S_IWUSR | S_IRGRP );#endif}UInt8 XMLTag::sNonNameMask[] ={    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //0-9     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //10-19     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //20-29    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //30-39     1, 1, 1, 1, 1, 0, 0, 1, 0, 0, //40-49 '.' and '-' are name chars    0, 0, 0, 0, 0, 0, 0, 0, 0, 1, //50-59 ':' is a name char    1, 1, 1, 1, 1, 0, 0, 0, 0, 0, //60-69 //stop on every character except a letter or number    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //70-79    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //80-89    0, 1, 1, 1, 1, 0, 1, 0, 0, 0, //90-99 '_' is a name char    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //100-109    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //110-119    0, 0, 0, 1, 1, 1, 1, 1, 1, 1, //120-129    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //130-139    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //140-149    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //150-159    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //160-169    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //170-179    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //180-189    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //190-199    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //200-209    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //210-219    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //220-229    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //230-239    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //240-249    1, 1, 1, 1, 1, 1             //250-255};XMLTag::XMLTag() :    fTag(NULL),    fValue(NULL),    fElem(NULL){ fElem = this;}XMLTag::XMLTag(char* tagName) :    fTag(NULL),    fValue(NULL),    fElem(NULL){   fElem = this;    StrPtrLen temp(tagName);    fTag = temp.GetAsCString();}XMLTag::~XMLTag(){    if (fTag)        delete fTag;    if (fValue)        delete fValue;                  OSQueueElem* elem;    while ((elem = fAttributes.DeQueue()) != NULL)    {        XMLAttribute* attr = (XMLAttribute*)elem->GetEnclosingObject();        delete attr;    }           while ((elem = fEmbeddedTags.DeQueue()) != NULL)    {        XMLTag* tag = (XMLTag*)elem->GetEnclosingObject();        delete tag;    }        if (fElem.IsMemberOfAnyQueue())        fElem.InQueue()->Remove(&fElem);    // remove from parent tag}void XMLTag::ConsumeIfComment(StringParser* parser){    if ((parser->GetDataRemaining() > 2) && ((*parser)[1] == '-') && ((*parser)[2] == '-'))    {        // this is a comment, so skip to end of comment        parser->ConsumeLength(NULL, 2); // skip '--'                // look for -->        while((parser->GetDataRemaining() > 2) && ((parser->PeekFast() != '-') ||                ((*parser)[1] != '-') || ((*parser)[2] != '>')))        {            if (parser->PeekFast() == '-') parser->ConsumeLength(NULL, 1);            parser->ConsumeUntil(NULL, '-');        }                if (parser->GetDataRemaining() > 2) parser->ConsumeLength(NULL, 3); // consume -->    }}bool XMLTag::ParseTag(StringParser* parser, DTDVerifier* verifier, char* errorBuffer, int errorBufferSize){    while (true)    {        if (!parser->GetThru(NULL, '<'))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Couldn't find a valid tag");            return false;   // couldn't find beginning of tag        }                    char c = parser->PeekFast();        if (c == '/')        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "End tag with no begin tag on line %d", parser->GetCurrentLineNumber());            return false;   // we shouldn't be seeing a close tag here        }                    if ((c != '!') && (c != '?'))            break;  // this should be the beginning of a regular tag                    ConsumeIfComment(parser);        // otherwise this is a processing instruction or a c-data, so look for the next tag    }        int tagStartLine = parser->GetCurrentLineNumber();        StrPtrLen temp;    parser->ConsumeUntil(&temp, sNonNameMask);    if (temp.Len == 0)    {        if (errorBuffer != NULL)        {            if (parser->GetDataRemaining() == 0)                qtss_sprintf(errorBuffer, "Unexpected end of file on line %d", parser->GetCurrentLineNumber());            else                qtss_sprintf(errorBuffer, "Unexpected character (%c) on line %d", parser->PeekFast(), parser->GetCurrentLineNumber());        }        return false;   // bad file    }            fTag = temp.GetAsCString();        parser->ConsumeWhitespace();    while ((parser->PeekFast() != '>') && (parser->PeekFast() != '/'))    {        // we must have an attribute value for this tag        XMLAttribute* attr = new XMLAttribute;        fAttributes.EnQueue(&attr->fElem);        parser->ConsumeUntil(&temp, sNonNameMask);        if (temp.Len == 0)        {            if (errorBuffer != NULL)            {                if (parser->GetDataRemaining() == 0)                    qtss_sprintf(errorBuffer, "Unexpected end of file on line %d", parser->GetCurrentLineNumber());                else                    qtss_sprintf(errorBuffer, "Unexpected character (%c) on line %d", parser->PeekFast(), parser->GetCurrentLineNumber());            }            return false;   // bad file        }        attr->fAttrName = temp.GetAsCString();        if (!parser->Expect('='))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Missing '=' after attribute %s on line %d", attr->fAttrName, parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }        if (!parser->Expect('"'))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Attribute %s value not in quotes on line %d", attr->fAttrName, parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }                    parser->ConsumeUntil(&temp, '"');        attr->fAttrValue = temp.GetAsCString();        if (!parser->Expect('"'))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Attribute %s value not in quotes on line %d", attr->fAttrName, parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }                if (verifier && !verifier->IsValidAttributeName(fTag, attr->fAttrName))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Attribute %s not allowed in tag %s on line %d", attr->fAttrName, fTag, parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }        if (verifier && !verifier->IsValidAttributeValue(fTag, attr->fAttrName, attr->fAttrValue))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Bad value for attribute %s on line %d", attr->fAttrName, parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }        parser->ConsumeWhitespace();    }        if (parser->PeekFast() == '/')    {        // this is an empty element tag, i.e. no contents or end tag (e.g <TAG attr="value" />        parser->Expect('/');        if (!parser->Expect('>'))        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "'>' must follow '/' on line %d", parser->GetCurrentLineNumber());            return false;   // bad attribute specification        }                return true;    // we're done with this tag    }        if (!parser->Expect('>'))    {        if (errorBuffer != NULL)            qtss_sprintf(errorBuffer, "Bad format for tag <%s> on line %d", fTag, parser->GetCurrentLineNumber());        return false;   // bad attribute specification    }        while(true)    {        parser->ConsumeUntil(&temp, '<');   // this is either value or whitespace        if (parser->GetDataRemaining() < 4)        {            if (errorBuffer != NULL)                qtss_sprintf(errorBuffer, "Reached end of file without end for tag <%s> declared on line %d", fTag, tagStartLine);            return false;        }        if ((*parser)[1] == '/')        {            // we'll only assign a value if there were no embedded tags            if (fEmbeddedTags.GetLength() == 0 && (!verifier || verifier->CanHaveValue(fTag)))                fValue = temp.GetAsCString();            else            {                // otherwise this needs to have been just whitespace                StringParser tempParser(&temp);                tempParser.ConsumeWhitespace();                if (tempParser.GetDataRemaining() > 0)                {                    if (errorBuffer)                    {                        if (fEmbeddedTags.GetLength() > 0)                            qtss_sprintf(errorBuffer, "Unexpected text outside of tag on line %d", tagStartLine);                        else                            qtss_sprintf(errorBuffer, "Tag <%s> on line %d not allowed to have data", fTag, tagStartLine);                    }                }            }            break;  // we're all done with this tag        }                if (((*parser)[1] != '!') && ((*parser)[1] != '?'))        {            // this must be the beginning of an embedded tag            XMLTag* tag = NEW XMLTag();            fEmbeddedTags.EnQueue(&tag->fElem);            if (!tag->ParseTag(parser, verifier, errorBuffer, errorBufferSize))                return false;                            if (verifier && !verifier->IsValidSubtag(fTag, tag->GetTagName()))            {                if (errorBuffer != NULL)                    qtss_sprintf(errorBuffer, "Tag %s not allowed in tag %s on line %d", tag->GetTagName(), fTag, parser->GetCurrentLineNumber());                return false;   // bad attribute specification            }        }        else        {            parser->ConsumeLength(NULL, 1); // skip '<'            ConsumeIfComment(parser);        }    }    parser->ConsumeLength(NULL, 2); // skip '</'    parser->ConsumeUntil(&temp, sNonNameMask);    if (!temp.Equal(fTag))    {        char* newTag = temp.GetAsCString();        if (errorBuffer != NULL)            qtss_sprintf(errorBuffer, "End tag </%s> on line %d doesn't match tag <%s> declared on line %d", newTag, parser->GetCurrentLineNumber(),fTag, tagStartLine);        delete newTag;        return false;   // bad attribute specification    }        if (!parser->GetThru(NULL, '>'))    {        if (errorBuffer != NULL)            qtss_sprintf(errorBuffer, "Couldn't find end of tag <%s> declared on line %d", fTag, tagStartLine);        return false;   // bad attribute specification    }        return true;}char* XMLTag::GetAttributeValue(const char* attrName){    for (OSQueueIter iter(&fAttributes); !iter.IsDone(); iter.Next())    {        XMLAttribute* attr = (XMLAttribute*)iter.GetCurrent()->GetEnclosingObject();        if (!strcmp(attr->fAttrName, attrName))            return attr->fAttrValue;    }        return NULL;}XMLTag* XMLTag::GetEmbeddedTag(const UInt32 index){    if (fEmbeddedTags.GetLength() <= index)        return NULL;        OSQueueIter iter(&fEmbeddedTags);    for (UInt32 i = 0; i < index; i++)    {        iter.Next();    }    OSQueueElem* result = iter.GetCurrent();        return (XMLTag*)result->GetEnclosingObject();}XMLTag* XMLTag::GetEmbeddedTagByName(const char* tagName, const UInt32 index){    if (fEmbeddedTags.GetLength() <= index)        return NULL;        XMLTag* result = NULL;    UInt32 curIndex = 0;    for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())    {        XMLTag* temp = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();        if (!strcmp(temp->GetTagName(), tagName))        {            if (curIndex == index)            {                result = temp;                break;            }                            curIndex++;        }    }        return result;}XMLTag* XMLTag::GetEmbeddedTagByAttr(const char* attrName, const char* attrValue, const UInt32 index){    if (fEmbeddedTags.GetLength() <= index)        return NULL;        XMLTag* result = NULL;    UInt32 curIndex = 0;    for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())    {        XMLTag* temp = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();        if ((temp->GetAttributeValue(attrName) != NULL) && (!strcmp(temp->GetAttributeValue(attrName), attrValue)))        {            if (curIndex == index)            {                result = temp;                break;            }                            curIndex++;        }    }        return result;}XMLTag* XMLTag::GetEmbeddedTagByNameAndAttr(const char* tagName, const char* attrName, const char* attrValue, const UInt32 index){    if (fEmbeddedTags.GetLength() <= index)        return NULL;        XMLTag* result = NULL;    UInt32 curIndex = 0;    for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())    {        XMLTag* temp = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();        if (!strcmp(temp->GetTagName(), tagName) && (temp->GetAttributeValue(attrName) != NULL) &&             (!strcmp(temp->GetAttributeValue(attrName), attrValue)))        {            if (curIndex == index)            {                result = temp;                break;            }                            curIndex++;        }    }        return result;}void XMLTag::AddAttribute( char* attrName, char* attrValue){    XMLAttribute* attr = NEW XMLAttribute;    StrPtrLen temp(attrName);    attr->fAttrName = temp.GetAsCString();    temp.Set(attrValue);    attr->fAttrValue = temp.GetAsCString();        fAttributes.EnQueue(&attr->fElem);}void XMLTag::RemoveAttribute(char* attrName){    for (OSQueueIter iter(&fAttributes); !iter.IsDone(); iter.Next())    {        XMLAttribute* attr = (XMLAttribute*)iter.GetCurrent()->GetEnclosingObject();        if (!strcmp(attr->fAttrName, attrName))        {            fAttributes.Remove(&attr->fElem);            delete attr;            return;        }    }}void XMLTag::AddEmbeddedTag(XMLTag* tag){    fEmbeddedTags.EnQueue(&tag->fElem);}void XMLTag::RemoveEmbeddedTag(XMLTag* tag){    fEmbeddedTags.Remove(&tag->fElem);}void XMLTag::SetTagName( char* name){    Assert (name != NULL);  // can't have a tag without a name!        if (fTag != NULL)        delete fTag;            StrPtrLen temp(name);    fTag = temp.GetAsCString();}    void XMLTag::SetValue( char* value){    if (fEmbeddedTags.GetLength() > 0)        return;     // can't have a value with embedded tags            if (fValue != NULL)        delete fValue;            if (value == NULL)        fValue = NULL;    else    {        StrPtrLen temp(value);        fValue = temp.GetAsCString();    }}    void XMLTag::FormatData(ResizeableStringFormatter* formatter, UInt32 indent){    for (UInt32 i=0; i<indent; i++) formatter->PutChar('/t');    formatter->PutChar('<');    formatter->Put(fTag);    if (fAttributes.GetLength() > 0)    {        formatter->PutChar(' ');        for (OSQueueIter iter(&fAttributes); !iter.IsDone(); iter.Next())        {            XMLAttribute* attr = (XMLAttribute*)iter.GetCurrent()->GetEnclosingObject();            formatter->Put(attr->fAttrName);            formatter->Put("=/"");            formatter->Put(attr->fAttrValue);            formatter->Put("/" ");        }    }    formatter->PutChar('>');        if (fEmbeddedTags.GetLength() == 0)    {        if (fValue > 0)            formatter->Put(fValue);    }    else    {        formatter->Put(kEOLString);        for (OSQueueIter iter(&fEmbeddedTags); !iter.IsDone(); iter.Next())        {            XMLTag* current = (XMLTag*)iter.GetCurrent()->GetEnclosingObject();            current->FormatData(formatter, indent + 1);        }        for (UInt32 i=0; i<indent; i++) formatter->PutChar('/t');    }        formatter->Put("</");    formatter->Put(fTag);    formatter->PutChar('>');    formatter->Put(kEOLString);}XMLAttribute::XMLAttribute()    : fAttrName(NULL),    fAttrValue(NULL){   fElem = this;}XMLAttribute::~XMLAttribute(){    if (fAttrName)        delete fAttrName;    if (fAttrValue)        delete fAttrValue;      }


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
欧美国产日本高清在线| 国产成人一区二| 一区二区在线视频播放| 久久影院免费观看| 日本中文字幕久久看| 欧美猛交ⅹxxx乱大交视频| 日韩大胆人体377p| 欧美激情aaaa| 川上优av一区二区线观看| 在线免费观看羞羞视频一区二区| 97av在线视频免费播放| 日韩综合中文字幕| 一区二区三区视频观看| 国产精品视频白浆免费视频| 日韩在线观看免费全集电视剧网站| 精品国产乱码久久久久久婷婷| 国产精品美女av| 欧美性生交大片免费| 久久99久久99精品免观看粉嫩| 北条麻妃一区二区三区中文字幕| 国产69精品99久久久久久宅男| 亚州国产精品久久久| 欧美日产国产成人免费图片| 久久亚洲国产精品成人av秋霞| 日韩精品中文字幕在线观看| 欧美性videos高清精品| 正在播放欧美一区| 国产精品丝袜视频| 国产精品久久激情| 国产精品视频永久免费播放| 亚洲精品日韩久久久| 亚洲午夜色婷婷在线| 成人两性免费视频| 久久国产精品网站| 精品中文字幕视频| 国产在线98福利播放视频| 国产精品极品尤物在线观看| 4k岛国日韩精品**专区| 日韩精品在线视频观看| 色偷偷91综合久久噜噜| 国内精品免费午夜毛片| 国产精品自产拍在线观| 日韩精品在线观看网站| 精品亚洲aⅴ在线观看| 色悠久久久久综合先锋影音下载| 精品久久在线播放| 日韩在线播放视频| 国产99久久精品一区二区 夜夜躁日日躁| 欧美黑人xxxⅹ高潮交| 亚洲天堂男人天堂女人天堂| 欧美老女人bb| 国产精品久久不能| 91在线高清视频| 国产精品久久久久一区二区| 国产丝袜高跟一区| 上原亚衣av一区二区三区| 欧美大胆在线视频| 欧美激情在线播放| 免费91麻豆精品国产自产在线观看| 亚洲级视频在线观看免费1级| 91sa在线看| 亚洲美女av在线| 中文字幕欧美专区| 亚洲一级免费视频| 久久久久久久久中文字幕| 黄色精品一区二区| 欧美精品免费看| 日本中文字幕久久看| 庆余年2免费日韩剧观看大牛| 日韩视频免费在线观看| 国自在线精品视频| 欧美成人激情视频| 欧美国产精品日韩| 日韩精品免费在线视频| 狠狠色狠狠色综合日日五| 国产欧美精品va在线观看| 国产精品极品在线| 国产美女精彩久久| 国产国产精品人在线视| 中文字幕视频一区二区在线有码| 久久天天躁狠狠躁夜夜爽蜜月| 国产精品久久不能| 亚洲视频一区二区三区| 最新日韩中文字幕| 久久久成人精品视频| 亚洲欧洲黄色网| 久久久国产一区二区三区| 欧美大肥婆大肥bbbbb| 久久久人成影片一区二区三区| 最新69国产成人精品视频免费| 亚洲欧洲av一区二区| 成人www视频在线观看| 国产欧美精品va在线观看| 亚洲欧美福利视频| 欧美午夜激情视频| 亚洲缚视频在线观看| 精品综合久久久久久97| 国产性猛交xxxx免费看久久| 国产精品69精品一区二区三区| 97在线视频观看| 亚洲一区中文字幕| 欧美性理论片在线观看片免费| 亚洲美女喷白浆| 欧美日韩精品在线视频| 国产精品欧美风情| 日韩麻豆第一页| 欧美视频13p| 久久人人爽人人爽爽久久| 欧美性猛交xxxxx免费看| 久久的精品视频| 国产精品自拍小视频| 国产ts人妖一区二区三区| 成人a在线观看| 欧美贵妇videos办公室| 97视频在线观看成人| 91精品免费久久久久久久久| 久久国产加勒比精品无码| 日韩高清av一区二区三区| 在线观看久久av| 亚洲国产欧美一区二区三区久久| 黄色一区二区三区| 久久久久久久久国产| 国产日韩在线精品av| 国产精品精品视频| 久久躁狠狠躁夜夜爽| 伊人久久免费视频| 欧美激情国产日韩精品一区18| 国产精品久久久久久久久久| 在线成人激情黄色| 久久99热这里只有精品国产| 91精品国产精品| 国产精品欧美一区二区| 久热爱精品视频线路一| 91av在线视频观看| 国产一区二区三区高清在线观看| 亚洲黄色免费三级| 精品亚洲国产成av人片传媒| 国产精品麻豆va在线播放| 欧美一级在线亚洲天堂| www.亚洲免费视频| 欧美性少妇18aaaa视频| 国产综合久久久久| 午夜精品福利电影| 国产精品久久久久久久av电影| 亚洲一区av在线播放| 欧美色道久久88综合亚洲精品| 97久久久免费福利网址| 国产精品91一区| 久久久久久国产| 精品视频9999| 日韩的一区二区| 日韩精品电影网| 欧美在线视频免费| 深夜福利亚洲导航| 久久久久久网址| 亚洲黄色av女优在线观看| 国产精品一区av| 精品国产999| 久久免费福利视频| 欧美日韩美女在线| 综合国产在线观看| 啪一啪鲁一鲁2019在线视频| 亚洲欧美激情另类校园| 亚洲国产精品热久久|