Home | History | Annotate | Download | only in tinyxml2

Lines Matching refs:element

135 	static const char* xml = "<element/>";

193 <li>Element "PLAY"</li>
195 <li>Element "TITLE"</li>
204 we want) is child of the "TITLE" element which
205 is a child of the "PLAY" element.
210 Element, the FirstChildElement() of the "PLAY" Element
211 is the "TITLE" Element.
234 looking for XMLText, not an element, and ToText()
271 the key name into an element and the value into
272 the text node wrapped by the element. Both approaches
356 static const char* test[] = { "<element />",
357 "<element></element>",
358 "<element><subelement/></element>",
359 "<element><subelement></subelement></element>",
360 "<element><subelement><subsub/></subelement></element>",
361 "<!--comment beside elements--><element><subelement></subelement></element>",
362 "<!--comment beside elements, this time with spaces--> \n <element> <subelement> \n </subelement> </element>",
363 "<element attrib1='foo' attrib2=\"bar\" ></element>",
364 "<element attrib1='foo' attrib2=\"bar\" ><subelement attrib3='yeehaa' /></element>",
365 "<element>Text inside element.</element>",
366 "<element><b></b></element>",
367 "<element>Text inside and <b>bolded</b> in the element.</element>",
368 "<outer><element>Text inside and <b>bolded</b> in the element.</element></outer>",
369 "<element>This &amp; That.</element>",
370 "<element attrib='This&lt;That' />",
376 XMLTest( "Element test", false, doc.Error() );
424 static const char* test = "<element>Text before.</element>";
427 XMLTest( "Element text before", false, doc.Error() );
435 static const char* test = "<element><sub/></element>";
437 XMLTest( "Element with sub element", false, doc->Error() );
445 XMLTest( "New element", true, first != 0 );
447 XMLTest( "New element inserted first", true, firstAfterInsertion == first );
450 XMLTest( "New element", true, last != 0 );
452 XMLTest( "New element inserted last", true, lastAfterInsertion == last );
455 XMLTest( "New element", true, middle != 0 );
457 XMLTest( "New element inserted middle", true, middleAfterInsertion == middle );
462 // <element>
467 // <element>
470 XMLNode* element = doc->InsertEndChild( doc->NewElement( "element" ) );
476 element->InsertEndChild( sub[2] );
481 XMLNode* comment = element->InsertFirstChild( doc->NewComment( "comment" ) );
483 element->InsertAfterChild( comment, sub[0] );
484 element->InsertAfterChild( sub[0], sub[1] );
487 XMLTest( "Programmatic DOM", "comment", doc->FirstChildElement( "element" )->FirstChild()->Value() );
488 XMLTest( "Programmatic DOM", "0", doc->FirstChildElement( "element" )->FirstChildElement()->Attribute( "attrib" ) );
496 element->DeleteChild( sub[2] );
499 element->FirstChildElement()->SetAttribute( "attrib", true );
500 element->LastChildElement()->DeleteAttribute( "attrib" );
522 XMLTest( "Compact mode", "<element><sub attrib=\"true\"/><sub/></element>", streamer.CStr(), false );
624 XMLTest( "Empty top element", false, doc.Error() );
669 // Get the attribute "value" from the "Russian" element and check it.
670 XMLElement* element = doc.FirstChildElement( "document" )->FirstChildElement( "Russian" );
674 XMLTest( "UTF-8: Russian value.", (const char*)correctValue, element->Attribute( "value" ) );
683 XMLTest( "UTF-8: Browsing russian element name.",
733 const XMLElement* element = doc.RootElement();
735 XMLTest( "GetText() normal use.", "This is text", element->GetText() );
740 element = doc.RootElement();
742 XMLTest( "GetText() contained element.", element->GetText() == 0, true );
751 XMLTest( "Empty closed element", false, doc.Error() );
752 XMLElement* element = doc.RootElement();
754 element->SetText("darkness.");
755 XMLTest( "SetText() normal use (open/close).", "darkness.", element->GetText() );
757 element->SetText("blue flame.");
758 XMLTest( "SetText() replace.", "blue flame.", element->GetText() );
762 XMLTest( "Empty self-closed element", false, doc.Error() );
763 element = doc.RootElement();
765 element->SetText("The driver");
766 XMLTest( "SetText() normal use. (self-closing)", "The driver", element->GetText() );
768 element->SetText("<b>horses</b>");
769 XMLTest( "SetText() replace with tag-like text.", "<b>horses</b>", element->GetText() );
772 str = "<foo><bar>Text in nested element</bar></foo>";
774 XMLTest( "Text in nested element", false, doc.Error() );
775 element = doc.RootElement();
777 element->SetText("wolves");
778 XMLTest( "SetText() prefix to nested non-text children.", "wolves", element->GetText() );
782 XMLTest( "Empty self-closed element round 2", false, doc.Error() );
783 element = doc.RootElement();
785 element->SetText( "str" );
786 XMLTest( "SetText types", "str", element->GetText() );
788 element->SetText( 1 );
789 XMLTest( "SetText types", "1", element->GetText() );
791 element->SetText( 1U );
792 XMLTest( "SetText types", "1", element->GetText() );
794 element->SetText( true );
795 XMLTest( "SetText types", "true", element->GetText() );
797 element->SetText( 1.5f );
798 XMLTest( "SetText types", "1.5", element->GetText() );
800 element->SetText( 1.5 );
801 XMLTest( "SetText types", "1.5", element->GetText() );
808 XMLElement* element = doc.NewElement("element");
809 doc.InsertFirstChild(element);
812 element->SetAttribute("attrib", int(-100));
815 XMLError queryResult = element->QueryIntAttribute("attrib", &v);
821 int queryResult = element->QueryAttribute("attrib", &v);
825 XMLTest("Attribute: int", -100, element->IntAttribute("attrib"), true);
828 element->SetAttribute("attrib", unsigned(100));
831 XMLError queryResult = element->QueryUnsignedAttribute("attrib", &v);
837 int queryResult = element->QueryAttribute("attrib", &v);
843 XMLError queryResult = element->QueryStringAttribute("not-attrib", &v);
845 queryResult = element->QueryStringAttribute("attrib", &v);
849 XMLTest("Attribute: unsigned", unsigned(100), element->UnsignedAttribute("attrib"), true);
852 element->SetAttribute("attrib", BIG);
855 XMLError queryResult = element->QueryInt64Attribute("attrib", &v);
861 int queryResult = element->QueryAttribute("attrib", &v);
865 XMLTest("Attribute: int64_t", BIG, element->Int64Attribute("attrib"), true);
868 element->SetAttribute("attrib", true);
871 XMLError queryResult = element->QueryBoolAttribute("attrib", &v);
877 int queryResult = element->QueryAttribute("attrib", &v);
881 XMLTest("Attribute: bool", true, element->BoolAttribute("attrib"), true);
884 element->SetAttribute("attrib", true);
885 const char* result = element->Attribute("attrib");
889 element->SetAttribute("attrib", true);
890 result = element->Attribute("attrib");
896 element->SetAttribute("attrib", 100.0);
899 XMLError queryResult = element->QueryDoubleAttribute("attrib", &v);
905 int queryResult = element->QueryAttribute("attrib", &v);
909 XMLTest("Attribute: double", 100.0, element->DoubleAttribute("attrib"), true);
912 element->SetAttribute("attrib", 100.0f);
915 XMLError queryResult = element->QueryFloatAttribute("attrib", &v);
921 int queryResult = element->QueryAttribute("attrib", &v);
925 XMLTest("Attribute: float", 100.0f, element->FloatAttribute("attrib"), true);
928 element->SetText(BIG);
930 XMLError queryResult = element->QueryInt64Text(&v);
931 XMLTest("Element: int64_t", XML_SUCCESS, queryResult, true);
932 XMLTest("Element: int64_t", BIG, v, true);
1107 const char* test = "<element><Name>1.1 Start easy ignore fin thickness&#xA;</Name></element>";
1125 "<!ELEMENT title (#PCDATA)>"
1126 "<!ELEMENT books (title,authors)>"
1127 "<element />";
1158 const char* doctype = "<element attr='red' attr='blue' />";
1169 const char* doctype = "<element att\0r='red' attr='blue' />";
1289 XMLTest( "No closing element", true, xml.Error() );
1294 const char* pub = "<?xml version='1.0'?> <element><sub/></element> <!--comment--> <!DOCTYPE>";
1318 // Deep Cloning of root element.
1331 XMLTest( "Parse before deep cloning root element", false, doc.Error() );
1340 XMLTest("Deep clone of element.", printer1.CStr(), printer2.CStr(), true);
1344 // Deep Cloning of sub element.
1358 XMLTest( "Parse before deep cloning sub element", false, doc.Error() );
1370 XMLTest("Deep clone of sub-element.", printer1.CStr(), printer2.CStr(), true);
1413 static const char* xml = "<element attrib1=\"1\" attrib2=\"2\" attrib3=\"3\" />";
1440 static const char* xml0 = "<element attribute1= \"Test Attribute\"/>";
1441 static const char* xml1 = "<element attribute1 =\"Test Attribute\"/>";
1442 static const char* xml2 = "<element attribute1 = \"Test Attribute\"/>";
1464 static const char* xml = "<doc><element attribute='attribute'/><element attribute='attribute'/></doc>";
1477 static const char* xml = "<element attrib='bar'><sub>Text</sub></element>";
1480 XMLTest( "Handle, parse element with attribute and nested element", false, doc.Error() );
1483 XMLElement* ele = XMLHandle( doc ).FirstChildElement( "element" ).FirstChild().ToElement();
1484 XMLTest( "Handle, non-const, element is found", true, ele != 0 );
1485 XMLTest( "Handle, non-const, element name matches", "sub", ele->Value() );
1490 XMLElement* ele = docH.FirstChildElement( "noSuchElement" ).FirstChildElement( "element" ).ToElement();
1491 XMLTest( "Handle, non-const, element not found", true, ele == 0 );
1495 const XMLElement* ele = XMLConstHandle( doc ).FirstChildElement( "element" ).FirstChild().ToElement();
1496 XMLTest( "Handle, const, element is found", true, ele != 0 );
1497 XMLTest( "Handle, const, element name matches", "sub", ele->Value() );
1502 const XMLElement* ele = docH.FirstChildElement( "noSuchElement" ).FirstChildElement( "element" ).ToElement();
1503 XMLTest( "Handle, const, element not found", true, ele == 0 );
1572 const char* xml = "<element><_sub/><:sub/><sub:sub/><sub-sub/></element>";
1575 XMLTest( "Non-alpha element lead letter parses.", false, doc.Error() );
1579 const char* xml = "<element _attr1=\"foo\" :attr2=\"bar\"></element>";
1589 XMLTest("Element names with lead digit fail to parse.", true, doc.Error());
1593 const char* xml = "<element/>WOA THIS ISN'T GOING TO PARSE";
1623 const char* xml = "<element>"
1627 "</element>";
1632 const XMLElement* element = doc.FirstChildElement();
1633 for( const XMLElement* parent = element->FirstChildElement();
1655 const char* xml = "<element> </element>";
1664 const char* xml = "<element/>";
1667 XMLTest( "Parse with self-closed element", false, doc.Error() );
1677 XMLTest( "Parse for printing of sub-element", false, doc.Error() );
1682 XMLTest( "Accept of sub-element", true, acceptResult );
1683 XMLTest( "Printing of sub-element", "<child>abc</child>\n", printer.CStr(), false );
1697 static const char* xml_bom_preservation = "\xef\xbb\xbf<element/>\n";
1726 "<elem>element 1</elem>text<!-- comment -->"
1736 "<elem>element 1</elem>text<!-- comment -->"
1744 "<elem>element 1</elem>text<!-- comment -->"
1753 "<elem>element 1</elem>text<!-- comment -->"
1823 //const char* xml = "<element attrA='123456789.123456789' attrB='1.001e9' attrC='1.0e-10' attrD='1001000000.000000' attrE='0.1234567890123456789'/>";
1824 const char* xml = "<element/>";
1827 XMLTest( "Parse self-closed empty element", false, doc.Error() );
1848 "<element attrA-f64=\"123456789.12345679\" attrB-f64=\"1001000000\" attrC-f64=\"1e+20\" attrD-f64=\"0.123456789\" attrA-f32=\"1.2345679e+08\" attrB-f32=\"1.001e+09\" attrC-f32=\"1e+20\" attrD-f32=\"0.12345679\"/>\n",
2184 bool VisitEnter(const XMLElement& element, const XMLAttribute* firstAttribute)
2186 Push('E', element.GetLineNum());
2230 tester.TestParseError("ErrorLine-Element", "\n<root>\n<unclosed \n", XML_ERROR_PARSING_ELEMENT, 3);
2238 "<root a='b' \n" // 2 Element Attribute
2239 "c='d'> d <blah/> \n" // 3 Attribute Text Element
2241 "and second <zxcv/><![CDATA[\n" // 5 Element Text
2252 "<root>\r\n" // 3 Element
2256 "<sub><![CDATA[\n" // 7 Element Text
2259 "]]></sub><sub2/></root>", // 10 Element