| 436 | } |
| 437 | |
| 438 | std::string ErrorMessage::getXMLHeader(std::string productName, int xmlVersion) |
| 439 | { |
| 440 | const auto nameAndVersion = Settings::getNameAndVersion(productName); |
| 441 | productName = nameAndVersion.first; |
| 442 | // TODO: lacks extra version |
| 443 | const std::string version = nameAndVersion.first.empty() ? CppCheck::version() : nameAndVersion.second; |
| 444 | |
| 445 | tinyxml2::XMLPrinter printer; |
| 446 | |
| 447 | // standard xml header |
| 448 | printer.PushDeclaration("xml version=\"1.0\" encoding=\"UTF-8\""); |
| 449 | |
| 450 | // header |
| 451 | printer.OpenElement("results", false); |
| 452 | |
| 453 | printer.PushAttribute("version", xmlVersion); |
| 454 | printer.OpenElement("cppcheck", false); |
| 455 | if (!productName.empty()) |
| 456 | printer.PushAttribute("product-name", productName.c_str()); |
| 457 | printer.PushAttribute("version", version.c_str()); |
| 458 | printer.CloseElement(false); |
| 459 | printer.OpenElement("errors", false); |
| 460 | |
| 461 | return std::string(printer.CStr()) + '>'; |
| 462 | } |
| 463 | |
| 464 | std::string ErrorMessage::getXMLFooter(int xmlVersion) |
| 465 | { |
nothing calls this directly
no test coverage detected