Better attribute system. Removes redundant list searching of LinkAttribute. Faster parsing on initial read. Added badly needed missing test cases.
diff --git a/xmltest.cpp b/xmltest.cpp
index 0991e2d..a88d1bc 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -760,6 +760,32 @@
}
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 ------------
{