Remove IXFA_Parser, cleanup XFA parser code.

The IXFA_Parser only created a CXFA_SimpleParser, the CXFA_DocumentParser is
only created in one spot and doesn't need all the IXFA_Parser methods.

This CL removes IXFA_Parser, instantiates the CXFA_SimpleParser where needed
and cleans up surrounding code.

Review-Url: https://codereview.chromium.org/2123133004
diff --git a/BUILD.gn b/BUILD.gn
index 6fe33bb..f053ad7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1395,7 +1395,6 @@
       "xfa/fxfa/parser/xfa_localevalue.h",
       "xfa/fxfa/parser/xfa_object.h",
       "xfa/fxfa/parser/xfa_object_imp.cpp",
-      "xfa/fxfa/parser/xfa_parser.h",
       "xfa/fxfa/parser/xfa_parser_imp.cpp",
       "xfa/fxfa/parser/xfa_parser_imp.h",
       "xfa/fxfa/parser/xfa_script.h",
diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc
index ebafab3..c93a5c2 100644
--- a/testing/libfuzzer/pdf_xml_fuzzer.cc
+++ b/testing/libfuzzer/pdf_xml_fuzzer.cc
@@ -9,8 +9,8 @@
 
 #include "core/fxcrt/include/fx_basic.h"
 #include "core/fxcrt/include/fx_system.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
+#include "xfa/fxfa/parser/xfa_utils.h"
 
 namespace {
 
diff --git a/xfa.gyp b/xfa.gyp
index 60e120a..f294f39 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -545,7 +545,6 @@
         "xfa/fxfa/parser/xfa_localevalue.h",
         "xfa/fxfa/parser/xfa_object.h",
         "xfa/fxfa/parser/xfa_object_imp.cpp",
-        "xfa/fxfa/parser/xfa_parser.h",
         "xfa/fxfa/parser/xfa_parser_imp.cpp",
         "xfa/fxfa/parser/xfa_parser_imp.h",
         "xfa/fxfa/parser/xfa_script.h",
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index e85d1b7..6320cb9 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -23,7 +23,6 @@
 #include "xfa/fxfa/include/xfa_fontmgr.h"
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_document_serialize.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 
@@ -150,26 +149,29 @@
 
 CXFA_FFDoc::CXFA_FFDoc(CXFA_FFApp* pApp, IXFA_DocProvider* pDocProvider)
     : m_pDocProvider(pDocProvider),
-      m_pDocument(nullptr),
+      m_pDocumentParser(nullptr),
       m_pStream(nullptr),
       m_pApp(pApp),
       m_pNotify(nullptr),
       m_pPDFDoc(nullptr),
       m_dwDocType(XFA_DOCTYPE_Static),
       m_bOwnStream(TRUE) {}
+
 CXFA_FFDoc::~CXFA_FFDoc() {
   CloseDoc();
 }
+
 uint32_t CXFA_FFDoc::GetDocType() {
   return m_dwDocType;
 }
+
 int32_t CXFA_FFDoc::StartLoad() {
-  m_pNotify = new CXFA_FFNotify(this);
-  CXFA_DocumentParser* pDocParser = new CXFA_DocumentParser(m_pNotify);
-  int32_t iStatus = pDocParser->StartParse(m_pStream);
-  m_pDocument = pDocParser->GetDocument();
+  m_pNotify.reset(new CXFA_FFNotify(this));
+  m_pDocumentParser.reset(new CXFA_DocumentParser(m_pNotify.get()));
+  int32_t iStatus = m_pDocumentParser->StartParse(m_pStream);
   return iStatus;
 }
+
 FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
                                      uint8_t*& pByteBuffer,
                                      int32_t& iBufferSize) {
@@ -234,9 +236,10 @@
   }
 }
 int32_t CXFA_FFDoc::DoLoad(IFX_Pause* pPause) {
-  int32_t iStatus = m_pDocument->GetParser()->DoParse(pPause);
+  int32_t iStatus = m_pDocumentParser->DoParse(pPause);
   if (iStatus == XFA_PARSESTATUS_Done && !m_pPDFDoc) {
-    CXFA_Node* pPDFNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Pdf));
+    CXFA_Node* pPDFNode = ToNode(
+        m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Pdf));
     if (!pPDFNode) {
       return XFA_PARSESTATUS_SyntaxErr;
     }
@@ -256,39 +259,40 @@
         pXFAReader = GetDocProvider()->OpenLinkedFile(this, wsHref);
       }
     }
-    if (!pXFAReader) {
+    if (!pXFAReader)
       return XFA_PARSESTATUS_SyntaxErr;
-    }
+
     CPDF_Document* pPDFDocument =
         GetDocProvider()->OpenPDF(this, pXFAReader, TRUE);
     ASSERT(!m_pPDFDoc);
-    if (!OpenDoc(pPDFDocument)) {
+    if (!OpenDoc(pPDFDocument))
       return XFA_PARSESTATUS_SyntaxErr;
-    }
-    IXFA_Parser* pParser = IXFA_Parser::Create(m_pDocument, TRUE);
-    if (!pParser) {
+
+    CXFA_Document* doc = m_pDocumentParser->GetDocument();
+    std::unique_ptr<CXFA_SimpleParser> pParser(
+        new CXFA_SimpleParser(doc, true));
+    if (!pParser)
       return XFA_PARSESTATUS_SyntaxErr;
-    }
+
     CXFA_Node* pRootNode = nullptr;
     if (pParser->StartParse(m_pStream) == XFA_PARSESTATUS_Ready &&
         pParser->DoParse(nullptr) == XFA_PARSESTATUS_Done) {
       pRootNode = pParser->GetRootNode();
     }
-    if (pRootNode && m_pDocument->GetRoot()) {
-      XFA_XPDPacket_MergeRootNode(m_pDocument->GetRoot(), pRootNode);
+    if (pRootNode && doc->GetRoot()) {
+      XFA_XPDPacket_MergeRootNode(doc->GetRoot(), pRootNode);
       iStatus = XFA_PARSESTATUS_Done;
     } else {
       iStatus = XFA_PARSESTATUS_StatusErr;
     }
-    pParser->Release();
-    pParser = nullptr;
   }
   return iStatus;
 }
 void CXFA_FFDoc::StopLoad() {
   m_pApp->GetXFAFontMgr()->LoadDocFonts(this);
   m_dwDocType = XFA_DOCTYPE_Static;
-  CXFA_Node* pConfig = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Config));
+  CXFA_Node* pConfig = ToNode(
+      m_pDocumentParser->GetDocument()->GetXFAObject(XFA_HASHCODE_Config));
   if (!pConfig) {
     return;
   }
