1 /* 2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HISTREAMER_XML_ELEMENT_H 17 #define HISTREAMER_XML_ELEMENT_H 18 19 #include <libxml/parser.h> 20 #include <string> 21 22 namespace OHOS { 23 namespace Media { 24 namespace Plugins { 25 namespace HttpPlugin { 26 class XmlElement { 27 public: 28 XmlElement() = delete; 29 explicit XmlElement(xmlNodePtr); 30 ~XmlElement() = default; 31 32 std::shared_ptr<XmlElement> GetParent(); 33 std::shared_ptr<XmlElement> GetChild(); 34 std::shared_ptr<XmlElement> GetSiblingPrev(); 35 std::shared_ptr<XmlElement> GetSiblingNext(); 36 std::shared_ptr<XmlElement> GetLast(); 37 38 xmlNodePtr GetXmlNode(); 39 std::string GetName(); 40 std::string GetText(); 41 std::string GetAttribute(const std::string &attrName); 42 43 private: 44 static constexpr const char *const TAG = "XmlElement"; 45 xmlNodePtr xmlNodePtr_; 46 }; 47 } // namespace HttpPluginLite 48 } // namespace Plugin 49 } // namespace Media 50 } // namespace OHOS 51 #endif // HISTREAMER_XML_ELEMENT_H 52