Better attribute system. Removes redundant list searching of LinkAttribute. Faster parsing on initial read. Added badly needed missing test cases.

This commit is contained in:
Lee Thomason
2012-04-16 08:57:05 -07:00
parent d0b19df88c
commit 5e3803cac3
3 changed files with 65 additions and 36 deletions

View File

@@ -760,6 +760,32 @@ int main( int /*argc*/, const char ** /*argv*/ )
}
XMLTest( "Error in snprinf handling.", true, doc.Error() );
}
{
// Attribute ordering.
static const char* xml = "<element attrib1=\"1\" attrib2=\"2\" attrib3=\"3\" />";
XMLDocument doc;
doc.Parse( xml );
XMLElement* ele = doc.FirstChildElement();
const XMLAttribute* a = ele->FirstAttribute();
XMLTest( "Attribute order", "1", a->Value() );
a = a->Next();
XMLTest( "Attribute order", "2", a->Value() );
a = a->Next();
XMLTest( "Attribute order", "3", a->Value() );
XMLTest( "Attribute order", "attrib3", a->Name() );
ele->DeleteAttribute( "attrib2" );
a = ele->FirstAttribute();
XMLTest( "Attribute order", "1", a->Value() );
a = a->Next();
XMLTest( "Attribute order", "3", a->Value() );
ele->DeleteAttribute( "attrib1" );
ele->DeleteAttribute( "attrib3" );
XMLTest( "Attribute order (empty)", false, ele->FirstAttribute() ? true : false );
}
// -------- Handles ------------
{