@@ -375,23 +379,19 @@
   m_bOwnStream = TRUE;
   return TRUE;
 }
+
 FX_BOOL CXFA_FFDoc::CloseDoc() {
   for (const auto& pair : m_TypeToDocViewMap)
     pair.second->RunDocClose();
 
-  if (m_pDocument)
-    m_pDocument->ClearLayoutData();
+  CXFA_Document* doc =
+      m_pDocumentParser ? m_pDocumentParser->GetDocument() : nullptr;
+  if (doc)
+    doc->ClearLayoutData();
 
   m_TypeToDocViewMap.clear();
 
-  if (m_pDocument) {
-    m_pDocument->GetParser()->Release();
-    m_pDocument = nullptr;
-  }
-
-  delete m_pNotify;
-  m_pNotify = nullptr;
-
+  m_pNotify.reset(nullptr);
   m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this);
 
   if (m_dwDocType != XFA_DOCTYPE_XDP && m_pStream && m_bOwnStream) {
@@ -474,11 +474,11 @@
 bool CXFA_FFDoc::SavePackage(XFA_HashCode code,
                              IFX_FileWrite* pFile,
                              CXFA_ChecksumContext* pCSContext) {
-  std::unique_ptr<CXFA_DataExporter> pExport(
-      new CXFA_DataExporter(m_pDocument));
-  CXFA_Node* pNode = code == XFA_HASHCODE_Xfa
-                         ? m_pDocument->GetRoot()
-                         : ToNode(m_pDocument->GetXFAObject(code));
+  CXFA_Document* doc = m_pDocumentParser->GetDocument();
+
+  std::unique_ptr<CXFA_DataExporter> pExport(new CXFA_DataExporter(doc));
+  CXFA_Node* pNode = code == XFA_HASHCODE_Xfa ? doc->GetRoot()
+                                              : ToNode(doc->GetXFAObject(code));
   if (!pNode)
     return !!pExport->Export(pFile);
 
@@ -492,6 +492,6 @@
 
 FX_BOOL CXFA_FFDoc::ImportData(IFX_FileRead* pStream, FX_BOOL bXDP) {
   std::unique_ptr<CXFA_DataImporter> importer(
-      new CXFA_DataImporter(m_pDocument));
+      new CXFA_DataImporter(m_pDocumentParser->GetDocument()));
   return importer->ImportData(pStream);
 }
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index aaaf07a..b60b7fc 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -15,7 +15,6 @@
 #include "xfa/fxfa/include/xfa_ffdocview.h"
 #include "xfa/fxfa/include/xfa_ffwidget.h"
 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 
 CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView)
@@ -505,8 +504,8 @@
                                                     CXFA_Node* pParent,
                                                     CXFA_Node* pBefore) const {
   CXFA_Document* pXFADoc = GetXFADoc();
-  CXFA_Node* pNewTemplateNode = pXFADoc->GetParser()->GetFactory()->CreateNode(
-      XFA_XDPPACKET_Template, eElement);
+  CXFA_Node* pNewTemplateNode =
+      pXFADoc->CreateNode(XFA_XDPPACKET_Template, eElement);
   if (pParent)
     pParent->InsertChild(pNewTemplateNode, pBefore);
   return pNewTemplateNode;
@@ -545,7 +544,7 @@
 }
 
 CXFA_Document* CXFA_FFWidgetHandler::GetObjFactory() const {
-  return GetXFADoc()->GetParser()->GetFactory();
+  return GetXFADoc();
 }
 
 CXFA_Document* CXFA_FFWidgetHandler::GetXFADoc() const {
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 37d52a9..5813c52 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -17,7 +17,6 @@
 #include "xfa/fxfa/fm2js/xfa_program.h"
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localevalue.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
 
@@ -4915,8 +4914,7 @@
   if (!pDoc)
     return;
 
-  IXFA_AppProvider* pAppProvider =
-      pDoc->GetParser()->GetNotify()->GetAppProvider();
+  IXFA_AppProvider* pAppProvider = pDoc->GetNotify()->GetAppProvider();
   if (!pAppProvider)
     return;
 
@@ -4950,8 +4948,7 @@
   if (!pDoc)
     return;
 
-  IXFA_AppProvider* pAppProvider =
-      pDoc->GetParser()->GetNotify()->GetAppProvider();
+  IXFA_AppProvider* pAppProvider = pDoc->GetNotify()->GetAppProvider();
   if (!pAppProvider)
     return;
 
@@ -5012,8 +5009,7 @@
   if (!pDoc)
     return;
 
-  IXFA_AppProvider* pAppProvider =
-      pDoc->GetParser()->GetNotify()->GetAppProvider();
+  IXFA_AppProvider* pAppProvider = pDoc->GetNotify()->GetAppProvider();
   if (!pAppProvider)
     return;
 
diff --git a/xfa/fxfa/include/xfa_ffdoc.h b/xfa/fxfa/include/xfa_ffdoc.h
index 2ea8298..b8795bc 100644
--- a/xfa/fxfa/include/xfa_ffdoc.h
+++ b/xfa/fxfa/include/xfa_ffdoc.h
@@ -38,7 +38,7 @@
   FX_BOOL OpenDoc(CPDF_Document* pPDFDoc);
   FX_BOOL CloseDoc();
   void SetDocType(uint32_t dwType);
-  CXFA_Document* GetXFADoc() { return m_pDocument; }
+  CXFA_Document* GetXFADoc() { return m_pDocumentParser->GetDocument(); }
   CXFA_FFApp* GetApp() { return m_pApp; }
   CXFA_FFDocView* GetDocView(CXFA_LayoutProcessor* pLayout);
   CXFA_FFDocView* GetDocView();
@@ -54,10 +54,10 @@
 
  protected:
   IXFA_DocProvider* m_pDocProvider;
-  CXFA_Document* m_pDocument;
+  std::unique_ptr<CXFA_DocumentParser> m_pDocumentParser;
   IFX_FileRead* m_pStream;
   CXFA_FFApp* m_pApp;
-  CXFA_FFNotify* m_pNotify;
+  std::unique_ptr<CXFA_FFNotify> m_pNotify;
   CPDF_Document* m_pPDFDoc;
   std::map<uint32_t, FX_IMAGEDIB_AND_DPI> m_HashToDibDpiMap;
   std::map<uint32_t, std::unique_ptr<CXFA_FFDocView>> m_TypeToDocViewMap;
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index 2359283..f236d0e 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -14,7 +14,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h
index ba9979b..328f1bc 100644
--- a/xfa/fxfa/parser/xfa_document.h
+++ b/xfa/fxfa/parser/xfa_document.h
@@ -10,6 +10,7 @@
 #include "xfa/fxfa/include/fxfa.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
+#include "xfa/fxfa/parser/xfa_parser_imp.h"
 
 class CXFA_Document;
 class CXFA_LayoutItem;
@@ -64,7 +65,8 @@
   ~CXFA_Document();
 
   CXFA_Node* GetRoot() const { return m_pRootNode; }
-  CXFA_DocumentParser* GetParser() const { return m_pParser; }
+
+  CFDE_XMLDoc* GetXMLDoc() const;
   CXFA_FFNotify* GetNotify() const;
   void SetRoot(CXFA_Node* pNewRoot);
   CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 4374b7c..dd1fce6 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -15,7 +15,6 @@
 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -531,9 +530,8 @@
     return pExistingNode;
   }
 
