1 // Copyright 2017 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXCRT_XML_CFX_XMLNODE_H_ 8 #define CORE_FXCRT_XML_CFX_XMLNODE_H_ 9 10 #include "core/fxcrt/fx_stream.h" 11 #include "core/fxcrt/fx_string.h" 12 #include "core/fxcrt/retain_ptr.h" 13 #include "core/fxcrt/tree_node.h" 14 15 class CFX_XMLDocument; 16 17 class CFX_XMLNode : public TreeNode<CFX_XMLNode> { 18 public: 19 enum class Type { 20 kInstruction = 0, 21 kElement, 22 kText, 23 kCharData, 24 }; 25 26 CFX_XMLNode(); 27 ~CFX_XMLNode() override; 28 29 virtual Type GetType() const = 0; 30 virtual CFX_XMLNode* Clone(CFX_XMLDocument* doc) = 0; 31 virtual void Save(const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) = 0; 32 33 CFX_XMLNode* GetRoot(); 34 void InsertChildNode(CFX_XMLNode* pNode, int32_t index); 35 36 protected: 37 WideString EncodeEntities(const WideString& value); 38 }; 39 40 #endif // CORE_FXCRT_XML_CFX_XMLNODE_H_ 41