本文整理汇总了C++中TiXmlPrinter类的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlPrinter类的具体用法?C++ TiXmlPrinter怎么用?C++ TiXmlPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TiXmlPrinter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModifyXmlAttri
bool CSimpleXml::ModifyXmlAttri(list<XMLNODEINFO> &lstNode)
{
if(m_pDoc == NULL || m_pRoot == NULL)
{
return false;
}
list<XMLNODEINFO>::iterator itlst = lstNode.begin();
for(; itlst != lstNode.end(); ++itlst)
{
if(!ModifyOneAttri(*itlst))
{
return false;
}
}
TiXmlPrinter printer;
char szBuf[32];
memset(szBuf, 0, 32);
szBuf[0] = 0x9;
printer.SetIndent(szBuf);
szBuf[0] = 0x0a;
printer.SetLineBreak(szBuf);
if(m_pDoc->Accept(&printer))
{
m_strXml = printer.CStr();
}
else
{
return false;
}
return true;
}
示例2: RebuildXmlData
void wxsCustomWidget::RebuildXmlData()
{
TiXmlPrinter Printer;
Printer.SetIndent("\t");
m_XmlDataDoc.Accept(&Printer);
m_XmlData = cbC2U(Printer.CStr());
}
示例3: ASSERT
void CUIDesignerView::OnEditCopy()
{
ASSERT(m_cfUI != NULL);
TiXmlDocument xmlDoc;
TiXmlDeclaration Declaration("1.0","utf-8","yes");
xmlDoc.InsertEndChild(Declaration);
TiXmlElement* pCopyElm = new TiXmlElement("UICopy");
CopyUI(pCopyElm);
xmlDoc.InsertEndChild(*pCopyElm);
TiXmlPrinter printer;
xmlDoc.Accept(&printer);
delete pCopyElm;
CSharedFile file(GMEM_MOVEABLE, printer.Size() + 1);
file.Write(printer.CStr(), printer.Size());
file.Write("\0", 1);
COleDataSource* pDataSource = NULL;
TRY
{
pDataSource = new COleDataSource;
pDataSource->CacheGlobalData(m_cfUI, file.Detach());
pDataSource->SetClipboard();
}
CATCH_ALL(e)
{
delete pDataSource;
THROW_LAST();
}
END_CATCH_ALL
}
示例4:
std::tr1::shared_ptr<std::string> APIServiceManager::_GetXMLDocumentString()
{
TiXmlPrinter xmlPrinter;
_XmlDoc.Accept( &xmlPrinter );
return std::tr1::shared_ptr<std::string>(new std::string(xmlPrinter.CStr()));
}
示例5: TiXmlDocument
bool CSimpleXml::OpenXml(const string &strXml, int nXmlType)
{
if(strXml.empty())
{
return false;
}
// m_pDoc = new TiXmlDocument(strXml.c_str());
if(XMLFILE == nXmlType)//解析文件
{
m_pDoc = new TiXmlDocument(strXml.c_str());
if(!m_pDoc->LoadFile())
{
return false;
}
}
else if(XMLSTR == nXmlType)//解析字符串
{
m_pDoc = new TiXmlDocument;
m_pDoc->Parse(strXml.c_str());
}
m_pRoot = m_pDoc->RootElement();
if(NULL == m_pDoc || NULL == m_pRoot)
{
return false;
}
TiXmlPrinter printer;
printer.SetStreamPrinting();
if(m_pDoc->Accept(&printer))
{
m_strXml = printer.CStr();
return true;
}
return false;
}
示例6: CreateResponXML
void CreateResponXML(int nID, const char *szResult, char *RetXML)
{
TiXmlDocument *XmlDoc;
TiXmlElement *RootElement;
TiXmlElement *Segment;
TiXmlDeclaration HeadDec;
TiXmlPrinter Printer;
// 创建XML文档
XmlDoc = new TiXmlDocument();
// 增加XML的头部说明
HeadDec.Parse("<?xml version=\"1.0\" encoding=\"gb2312\" ?>", 0, TIXML_ENCODING_UNKNOWN);
XmlDoc->LinkEndChild(&HeadDec);
RootElement = new TiXmlElement("CardProcess");
Segment = new TiXmlElement("ReturnInfo");
Segment->SetAttribute("ID", nID);
Segment->SetAttribute("Desc", szResult);
RootElement->LinkEndChild(Segment);
XmlDoc->LinkEndChild(RootElement);
XmlDoc->Accept(&Printer);
strcpy(RetXML, Printer.CStr());
}
示例7: copyXmlToString
//---------------------------------------------------------
void ofxXmlSettings::copyXmlToString(string & str)
{
TiXmlPrinter printer;
doc.Accept(&printer);
str = printer.CStr();
}
示例8: ModifyXml
bool CSimpleXml::ModifyXml(list<XMLNODEINFO> &lstXmlNodes)
{
if(m_pDoc == NULL || m_pRoot == NULL)
{
return false;
}
list<XMLNODEINFO>::iterator itlist = lstXmlNodes.begin();
int nSize = lstXmlNodes.size();
for(int i = 0; i < nSize; ++i)
{
if(!AccessXmlNode((*itlist), MODIFY))
{
return false;
}
++itlist;
}
TiXmlPrinter printer;
printer.SetStreamPrinting();
if(m_pDoc->Accept( &printer ))
{
m_strXml = printer.CStr();
}
else
{
return false;
}
return true;
}
示例9: getPointee
// QC:A (discussion possible sur l'utilisation de snprintf. Les buffers statiques ne sont pas thread safe.)
char* ScriptVariable::getstr() const {
if(isPointer()) {
return getPointee()->getstr();
}
if(type == VAR_NULL) {
return NULL;
}
if(type == VAR_INT) {
static char number[32];
snprintf(number, 32, "%d", value);
number[31] ='\0';
return number;
}
if(type == VAR_XML) {
static TiXmlPrinter printer;
printer = TiXmlPrinter();
printer.SetStreamPrinting();
TiXmlNode* node = (TiXmlNode*) data;
node->Accept(&printer);
return (char*)printer.CStr();
}
if(type == VAR_OBJ) {
static char address[256];
snprintf(address, 256, "(*%p:%s)", data, ((ScriptableObject*)data)->getClassName());
address[255] ='\0';
return address;
}
if(type == VAR_PAIR) {
static char number[64];
snprintf(number, 64, "(%ld:%ld)", (long) data, (long) params);
number[63] ='\0';
return number;
}
if(type == VAR_PACK) {
static char info[4096]; // XXX : NOT thread safe
snprintf(info, 4096, "(*%p => \"%s\")", data, params);
info[4095] ='\0';
return info;
}
if(type == VAR_TBL) {
static char info[4096]; // XXX : NOT thread safe
snprintf(info, 4096, "(tbl[%ld]:*%p)", (long)(data?(((ScriptTable*)data)->size()):0), data);
info[4095] ='\0';
return info;
}
if(type == VAR_FCT) {
return params;
}
return data;
}
示例10: getText
size_t XMLSource::getText(const char*& outputBuffer) {
TiXmlPrinter printer;
printer.SetStreamPrinting();
xassert(doc, "No document to save.");
doc->Accept(&printer);
outputBuffer = printer.CStr();
return printer.Size();
}
示例11:
std::string em::EmXml::GetText()
{
std::string strResult;
TiXmlPrinter docPrinter;
m_pDoc->Accept(&docPrinter);
strResult = docPrinter.CStr();
return strResult;
}
示例12: ToString
void CXmlDocument::ToString(CDataBuffer& buffer)
{
TiXmlPrinter printer;
printer.SetLineBreak("\r\n");
printer.SetIndent("\t");
_doc->Accept(&printer);
buffer.Add(printer.CStr());
}
示例13: BMessage
status_t Converter::ConvertPDoc2FreeMind()
{
status_t err = B_OK;
BMessage *inMessage = new BMessage();
BMessage *tmpMessage = new BMessage();
void *id = NULL;
allConnections = new BMessage();
selected = new BMessage();
allNodes = new BMessage();
err = inMessage->Unflatten(in);
if (err == B_OK)
{
inMessage->FindMessage("PDocument::allConnections",allConnections);
inMessage->FindMessage("PDocument::selected",selected);
inMessage->FindMessage("PDocument::allNodes",allNodes);
int32 i = 0;
while(allNodes->FindMessage("node",i,tmpMessage)==B_OK)
{
tmpMessage->FindPointer("this",&id);
nodes[(int32)id]=tmpMessage;
tmpMessage = new BMessage();
- i++;
}
i = 0;
while(allConnections->FindMessage("node",i,tmpMessage)==B_OK)
{
tmpMessage->FindPointer("this",&id);
connections[(int32)id]=tmpMessage;
tmpMessage = new BMessage();
i++;
}
BMessage *node= GuessStartNode();
TiXmlDocument doc;
TiXmlElement freeMap("map");
freeMap.SetAttribute("version","0.9.0");
freeMap.SetAttribute("background_color","#ffffff");
TiXmlComment comment("this File was gernerated by ProjectConceptor! - To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net");
freeMap.InsertEndChild(comment);
tmpMessage=GuessStartNode();
// tmpMessage = nodes.begin()->second;
freeMap.InsertEndChild(ProcessNode(tmpMessage));
doc.InsertEndChild(freeMap);
TiXmlPrinter printer;
// printer.SetStreamPrinting();
// printer.SetLineBreak("\n");
// printer.SetIndent("\t");
doc.Accept( &printer );
out->Write(printer.CStr(),strlen(printer.CStr()));
}
return err;
}
示例14: nodeToString
std::string SerializeBase::nodeToString(const TxElement& node) {
try {
TiXmlPrinter printer;
printer.SetIndent(" ");
node.Accept(&printer);
return printer.CStr();
} catch (TxException&) {
return "No valid root node";
}
}
示例15: save
void xml_write_archive::save(const variant& what)
{
TiXmlPrinter printer;
printer.SetIndent( "\t" );
base_write_archive::save( what );
doc_.Accept( &printer );
result_ = printer.Str();
}