-  CXFA_Node* pNewNode = pDocument->GetParser()->GetFactory()->CreateNode(
-      XFA_XDPPACKET_Form, XFA_Element::InstanceManager);
-  ASSERT(pNewNode);
+  CXFA_Node* pNewNode =
+      pDocument->CreateNode(XFA_XDPPACKET_Form, XFA_Element::InstanceManager);
   wsInstMgrNodeName =
       FX_WSTRC(L"_") + pTemplateNode->GetCData(XFA_ATTRIBUTE_Name);
   pNewNode->SetCData(XFA_ATTRIBUTE_Name, wsInstMgrNodeName);
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp
index 7ba85bb..efd48e6 100644
--- a/xfa/fxfa/parser/xfa_document_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_imp.cpp
@@ -12,7 +12,6 @@
 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_datawindow.h"
@@ -74,6 +73,10 @@
   RemovePurgeNode(pNewRoot);
 }
 
+CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const {
+  return m_pParser->GetXMLDoc();
+}
+
 CXFA_FFNotify* CXFA_Document::GetNotify() const {
   return m_pParser->GetNotify();
 }
@@ -219,7 +222,7 @@
 CXFA_LocaleMgr* CXFA_Document::GetLocalMgr() {
   if (!m_pLocalMgr) {
     CFX_WideString wsLanguage;
-    GetParser()->GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
+    GetNotify()->GetAppProvider()->GetLanguage(wsLanguage);
     m_pLocalMgr = new CXFA_LocaleMgr(
         ToNode(GetXFAObject(XFA_HASHCODE_LocaleSet)), wsLanguage);
   }
diff --git a/xfa/fxfa/parser/xfa_document_layout_imp.cpp b/xfa/fxfa/parser/xfa_document_layout_imp.cpp
index 416982b..5bcc449 100644
--- a/xfa/fxfa/parser/xfa_document_layout_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_layout_imp.cpp
@@ -15,7 +15,6 @@
 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index febfa3e..428b470 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -12,7 +12,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
@@ -22,34 +21,31 @@
   ASSERT(m_pDocument);
 }
 FX_BOOL CXFA_DataImporter::ImportData(IFX_FileRead* pDataDocument) {
-  IXFA_Parser* pDataDocumentParser = IXFA_Parser::Create(m_pDocument);
-  if (!pDataDocumentParser) {
+  std::unique_ptr<CXFA_SimpleParser> pDataDocumentParser(
+      new CXFA_SimpleParser(m_pDocument, false));
+  if (!pDataDocumentParser)
     return FALSE;
-  }
+
   if (pDataDocumentParser->StartParse(pDataDocument, XFA_XDPPACKET_Datasets) !=
       XFA_PARSESTATUS_Ready) {
-    pDataDocumentParser->Release();
     return FALSE;
   }
-  if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done) {
-    pDataDocumentParser->Release();
+  if (pDataDocumentParser->DoParse(nullptr) < XFA_PARSESTATUS_Done)
     return FALSE;
-  }
+
   CXFA_Node* pImportDataRoot = pDataDocumentParser->GetRootNode();
-  if (!pImportDataRoot) {
-    pDataDocumentParser->Release();
+  if (!pImportDataRoot)
     return FALSE;
-  }
+
   CXFA_Node* pDataModel =
       ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Datasets));
-  if (!pDataModel) {
-    pDataDocumentParser->Release();
+  if (!pDataModel)
     return FALSE;
-  }
+
   CXFA_Node* pDataNode = ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Data));
-  if (pDataNode) {
+  if (pDataNode)
     pDataModel->RemoveChild(pDataNode);
-  }
+
   if (pImportDataRoot->GetElementType() == XFA_Element::DataModel) {
     while (CXFA_Node* pChildNode =
                pImportDataRoot->GetNodeItem(XFA_NODEITEM_FirstChild)) {
@@ -59,15 +55,14 @@
   } else {
     CFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode();
     CFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
-    if (pParentXMLNode) {
+    if (pParentXMLNode)
       pParentXMLNode->RemoveChildNode(pXMLNode);
-    }
     pDataModel->InsertChild(pImportDataRoot);
   }
   m_pDocument->DoDataRemerge(FALSE);
-  pDataDocumentParser->Release();
   return TRUE;
 }
