本文整理汇总了C++中TiXmlDeclaration::Row方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlDeclaration::Row方法的具体用法?C++ TiXmlDeclaration::Row怎么用?C++ TiXmlDeclaration::Row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiXmlDeclaration
的用法示例。
在下文中一共展示了TiXmlDeclaration::Row方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count );
count = 0;
for( node = todoElement->LastChild( "Item" );
node;
node = node->PreviousSibling( "Item" ) )
{
count++;
}
XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count );
#ifdef TIXML_USE_STL
{
cout << "\n** Parsing. **\n";
istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '>' />" );
TiXmlElement element0( "default" );
parse0 >> element0;
XmlTest ( "Element parsed, value is 'Element0'.", "Element0", element0.Value() );
XmlTest ( "Reads attribute 'attribute0=\"foo0\"'.", "foo0", element0.Attribute( "attribute0" ));
XmlTest ( "Reads incorrectly formatted 'attribute1=noquotes'.", "noquotes", element0.Attribute( "attribute1" ) );
XmlTest ( "Read attribute with entity value '>'.", ">", element0.Attribute( "attribute2" ) );
}
#endif
{
const char* error = "<?xml version=\"1.0\" standalone=\"no\" ?>\n"
"<passages count=\"006\" formatversion=\"20020620\">\n"
" <wrong error>\n"
"</passages>";
TiXmlDocument doc;
doc.Parse( error );
XmlTest( "Error row", doc.ErrorRow(), 3 );
XmlTest( "Error column", doc.ErrorCol(), 17 );
//printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 );
}
{
const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
" <!-- Silly example -->\n"
" <door wall='north'>A great door!</door>\n"
"\t<door wall='east'/>"
"</room>";
TiXmlDocument doc;
doc.Parse( str );
TiXmlHandle docHandle( &doc );
TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );
TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild();
TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild();
TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 );
TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 );
assert( docHandle.Node() );
assert( roomHandle.Element() );
assert( commentHandle.Node() );
assert( textHandle.Text() );
assert( door0Handle.Element() );
assert( door1Handle.Element() );
TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration();
assert( declaration );
TiXmlElement* room = roomHandle.Element();
assert( room );
示例2: main
//.........这里部分代码省略.........
XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count );
count = 0;
for( node = todoElement->LastChild( "Item" );
node;
node = node->PreviousSibling( "Item" ) )
{
count++;
}
XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count );
#ifdef TIXML_USE_STL
{
cout << "\n** Parsing. **\n";
istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '>' />" );
TiXmlElement element0( "default" );
parse0 >> element0;
XmlTest ( "Element parsed, value is 'Element0'.", "Element0", element0.Value() );
XmlTest ( "Reads attribute 'attribute0=\"foo0\"'.", "foo0", element0.Attribute( "attribute0" ));
XmlTest ( "Reads incorrectly formatted 'attribute1=noquotes'.", "noquotes", element0.Attribute( "attribute1" ) );
XmlTest ( "Read attribute with entity value '>'.", ">", element0.Attribute( "attribute2" ) );
}
#endif
{
const char* error = "<?xml version=\"1.0\" standalone=\"no\" ?>\n"
"<passages count=\"006\" formatversion=\"20020620\">\n"
" <wrong error>\n"
"</passages>";
TiXmlDocument docTest;
docTest.Parse( error );
XmlTest( "Error row", docTest.ErrorRow(), 3 );
XmlTest( "Error column", docTest.ErrorCol(), 17 );
//printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 );
}
#ifdef TIXML_USE_STL
{
//////////////////////////////////////////////////////
cout << "\n** Streaming. **\n";
// Round trip check: stream in, then stream back out to verify. The stream
// out has already been checked, above. We use the output
istringstream inputStringStream( outputStream.str() );
TiXmlDocument document0;
inputStringStream >> document0;
ostringstream outputStream0( ostringstream::out );
outputStream0 << document0;
XmlTest( "Stream round trip correct.", string( demoEnd ).c_str(),
outputStream0.str().c_str(), true );
std::string str;
str << document0;
XmlTest( "String printing correct.", string( demoEnd ).c_str(),
str.c_str(), true );
}
#endif
}
示例3: main
//.........这里部分代码省略.........
XmlTest( "'Item' children of the 'ToDo' element, using First/Next.", 3, count );
count = 0;
for( node = todoElement->LastChild( "Item" );
node;
node = node->PreviousSibling( "Item" ) )
{
count++;
}
XmlTest( "'Item' children of the 'ToDo' element, using Last/Previous.", 3, count );
#ifdef TIXML_USE_STL
{
cout << "\n** Parsing. **\n";
istringstream parse0( "<Element0 attribute0='foo0' attribute1= noquotes attribute2 = '>' />" );
TiXmlElement element0( "default" );
parse0 >> element0;
XmlTest ( "Element parsed, value is 'Element0'.", "Element0", element0.Value() );
XmlTest ( "Reads attribute 'attribute0=\"foo0\"'.", "foo0", element0.Attribute( "attribute0" ));
XmlTest ( "Reads incorrectly formatted 'attribute1=noquotes'.", "noquotes", element0.Attribute( "attribute1" ) );
XmlTest ( "Read attribute with entity value '>'.", ">", element0.Attribute( "attribute2" ) );
}
#endif
}
{
const char* error = "<?xml version=\"1.0\" standalone=\"no\" ?>\n"
"<passages count=\"006\" formatversion=\"20020620\">\n"
" <wrong error>\n"
"</passages>";
TiXmlDocument doc;
doc.Parse( error );
XmlTest( "Error row", doc.ErrorRow(), 3 );
XmlTest( "Error column", doc.ErrorCol(), 17 );
//printf( "error=%d id='%s' row %d col%d\n", (int) doc.Error(), doc.ErrorDesc(), doc.ErrorRow()+1, doc.ErrorCol() + 1 );
}
{
const char* str = "\t<?xml version=\"1.0\" standalone=\"no\" ?>\t<room doors='2'>\n"
" <!-- Silly example -->\n"
" <door wall='north'>A great door!</door>\n"
"\t<door wall='east'/>"
"</room>";
TiXmlDocument doc;
doc.Parse( str );
TiXmlHandle docHandle( &doc );
TiXmlHandle roomHandle = docHandle.FirstChildElement( "room" );
TiXmlHandle commentHandle = docHandle.FirstChildElement( "room" ).FirstChild();
TiXmlHandle textHandle = docHandle.FirstChildElement( "room" ).ChildElement( "door", 0 ).FirstChild();
TiXmlHandle door0Handle = docHandle.FirstChildElement( "room" ).ChildElement( 0 );
TiXmlHandle door1Handle = docHandle.FirstChildElement( "room" ).ChildElement( 1 );
assert( docHandle.Node() );
assert( roomHandle.Element() );
assert( commentHandle.Node() );
assert( textHandle.Text() );
assert( door0Handle.Element() );
assert( door1Handle.Element() );
TiXmlDeclaration* declaration = doc.FirstChild()->ToDeclaration();
assert( declaration );
TiXmlElement* room = roomHandle.Element();
assert( room );
TiXmlAttribute* doors = room->FirstAttribute();