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 --- xfa/fxfa/parser/cxfa_document_parser.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_document_parser.cpp') diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp index 18f9955210..883f684768 100644 --- a/xfa/fxfa/parser/cxfa_document_parser.cpp +++ b/xfa/fxfa/parser/cxfa_document_parser.cpp @@ -20,18 +20,15 @@ CXFA_DocumentParser::~CXFA_DocumentParser() { int32_t CXFA_DocumentParser::Parse(const RetainPtr& pStream, XFA_PacketType ePacketID) { - m_pDocument.reset(); - m_nodeParser.CloseParser(); - m_pDocument = pdfium::MakeUnique(GetNotify()); m_nodeParser.SetFactory(m_pDocument.get()); - int32_t nRetStatus = m_nodeParser.Parse(pStream, ePacketID); - if (nRetStatus == XFA_PARSESTATUS_Done) { - ASSERT(m_pDocument); - m_pDocument->SetRoot(m_nodeParser.GetRootNode()); - } - return nRetStatus; + if (!m_nodeParser.Parse(pStream, ePacketID)) + return XFA_PARSESTATUS_StatusErr; + + ASSERT(m_pDocument); + m_pDocument->SetRoot(m_nodeParser.GetRootNode()); + return XFA_PARSESTATUS_Done; } CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const { -- cgit v1.2.3