+
 CFX_WideString XFA_ExportEncodeAttribute(const CFX_WideString& str) {
   CFX_WideTextBuf textBuf;
   int32_t iLen = str.GetLength();
@@ -487,7 +482,7 @@
                                   CXFA_Node* pNode,
                                   uint32_t dwFlag,
                                   const FX_CHAR* pChecksum) {
-  CFDE_XMLDoc* pXMLDoc = m_pDocument->GetParser()->GetXMLDoc();
+  CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc();
   if (pNode->IsModelNode()) {
     switch (pNode->GetPacketID()) {
       case XFA_XDPPACKET_XDP: {
diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
index f85f96d..0b94c64 100644
--- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp
+++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
@@ -14,15 +14,13 @@
 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
 void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
   CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild;
-  CXFA_FFNotify* pNotify =
-      pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetNotify();
   CXFA_LayoutProcessor* pDocLayout =
       pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
   while (pNode) {
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index f5b0920..fb024ab 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -18,7 +18,6 @@
 #include "xfa/fxfa/parser/xfa_layout_pagemgr_new.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
@@ -92,7 +91,6 @@
     return pLayoutItem;
   }
   pLayoutItem = (CXFA_ContentLayoutItem*)pFormNode->GetDocument()
-                    ->GetParser()
                     ->GetNotify()
                     ->OnCreateLayoutItem(pFormNode);
   CXFA_ContentLayoutItem* pPrevLayoutItem =
@@ -122,7 +120,7 @@
       case XFA_ATTRIBUTEENUM_None: {
         FX_BOOL bAnyChanged = FALSE;
         CXFA_Document* pDocument = pFormNode->GetDocument();
-        CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
+        CXFA_FFNotify* pNotify = pDocument->GetNotify();
         FX_FLOAT fCurTopMargin = 0, fCurBottomMargin = 0;
         CXFA_Node* pMarginNode =
             pFormNode->GetFirstChildByClass(XFA_Element::Margin);
@@ -585,7 +583,7 @@
   if (m_pOldLayoutItem->m_pPrev)
     m_pOldLayoutItem->m_pPrev->m_pNext = nullptr;
   CXFA_FFNotify* pNotify =
-      m_pOldLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify();
+      m_pOldLayoutItem->m_pFormNode->GetDocument()->GetNotify();
   CXFA_LayoutProcessor* pDocLayout =
       m_pOldLayoutItem->m_pFormNode->GetDocument()->GetDocLayout();
   CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
@@ -647,8 +645,7 @@
   return bFindRs;
 }
 static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
-  CXFA_FFNotify* pNotify =
-      pGenerateNode->GetDocument()->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = pGenerateNode->GetDocument()->GetNotify();
   CXFA_LayoutProcessor* pDocLayout =
       pGenerateNode->GetDocument()->GetDocLayout();
   CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode> sIterator(
@@ -1233,8 +1230,8 @@
     }
     case XFA_Element::Draw:
     case XFA_Element::Field: {
-      pNode->GetDocument()->GetParser()->GetNotify()->StartFieldDrawLayout(
-          pNode, fWidth, fHeight);
+      pNode->GetDocument()->GetNotify()->StartFieldDrawLayout(pNode, fWidth,
+                                                              fHeight);
       break;
     }
     default:
@@ -2896,7 +2893,7 @@
     return;
   }
   CXFA_Document* pDocument = m_pFormNode->GetDocument();
-  CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = pDocument->GetNotify();
   FX_FLOAT fHeight = -1;
   FX_FLOAT fWidth = -1;
   pNotify->StartFieldDrawLayout(m_pFormNode, fWidth, fHeight);
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 117e1ce..14329c6 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -15,7 +15,6 @@
 #include "xfa/fxfa/parser/xfa_layout_itemlayout.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -282,11 +281,10 @@
     return FALSE;
   }
   CXFA_Document* pDocument = pTemplateNode->GetDocument();
-  CXFA_Document* pObjFactory = pDocument->GetParser()->GetFactory();
   pPageArea = m_pTemplatePageSetRoot->GetChild(0, XFA_Element::PageArea);
   if (!pPageArea) {
-    pPageArea = pObjFactory->CreateNode(m_pTemplatePageSetRoot->GetPacketID(),
-                                        XFA_Element::PageArea);
+    pPageArea = pDocument->CreateNode(m_pTemplatePageSetRoot->GetPacketID(),
+                                      XFA_Element::PageArea);
     if (!pPageArea) {
       return FALSE;
     }
@@ -295,8 +293,8 @@
   }
   CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_Element::ContentArea);
   if (!pContentArea) {
-    pContentArea = pObjFactory->CreateNode(pPageArea->GetPacketID(),
-                                           XFA_Element::ContentArea);
+    pContentArea = pDocument->CreateNode(pPageArea->GetPacketID(),
+                                         XFA_Element::ContentArea);
     if (!pContentArea) {
       return FALSE;
     }
@@ -314,7 +312,7 @@
   CXFA_Node* pMedium = pPageArea->GetChild(0, XFA_Element::Medium);
   if (!pMedium) {
     pMedium =
-        pObjFactory->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium);
+        pDocument->CreateNode(pPageArea->GetPacketID(), XFA_Element::Medium);
     if (!pContentArea) {
       return FALSE;
     }
@@ -455,7 +453,7 @@
   if (wsExpression.IsEmpty()) {
     return TRUE;
   }
-  return pTestScript->GetDocument()->GetParser()->GetNotify()->RunScript(
+  return pTestScript->GetDocument()->GetNotify()->RunScript(
       pTestScript, pTestScript->GetNodeItem(XFA_NODEITEM_Parent,
                                             XFA_ObjectType::ContainerNode));
 }
@@ -536,8 +534,7 @@
     m_nAvailPages++;
     pNewPageAreaLayoutItem = pContainerItem;
   } else {
-    CXFA_FFNotify* pNotify =
-        pNewPageArea->GetDocument()->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = pNewPageArea->GetDocument()->GetNotify();
     CXFA_ContainerLayoutItem* pContainerItem =
         (CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea);
     m_PageArray.Add(pContainerItem);
@@ -1564,8 +1561,7 @@
 }
 CXFA_LayoutItem* CXFA_LayoutPageMgr::FindOrCreateLayoutItem(
     CXFA_Node* pFormNode) {
-  return pFormNode->GetDocument()->GetParser()->GetNotify()->OnCreateLayoutItem(
-      pFormNode);
+  return pFormNode->GetDocument()->GetNotify()->OnCreateLayoutItem(pFormNode);
 }
 
 void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
@@ -1576,7 +1572,7 @@
     if (pCurLayoutItem->IsContentLayoutItem()) {
       if (pCurLayoutItem->m_pFormNode->HasRemovedChildren()) {
         CXFA_FFNotify* pNotify =
-            m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify();
+            m_pTemplatePageSetRoot->GetDocument()->GetNotify();
         CXFA_LayoutProcessor* pDocLayout =
             m_pTemplatePageSetRoot->GetDocument()->GetDocLayout();
         if (pCurLayoutItem->m_pFirstChild) {
@@ -1636,7 +1632,7 @@
 
 void CXFA_LayoutPageMgr::MergePageSetContents() {
   CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument();
-  CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = pDocument->GetNotify();
   CXFA_LayoutProcessor* pDocLayout = pDocument->GetDocLayout();
   CXFA_ContainerLayoutItem* pRootLayout = GetRootLayoutItem();
   {
@@ -1850,8 +1846,7 @@
 void CXFA_LayoutPageMgr::SyncLayoutData() {
   MergePageSetContents();
   LayoutPageSetContents();
-  CXFA_FFNotify* pNotify =
-      m_pTemplatePageSetRoot->GetDocument()->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pTemplatePageSetRoot->GetDocument()->GetNotify();
   int32_t nPageIdx = -1;
   CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem();
   for (; pRootLayoutItem;
diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp
index 507add9..e0e42a8 100644
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ b/xfa/fxfa/parser/xfa_locale.cpp
@@ -11,7 +11,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp
index 570a719..fbc3f15 100644
--- a/xfa/fxfa/parser/xfa_localemgr.cpp
+++ b/xfa/fxfa/parser/xfa_localemgr.cpp
@@ -13,7 +13,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_locale.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp
index c7f78b3..995d021 100644
--- a/xfa/fxfa/parser/xfa_localevalue.cpp
+++ b/xfa/fxfa/parser/xfa_localevalue.cpp
@@ -12,7 +12,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 99198d2..5ada3bd 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -21,7 +21,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -136,8 +135,7 @@
 }
 
 CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
-  CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
-  CXFA_Node* pClone = pFactory->CreateNode(m_ePacket, m_elementType);
+  CXFA_Node* pClone = m_pDocument->CreateNode(m_ePacket, m_elementType);
   if (!pClone)
     return nullptr;
 
@@ -295,10 +293,9 @@
         return 0;
       for (int32_t i = 0; i < iProperties; i++) {
         if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) {
-          CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
           const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID());
           CXFA_Node* pNewNode =
-              pFactory->CreateNode(pPacket, pProperty[i].eName);
+              m_pDocument->CreateNode(pPacket, pProperty[i].eName);
           if (!pNewNode)
             break;
           InsertChild(pNewNode, nullptr);
@@ -314,16 +311,15 @@
 
 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_Element eType,
                                            uint32_t dwFlags) {
-  CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
-  CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eType);
+  CXFA_Node* pNode = m_pDocument->CreateNode(m_ePacket, eType);
   pNode->SetFlag(dwFlags, true);
   return pNode;
 }
 
 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) {
   ASSERT(m_ePacket == XFA_XDPPACKET_Template);
-  CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
-  CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_elementType);
+  CXFA_Node* pClone =
+      m_pDocument->CreateNode(XFA_XDPPACKET_Form, m_elementType);
   if (!pClone)
     return nullptr;
 
@@ -938,8 +934,8 @@
     bIgnoreRoot = !!pArguments->GetInt32(1);
   if (iLength >= 3)
     bOverwrite = !!pArguments->GetInt32(2);
-  std::unique_ptr<IXFA_Parser, ReleaseDeleter<IXFA_Parser>> pParser(
-      IXFA_Parser::Create(m_pDocument));
+  std::unique_ptr<CXFA_SimpleParser> pParser(
+      new CXFA_SimpleParser(m_pDocument, false));
   if (!pParser)
     return;
   CFDE_XMLNode* pXMLNode = nullptr;
@@ -1265,7 +1261,7 @@
   if (!pLayoutPro)
     return;
 
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify)
     return;
 
@@ -1541,7 +1537,7 @@
         break;
     }
     if (!bNew) {
-      CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+      CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
       if (!pNotify) {
         return;
       }
@@ -2105,7 +2101,7 @@
 void CXFA_Node::Script_Field_ExecInitialize(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2192,7 +2188,7 @@
 void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2270,7 +2266,7 @@
 void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       pArguments->GetReturnValue()->SetBoolean(FALSE);
     } else {
@@ -2359,7 +2355,7 @@
 void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2371,7 +2367,7 @@
 void CXFA_Node::Script_ExclGroup_ExecCalculate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2383,7 +2379,7 @@
 void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       pArguments->GetReturnValue()->SetBoolean(FALSE);
     } else {
@@ -2445,7 +2441,7 @@
     }
     if (pManagerNode) {
       pManagerNode->InstanceManager_MoveInstance(iTo, iFrom);
-      CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+      CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
       if (!pNotify) {
         return;
       }
@@ -2520,7 +2516,7 @@
 void CXFA_Node::Script_Subform_ExecInitialize(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2532,7 +2528,7 @@
 void CXFA_Node::Script_Subform_ExecCalculate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -2544,7 +2540,7 @@
 void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       pArguments->GetReturnValue()->SetBoolean(FALSE);
     } else {
@@ -3006,7 +3002,7 @@
   int32_t iFrom = pArguments->GetInt32(0);
   int32_t iTo = pArguments->GetInt32(1);
   InstanceManager_MoveInstance(iTo, iFrom);
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -3041,7 +3037,7 @@
   }
   CXFA_Node* pRemoveInstance = XFA_ScriptInstanceManager_GetItem(this, iIndex);
   XFA_ScriptInstanceManager_RemoveItem(this, pRemoveInstance);
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify) {
     for (int32_t i = iIndex; i < iCount - 1; i++) {
       CXFA_Node* pSubformInstance = XFA_ScriptInstanceManager_GetItem(this, i);
@@ -3092,7 +3088,7 @@
                                        FALSE);
   pArguments->GetReturnValue()->Assign(
       m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance));
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -3133,7 +3129,7 @@
                                        TRUE);
   pArguments->GetReturnValue()->Assign(
       m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance));
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -3194,7 +3190,7 @@
       XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount,
                                            FALSE);
       iCount++;
