----------------------------------------------------------------------------- Get attribute value if it exists. -----------------------------------------------------------------------------
| 544 | // Get attribute value if it exists. |
| 545 | // ----------------------------------------------------------------------------- |
| 546 | const char* SimXMLDocument::attribute(const char* rAttribute) |
| 547 | { |
| 548 | if(m_paNode.empty()) |
| 549 | { |
| 550 | return StringTable->EmptyString(); |
| 551 | } |
| 552 | const S32 iLastElement = m_paNode.size() - 1; |
| 553 | tinyxml2::XMLElement* pNode = m_paNode[iLastElement]->ToElement(); |
| 554 | if(!pNode) |
| 555 | { |
| 556 | return StringTable->EmptyString(); |
| 557 | } |
| 558 | |
| 559 | if(!pNode->Attribute(rAttribute)) |
| 560 | { |
| 561 | return StringTable->EmptyString(); |
| 562 | } |
| 563 | |
| 564 | return pNode->Attribute(rAttribute); |
| 565 | } |
| 566 | |
| 567 | DefineEngineMethod( SimXMLDocument, attribute, const char*, ( const char* attributeName ),, |
| 568 | "@brief Get a string attribute from the current Element on the stack.\n\n" |
no test coverage detected