Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well.
This commit is contained in:
21
xmltest.cpp
21
xmltest.cpp
@@ -1012,6 +1012,27 @@ int main( int argc, const char ** argv )
|
||||
ele->DeleteAttribute( "attrib3" );
|
||||
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
|
||||
}
|
||||
|
||||
{
|
||||
XMLDocument doc0;
|
||||
XMLElement* root = doc0.NewElement("root");
|
||||
doc0.InsertEndChild(root);
|
||||
XMLElement* text = doc0.NewElement("text");
|
||||
text->SetForceCompactMode(true);
|
||||
root->InsertEndChild(text);
|
||||
XMLText* befText = doc0.NewText("Before ");
|
||||
text->InsertEndChild(befText);
|
||||
XMLElement* tag = doc0.NewElement("tag");
|
||||
text->InsertEndChild(tag);
|
||||
XMLText* tagText = doc0.NewText("Tag");
|
||||
tag->InsertEndChild(tagText);
|
||||
XMLText* aftText = doc0.NewText(" After");
|
||||
text->InsertEndChild(aftText);
|
||||
|
||||
XMLPrinter printer;
|
||||
doc0.Print( &printer );
|
||||
XMLTest( "Selective text wrapping", "<root>\n <text>Before <tag>Tag</tag> After</text>\n</root>\n", printer.CStr() );
|
||||
}
|
||||
|
||||
{
|
||||
// Make sure an attribute with a space in it succeeds.
|
||||
|
||||
Reference in New Issue
Block a user