-      CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+      CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
       if (!pNotify) {
         return 0;
       }
@@ -3286,7 +3282,7 @@
 void CXFA_Node::Script_Form_ExecInitialize(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -3305,7 +3301,7 @@
   int32_t argc = pArguments->GetLength();
   if (argc == 1) {
     const bool bScriptFlags = pArguments->GetInt32(0) != 0;
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -3322,7 +3318,7 @@
 void CXFA_Node::Script_Form_ExecCalculate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return;
     }
@@ -3334,7 +3330,7 @@
 void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) {
   int32_t argc = pArguments->GetLength();
   if (argc == 0) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       pArguments->GetReturnValue()->SetBoolean(FALSE);
     } else {
@@ -4375,11 +4371,11 @@
         return nullptr;
     }
   }
-  CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
+
   const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket);
   CXFA_Node* pNewNode = nullptr;
   for (; iCount <= index; iCount++) {
-    pNewNode = pFactory->CreateNode(pPacket, eProperty);
+    pNewNode = m_pDocument->CreateNode(pPacket, eProperty);
     if (!pNewNode)
       return nullptr;
     InsertChild(pNewNode, nullptr);
@@ -4462,7 +4458,7 @@
   ASSERT(m_pLastChild);
   ASSERT(!m_pLastChild->m_pNext);
   pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify)
     pNotify->OnChildAdded(this);
 
