2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "utils/StringUtils.h"
12 #include "utils/log.h"
16 using namespace XFILE
;
19 * Return true if pElement value is equal value without namespace.
21 * if pElement is <DAV:foo> and value is foo then ValueWithoutNamespace is true
23 bool CDAVCommon::ValueWithoutNamespace(const tinyxml2::XMLNode
* node
, const std::string
& value
)
30 auto* element
= node
->ToElement();
37 std::vector
<std::string
> tag
= StringUtils::Split(element
->Value(), ":", 2);
39 if (tag
.size() == 1 && tag
[0] == value
)
43 else if (tag
.size() == 2 && tag
[1] == value
)
47 else if (tag
.size() > 2)
49 CLog::LogF(LOGERROR
, "Splitting {} failed, size(): {}, value: {}", element
->Value(), tag
.size(),
57 * Search for <status> and return its content
59 std::string
CDAVCommon::GetStatusTag(const tinyxml2::XMLElement
* element
)
61 for (auto* child
= element
->FirstChildElement(); child
; child
= child
->NextSiblingElement())
63 if (ValueWithoutNamespace(child
, "status"))
65 return child
->NoChildren() ? "" : child
->FirstChild()->Value();