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 #include "core/fxcrt/xml/cfx_xmlnode.h" 8 9 CFX_XMLNode::CFX_XMLNode() = default; 10 11 CFX_XMLNode::~CFX_XMLNode() = default; 12 InsertChildNode(CFX_XMLNode * pNode,int32_t index)13void CFX_XMLNode::InsertChildNode(CFX_XMLNode* pNode, int32_t index) { 14 InsertBefore(pNode, GetNthChild(index)); 15 } 16 GetRoot()17CFX_XMLNode* CFX_XMLNode::GetRoot() { 18 CFX_XMLNode* pParent = this; 19 while (pParent->GetParent()) 20 pParent = pParent->GetParent(); 21 22 return pParent; 23 } 24 EncodeEntities(const WideString & value)25WideString CFX_XMLNode::EncodeEntities(const WideString& value) { 26 WideString ret = value; 27 ret.Replace(L"&", L"&"); 28 ret.Replace(L"<", L"<"); 29 ret.Replace(L">", L">"); 30 ret.Replace(L"\'", L"'"); 31 ret.Replace(L"\"", L"""); 32 return ret; 33 } 34