@@ -4509,7 +4505,7 @@
   ASSERT(m_pLastChild);
   ASSERT(!m_pLastChild->m_pNext);
   pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren);
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify)
     pNotify->OnChildAdded(this);
 
@@ -4688,7 +4684,7 @@
 
 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
   if (dwFlag == XFA_NodeFlag_Initialized && bNotify && !IsInitialized()) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (pNotify) {
       pNotify->OnNodeReady(this);
     }
@@ -4708,14 +4704,14 @@
   if (!bNotify)
     return;
 
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (pNotify)
     pNotify->OnChildRemoved();
 }
 
 void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
   if (bNotify && IsInitialized()) {
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (pNotify) {
       pNotify->OnValueChanging(this, eAttr);
     }
@@ -4737,7 +4733,7 @@
       GetEventParaInfoByName(wsEventName);
   if (eventParaInfo) {
     uint32_t validFlags = eventParaInfo->m_validFlags;
-    CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+    CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
     if (!pNotify) {
       return iRet;
     }
diff --git a/xfa/fxfa/parser/xfa_parser.h b/xfa/fxfa/parser/xfa_parser.h
deleted file mode 100644
index 90b4625..0000000
--- a/xfa/fxfa/parser/xfa_parser.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2014 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
-
-#ifndef XFA_FXFA_PARSER_XFA_PARSER_H_
-#define XFA_FXFA_PARSER_XFA_PARSER_H_
-
-#include "xfa/fxfa/parser/xfa_document.h"
-
-class CFDE_XMLDoc;
-
-class IXFA_Parser {
- public:
-  static IXFA_Parser* Create(CXFA_Document* pFactory,
-                             FX_BOOL bDocumentParser = FALSE);
-
-  virtual ~IXFA_Parser() {}
-  virtual void Release() = 0;
-  virtual int32_t StartParse(IFX_FileRead* pStream,
-                             XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) = 0;
-  virtual int32_t DoParse(IFX_Pause* pPause = nullptr) = 0;
-  virtual int32_t ParseXMLData(const CFX_WideString& wsXML,
-                               CFDE_XMLNode*& pXMLNode,
-                               IFX_Pause* pPause = nullptr) = 0;
-  virtual void ConstructXFANode(CXFA_Node* pXFANode,
-                                CFDE_XMLNode* pXMLNode) = 0;
-  virtual CXFA_Document* GetFactory() const = 0;
-  virtual CXFA_Node* GetRootNode() const = 0;
-  virtual CFDE_XMLDoc* GetXMLDoc() const = 0;
-  virtual void CloseParser() = 0;
-};
-
-#endif  // XFA_FXFA_PARSER_XFA_PARSER_H_
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index 2ce1737..e4387a7 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -16,16 +16,11 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
-IXFA_Parser* IXFA_Parser::Create(CXFA_Document* pFactory,
-                                 FX_BOOL bDocumentParser) {
-  return new CXFA_SimpleParser(pFactory, bDocumentParser);
-}
 CXFA_SimpleParser::CXFA_SimpleParser(CXFA_Document* pFactory,
-                                     FX_BOOL bDocumentParser)
+                                     bool bDocumentParser)
     : m_pXMLParser(nullptr),
       m_pXMLDoc(nullptr),
       m_pStream(nullptr),
@@ -34,15 +29,15 @@
       m_pRootNode(nullptr),
       m_ePacketID(XFA_XDPPACKET_UNKNOWN),
       m_bDocumentParser(bDocumentParser) {}
+
 CXFA_SimpleParser::~CXFA_SimpleParser() {
   CloseParser();
 }
-void CXFA_SimpleParser::Release() {
-  delete this;
-}
+
 void CXFA_SimpleParser::SetFactory(CXFA_Document* pFactory) {
   m_pFactory = pFactory;
 }
+
 static CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode(
     CFDE_XMLDoc* pXMLDoc,
     FX_BOOL bVerifyWellFormness = FALSE) {
@@ -194,10 +189,6 @@
   }
 }
 
-CXFA_Document* CXFA_SimpleParser::GetFactory() const {
-  return m_pFactory;
-}
-
 CXFA_Node* CXFA_SimpleParser::GetRootNode() const {
   return m_pRootNode;
 }
@@ -1335,23 +1326,22 @@
 
 CXFA_DocumentParser::CXFA_DocumentParser(CXFA_FFNotify* pNotify)
     : m_nodeParser(nullptr, TRUE), m_pNotify(pNotify), m_pDocument(nullptr) {}
+
 CXFA_DocumentParser::~CXFA_DocumentParser() {
   CloseParser();
 }
 
-void CXFA_DocumentParser::Release() {
-  delete this;
-}
 int32_t CXFA_DocumentParser::StartParse(IFX_FileRead* pStream,
                                         XFA_XDPPACKET ePacketID) {
   CloseParser();
   int32_t nRetStatus = m_nodeParser.StartParse(pStream, ePacketID);
   if (nRetStatus == XFA_PARSESTATUS_Ready) {
-    m_pDocument = new CXFA_Document(this);
-    m_nodeParser.SetFactory(m_pDocument);
+    m_pDocument.reset(new CXFA_Document(this));
+    m_nodeParser.SetFactory(m_pDocument.get());
   }
   return nRetStatus;
 }
