summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_document_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_document_parser.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index 883f684768..52b5e333c0 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -18,17 +18,22 @@ CXFA_DocumentParser::~CXFA_DocumentParser() {
m_pDocument->ReleaseXMLNodesIfNeeded();
}
-int32_t CXFA_DocumentParser::Parse(const RetainPtr<IFX_SeekableStream>& pStream,
- XFA_PacketType ePacketID) {
+bool 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;
+ // Note, we don't pass the document into the constructor as currently that
+ // triggers different behaviour in the parser.
+ CXFA_SimpleParser parser;
+ parser.SetFactory(m_pDocument.get());
- ASSERT(m_pDocument);
- m_pDocument->SetRoot(m_nodeParser.GetRootNode());
- return XFA_PARSESTATUS_Done;
+ if (!parser.Parse(pStream, ePacketID))
+ return false;
+
+ m_pXMLRoot = parser.GetXMLRoot();
+
+ m_pDocument->SetRoot(parser.GetRootNode());
+ return true;
}
CXFA_FFNotify* CXFA_DocumentParser::GetNotify() const {