From a995d6fd9b862dbd37aebb9c323766bb5d11d389 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 12 Apr 2018 13:15:59 +0000 Subject: Allow retrieving the XML tree from the CFX_XMLDoc This CL allows the CXFA_SimpleParser to retrieve the XML tree from the CFX_XMLDoc. This way, we don't have to keep the doc around and can store the pointer to the tree in the CXFA_SimpleParser. Change-Id: I5b478acbe61e6f1ca5fa04d03133a2b327a0cb1c Reviewed-on: https://pdfium-review.googlesource.com/30210 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- core/fxcrt/xml/cfx_xmldoc.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'core/fxcrt/xml/cfx_xmldoc.cpp') diff --git a/core/fxcrt/xml/cfx_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp index 57be180f9a..c14255d432 100644 --- a/core/fxcrt/xml/cfx_xmldoc.cpp +++ b/core/fxcrt/xml/cfx_xmldoc.cpp @@ -18,20 +18,14 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -CFX_XMLDoc::CFX_XMLDoc(const RetainPtr& pStream) - : m_pRoot(pdfium::MakeUnique()), - m_pXMLParser(pdfium::MakeUnique(m_pRoot.get(), pStream)) { - ASSERT(pStream); - +CFX_XMLDoc::CFX_XMLDoc() : m_pRoot(pdfium::MakeUnique()) { m_pRoot->AppendChild(new CFX_XMLInstruction(L"xml")); } CFX_XMLDoc::~CFX_XMLDoc() {} -int32_t CFX_XMLDoc::Load() { - return m_pXMLParser->Parse(); -} - -void CFX_XMLDoc::CloseXML() { - m_pXMLParser.reset(); +bool CFX_XMLDoc::Load(const RetainPtr& pStream) { + ASSERT(pStream); + CFX_XMLParser parser(m_pRoot.get(), pStream); + return parser.Parse(); } -- cgit v1.2.3