+
 int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) {
   int32_t nRetStatus = m_nodeParser.DoParse(pPause);
   if (nRetStatus >= XFA_PARSESTATUS_Done) {
@@ -1360,36 +1350,6 @@
   }
   return nRetStatus;
 }
-int32_t CXFA_DocumentParser::ParseXMLData(const CFX_WideString& wsXML,
-                                          CFDE_XMLNode*& pXMLNode,
-                                          IFX_Pause* pPause) {
-  CloseParser();
-  int32_t nRetStatus = m_nodeParser.ParseXMLData(wsXML, pXMLNode, nullptr);
-  if (nRetStatus == XFA_PARSESTATUS_Done && pXMLNode) {
-    m_pDocument = new CXFA_Document(this);
-    m_nodeParser.SetFactory(m_pDocument);
-  }
-  return nRetStatus;
-}
-void CXFA_DocumentParser::ConstructXFANode(CXFA_Node* pXFANode,
-                                           CFDE_XMLNode* pXMLNode) {
-  if (!pXFANode || !pXMLNode) {
-    return;
-  }
-  m_nodeParser.ConstructXFANode(pXFANode, pXMLNode);
-  CXFA_Node* pRootNode = m_nodeParser.GetRootNode();
-  if (m_pDocument && pRootNode) {
-    m_pDocument->SetRoot(pRootNode);
-  }
-}
-
-CXFA_Document* CXFA_DocumentParser::GetFactory() const {
-  return m_nodeParser.GetFactory();
-}
-
-CXFA_Node* CXFA_DocumentParser::GetRootNode() const {
-  return m_nodeParser.GetRootNode();
-}
 
 CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const {
   return m_nodeParser.GetXMLDoc();
@@ -1400,12 +1360,11 @@
 }
 
 CXFA_Document* CXFA_DocumentParser::GetDocument() const {
-  return m_pDocument;
+  return m_pDocument.get();
 }
 
 void CXFA_DocumentParser::CloseParser() {
-  delete m_pDocument;
-  m_pDocument = nullptr;
+  m_pDocument.reset();
   m_nodeParser.CloseParser();
 }
 
diff --git a/xfa/fxfa/parser/xfa_parser_imp.h b/xfa/fxfa/parser/xfa_parser_imp.h
index df0b31d..c10ab4d 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.h
+++ b/xfa/fxfa/parser/xfa_parser_imp.h
@@ -8,28 +8,28 @@
 #define XFA_FXFA_PARSER_XFA_PARSER_IMP_H_
 
 #include "xfa/fde/xml/fde_xml_imp.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
+#include "xfa/fxfa/include/fxfa_basic.h"
 
+class CXFA_Document;
+class CXFA_FFNotify;
+class CXFA_Node;
 class CXFA_XMLParser;
 
-class CXFA_SimpleParser : public IXFA_Parser {
+class CXFA_SimpleParser {
  public:
-  CXFA_SimpleParser(CXFA_Document* pFactory, FX_BOOL bDocumentParser = FALSE);
-  ~CXFA_SimpleParser() override;
+  CXFA_SimpleParser(CXFA_Document* pFactory, bool bDocumentParser);
+  ~CXFA_SimpleParser();
 
-  // IXFA_Parser
-  void Release() override;
   int32_t StartParse(IFX_FileRead* pStream,
-                     XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override;
-  int32_t DoParse(IFX_Pause* pPause = nullptr) override;
+                     XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP);
+  int32_t DoParse(IFX_Pause* pPause = nullptr);
   int32_t ParseXMLData(const CFX_WideString& wsXML,
                        CFDE_XMLNode*& pXMLNode,
-                       IFX_Pause* pPause = nullptr) override;
-  void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override;
-  CXFA_Document* GetFactory() const override;
-  CXFA_Node* GetRootNode() const override;
-  CFDE_XMLDoc* GetXMLDoc() const override;
-  void CloseParser() override;
+                       IFX_Pause* pPause = nullptr);
+  void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode);
+  CXFA_Node* GetRootNode() const;
+  CFDE_XMLDoc* GetXMLDoc() const;
+  void CloseParser();
 
  protected:
   CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode,
@@ -82,31 +82,24 @@
   friend class CXFA_DocumentParser;
 };
 
-class CXFA_DocumentParser : public IXFA_Parser {
+class CXFA_DocumentParser {
  public:
-  CXFA_DocumentParser(CXFA_FFNotify* pNotify);
-  ~CXFA_DocumentParser() override;
+  explicit CXFA_DocumentParser(CXFA_FFNotify* pNotify);
+  ~CXFA_DocumentParser();
 
-  // IXFA_Parser
-  void Release() override;
   int32_t StartParse(IFX_FileRead* pStream,
-                     XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP) override;
-  int32_t DoParse(IFX_Pause* pPause = nullptr) override;
-  int32_t ParseXMLData(const CFX_WideString& wsXML,
-                       CFDE_XMLNode*& pXMLNode,
-                       IFX_Pause* pPause = nullptr) override;
-  void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode) override;
-  CXFA_Document* GetFactory() const override;
-  CXFA_Node* GetRootNode() const override;
-  CFDE_XMLDoc* GetXMLDoc() const override;
+                     XFA_XDPPACKET ePacketID = XFA_XDPPACKET_XDP);
+  int32_t DoParse(IFX_Pause* pPause = nullptr);
+
+  CFDE_XMLDoc* GetXMLDoc() const;
   CXFA_FFNotify* GetNotify() const;
   CXFA_Document* GetDocument() const;
-  void CloseParser() override;
+  void CloseParser();
 
  protected:
   CXFA_SimpleParser m_nodeParser;
   CXFA_FFNotify* m_pNotify;
