• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_xmlchardata.h"
8 
9 #include "core/fxcrt/xml/cfx_xmldocument.h"
10 
CFX_XMLCharData(const WideString & wsCData)11 CFX_XMLCharData::CFX_XMLCharData(const WideString& wsCData)
12     : CFX_XMLText(wsCData) {}
13 
14 CFX_XMLCharData::~CFX_XMLCharData() = default;
15 
GetType() const16 CFX_XMLNode::Type CFX_XMLCharData::GetType() const {
17   return Type::kCharData;
18 }
19 
Clone(CFX_XMLDocument * doc)20 CFX_XMLNode* CFX_XMLCharData::Clone(CFX_XMLDocument* doc) {
21   return doc->CreateNode<CFX_XMLCharData>(GetText());
22 }
23 
Save(const RetainPtr<IFX_SeekableWriteStream> & pXMLStream)24 void CFX_XMLCharData::Save(
25     const RetainPtr<IFX_SeekableWriteStream>& pXMLStream) {
26   pXMLStream->WriteString("<![CDATA[");
27   pXMLStream->WriteString(GetText().ToUTF8().AsStringView());
28   pXMLStream->WriteString("]]>");
29 }
30