blob: 883f68476879fa3b794f35ea0d47618865dd46fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "xfa/fxfa/parser/cxfa_document_parser.h"
#include "core/fxcrt/xml/cfx_xmldoc.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify)
: m_pNotify(pNotify) {}
CXFA_DocumentParser::~CXFA_DocumentParser() {
m_pDocument->ReleaseXMLNodesIfNeeded();
}
int32_t CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
XFA_PacketType ePacketID) {
m_pDocument = pdfium::MakeUnique<CXFA_Document>(GetNotify());
m_nodeParser.SetFactory(m_pDocument.get());
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 {
return m_pNotify.Get();
}
CXFA_Document* CXFA_DocumentParser::GetDocument() const {
return m_pDocument.get();
}
|