-  CXFA_Document* m_pDocument;
+  std::unique_ptr<CXFA_Document> m_pDocument;
 };
 
 class CXFA_XMLParser : public CFDE_XMLParser {
diff --git a/xfa/fxfa/parser/xfa_script_datawindow.cpp b/xfa/fxfa/parser/xfa_script_datawindow.cpp
index c04b5e2..8e37e00 100644
--- a/xfa/fxfa/parser/xfa_script_datawindow.cpp
+++ b/xfa/fxfa/parser/xfa_script_datawindow.cpp
@@ -11,7 +11,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
index 1c54a5d..a08b512 100644
--- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
@@ -14,7 +14,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -212,7 +211,7 @@
   if (!pEventParam) {
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
index 6d659cd..b699c1f 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
@@ -13,7 +13,6 @@
 #include "xfa/fxfa/parser/xfa_document_layout_imp.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -39,10 +38,11 @@
   pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
   pValue->SetString(FX_UTF8Encode(wsValue).AsStringC());
 }
+
 void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue,
                                       FX_BOOL bSetting,
                                       XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -54,10 +54,11 @@
   pNotify->GetAppProvider()->GetAppType(wsAppType);
   pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
 }
+
 void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue,
                                            FX_BOOL bSetting,
                                            XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -69,10 +70,11 @@
   pNotify->GetAppProvider()->GetFoxitAppType(wsAppType);
   pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC());
 }
+
 void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue,
                                                   FX_BOOL bSetting,
                                                   XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -84,10 +86,11 @@
   }
   pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc));
 }
+
 void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue,
                                           FX_BOOL bSetting,
                                           XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -98,10 +101,11 @@
   }
   pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc));
 }
+
 void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue,
                                        FX_BOOL bSetting,
                                        XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -113,10 +117,11 @@
   pNotify->GetAppProvider()->GetLanguage(wsLanguage);
   pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC());
 }
+
 void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue,
                                        FX_BOOL bSetting,
                                        XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -127,10 +132,11 @@
   }
   pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc));
 }
+
 void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue,
                                        FX_BOOL bSetting,
                                        XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -148,7 +154,7 @@
   if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -161,10 +167,11 @@
   pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
   pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC());
 }
+
 void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue,
                                                  FX_BOOL bSetting,
                                                  XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -182,7 +189,7 @@
   if (!m_pDocument->GetScriptContext()->IsRunAtClient()) {
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -194,10 +201,11 @@
   pNotify->GetAppProvider()->GetVariation(wsVariation);
   pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC());
 }
+
 void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue,
                                       FX_BOOL bSetting,
                                       XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -209,10 +217,11 @@
   pNotify->GetAppProvider()->GetVersion(wsVersion);
   pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
 }
+
 void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue,
                                            FX_BOOL bSetting,
                                            XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -224,10 +233,11 @@
   pNotify->GetAppProvider()->GetFoxitVersion(wsVersion);
   pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC());
 }
+
 void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue,
                                    FX_BOOL bSetting,
                                    XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -239,10 +249,11 @@
   pNotify->GetAppProvider()->GetAppName(wsAppName);
   pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC());
 }
+
 void CScript_HostPseudoModel::FoxitName(CFXJSE_Value* pValue,
                                         FX_BOOL bSetting,
                                         XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -263,7 +274,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -284,7 +295,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -331,7 +342,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -360,8 +371,9 @@
   if (pValue)
     pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC());
 }
+
 void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -400,7 +412,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -451,7 +463,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -470,7 +482,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setFocus");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -501,8 +513,9 @@
   }
   pNotify->SetFocusWidgetNode(pNode);
 }
+
 void CScript_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -522,7 +535,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -584,7 +597,7 @@
 }
 void CScript_HostPseudoModel::DocumentCountInBatch(
     CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -602,7 +615,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -667,7 +680,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -685,7 +698,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -701,8 +714,9 @@
   }
   pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP);
 }
+
 void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -715,8 +729,9 @@
   nNewPage = nCurPage - 1;
   pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
 }
+
 void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -734,8 +749,9 @@
   }
   pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage);
 }
+
 void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index 10ca210..95298e4 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -16,7 +16,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_nodehelper.h"
 #include "xfa/fxfa/parser/xfa_script_resolveprocessor.h"
diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
index b8864a6..5b24e3a 100644
--- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp
@@ -17,7 +17,6 @@
 #include "xfa/fxfa/parser/xfa_layout_appadapter.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -31,7 +30,7 @@
 void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue,
                                       FX_BOOL bSetting,
                                       XFA_ATTRIBUTE eAttribute) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -345,7 +344,7 @@
   if (iLength >= 3) {
     bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -365,7 +364,7 @@
 }
 void CScript_LayoutPseudoModel::AbsPageCountInBatch(
     CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -377,7 +376,7 @@
 }
 void CScript_LayoutPseudoModel::SheetCountInBatch(
     CFXJSE_Arguments* pArguments) {
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -414,7 +413,7 @@
   if (!pNode) {
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -446,7 +445,7 @@
   if (!pNode) {
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
index d835bd5..800a805 100644
--- a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp
@@ -11,7 +11,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
 
diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
index ecb4616..dd0f3ea 100644
--- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp
+++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp
@@ -11,7 +11,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
 #include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
index aed23f0..2025cf2 100644
--- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
+++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp
@@ -11,7 +11,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
 #include "xfa/fxfa/parser/xfa_script_nodehelper.h"
diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
index 007820c..c328396 100644
--- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp
@@ -12,7 +12,6 @@
 #include "xfa/fxfa/parser/xfa_document.h"
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_parser_imp.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 #include "xfa/fxfa/parser/xfa_script_imp.h"
@@ -30,7 +29,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -50,7 +49,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -81,7 +80,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
@@ -98,7 +97,7 @@
     ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear");
     return;
   }
-  CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+  CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
   if (!pNotify) {
     return;
   }
diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp
index 5a7c2d1..3e0db48 100644
--- a/xfa/fxfa/parser/xfa_utils_imp.cpp
+++ b/xfa/fxfa/parser/xfa_utils_imp.cpp
@@ -13,7 +13,6 @@
 #include "xfa/fxfa/parser/xfa_localemgr.h"
 #include "xfa/fxfa/parser/xfa_localevalue.h"
 #include "xfa/fxfa/parser/xfa_object.h"
-#include "xfa/fxfa/parser/xfa_parser.h"
 #include "xfa/fxfa/parser/xfa_script.h"
 
 namespace {