summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-19 09:19:57 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-19 13:33:07 +0000
commit0d86ecb08e1b2c204333b1f1f6b0b014e5b2971c (patch)
treef816429f8581c16a60773eb23385dc8e55729bac
parent3b71d26f092ebc86ca9177fbbe89d83caa67ae1b (diff)
downloadpdfium-0d86ecb08e1b2c204333b1f1f6b0b014e5b2971c.tar.xz
Move fde XML parser to core
This CL moves the XML parser from FDE into FXCRT and renames to CFX_ from CFDE_. Change-Id: I21a9590bf74daf5517df630d7e7a5de89da99ea4 Reviewed-on: https://pdfium-review.googlesource.com/4312 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
-rw-r--r--BUILD.gn38
-rw-r--r--core/fxcrt/xml/cfx_xmlattributenode.cpp (renamed from xfa/fde/xml/cfde_xmlattributenode.cpp)18
-rw-r--r--core/fxcrt/xml/cfx_xmlattributenode.h (renamed from xfa/fde/xml/cfde_xmlattributenode.h)20
-rw-r--r--core/fxcrt/xml/cfx_xmlchardata.cpp22
-rw-r--r--core/fxcrt/xml/cfx_xmlchardata.h24
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.cpp (renamed from xfa/fde/xml/cfde_xmldoc.cpp)60
-rw-r--r--core/fxcrt/xml/cfx_xmldoc.h (renamed from xfa/fde/xml/cfde_xmldoc.h)26
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.cpp (renamed from xfa/fde/xml/cfde_xmlelement.cpp)54
-rw-r--r--core/fxcrt/xml/cfx_xmlelement.h (renamed from xfa/fde/xml/cfde_xmlelement.h)20
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction.cpp (renamed from xfa/fde/xml/cfde_xmlinstruction.cpp)20
-rw-r--r--core/fxcrt/xml/cfx_xmlinstruction.h (renamed from xfa/fde/xml/cfde_xmlinstruction.h)20
-rw-r--r--core/fxcrt/xml/cfx_xmlnode.cpp (renamed from xfa/fde/xml/cfde_xmlnode.cpp)160
-rw-r--r--core/fxcrt/xml/cfx_xmlnode.h75
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.cpp (renamed from xfa/fde/xml/cfde_xmlparser.cpp)92
-rw-r--r--core/fxcrt/xml/cfx_xmlparser.h (renamed from xfa/fde/xml/cfde_xmlparser.h)30
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser.cpp (renamed from xfa/fde/xml/cfde_xmlsyntaxparser.cpp)120
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser.h (renamed from xfa/fde/xml/cfde_xmlsyntaxparser.h)24
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp (renamed from xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp)314
-rw-r--r--core/fxcrt/xml/cfx_xmltext.cpp22
-rw-r--r--core/fxcrt/xml/cfx_xmltext.h (renamed from xfa/fde/xml/cfde_xmltext.h)20
-rw-r--r--testing/libfuzzer/pdf_xml_fuzzer.cc32
-rw-r--r--xfa/fde/xml/cfde_xmlchardata.cpp22
-rw-r--r--xfa/fde/xml/cfde_xmlchardata.h24
-rw-r--r--xfa/fde/xml/cfde_xmlnode.h75
-rw-r--r--xfa/fde/xml/cfde_xmltext.cpp22
-rw-r--r--xfa/fxfa/app/cxfa_loadercontext.h4
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.cpp59
-rw-r--r--xfa/fxfa/app/cxfa_textlayout.h8
-rw-r--r--xfa/fxfa/app/cxfa_textparser.cpp35
-rw-r--r--xfa/fxfa/app/cxfa_textparser.h18
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp16
-rw-r--r--xfa/fxfa/cxfa_ffdoc.cpp30
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp10
-rw-r--r--xfa/fxfa/parser/cxfa_dataexporter.cpp46
-rw-r--r--xfa/fxfa/parser/cxfa_dataimporter.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_document.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_document.h4
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.h4
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp140
-rw-r--r--xfa/fxfa/parser/cxfa_node.h10
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp287
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.h48
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp28
-rw-r--r--xfa/fxfa/parser/xfa_utils.cpp26
-rw-r--r--xfa/fxfa/parser/xfa_utils.h10
46 files changed, 1070 insertions, 1079 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 00f00ccb63..09a81def7e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -838,6 +838,24 @@ static_library("fxcrt") {
"core/fxcrt/xml/cfx_saxreader.h",
"core/fxcrt/xml/cfx_saxreaderhandler.cpp",
"core/fxcrt/xml/cfx_saxreaderhandler.h",
+ "core/fxcrt/xml/cfx_xmlattributenode.cpp",
+ "core/fxcrt/xml/cfx_xmlattributenode.h",
+ "core/fxcrt/xml/cfx_xmlchardata.cpp",
+ "core/fxcrt/xml/cfx_xmlchardata.h",
+ "core/fxcrt/xml/cfx_xmldoc.cpp",
+ "core/fxcrt/xml/cfx_xmldoc.h",
+ "core/fxcrt/xml/cfx_xmlelement.cpp",
+ "core/fxcrt/xml/cfx_xmlelement.h",
+ "core/fxcrt/xml/cfx_xmlinstruction.cpp",
+ "core/fxcrt/xml/cfx_xmlinstruction.h",
+ "core/fxcrt/xml/cfx_xmlnode.cpp",
+ "core/fxcrt/xml/cfx_xmlnode.h",
+ "core/fxcrt/xml/cfx_xmlparser.cpp",
+ "core/fxcrt/xml/cfx_xmlparser.h",
+ "core/fxcrt/xml/cfx_xmlsyntaxparser.cpp",
+ "core/fxcrt/xml/cfx_xmlsyntaxparser.h",
+ "core/fxcrt/xml/cfx_xmltext.cpp",
+ "core/fxcrt/xml/cfx_xmltext.h",
]
}
}
@@ -1410,24 +1428,6 @@ if (pdf_enable_xfa) {
"xfa/fde/ifde_txtedtdorecord.h",
"xfa/fde/ifde_txtedtengine.h",
"xfa/fde/ifde_txtedtpage.h",
- "xfa/fde/xml/cfde_xmlattributenode.cpp",
- "xfa/fde/xml/cfde_xmlattributenode.h",
- "xfa/fde/xml/cfde_xmlchardata.cpp",
- "xfa/fde/xml/cfde_xmlchardata.h",
- "xfa/fde/xml/cfde_xmldoc.cpp",
- "xfa/fde/xml/cfde_xmldoc.h",
- "xfa/fde/xml/cfde_xmlelement.cpp",
- "xfa/fde/xml/cfde_xmlelement.h",
- "xfa/fde/xml/cfde_xmlinstruction.cpp",
- "xfa/fde/xml/cfde_xmlinstruction.h",
- "xfa/fde/xml/cfde_xmlnode.cpp",
- "xfa/fde/xml/cfde_xmlnode.h",
- "xfa/fde/xml/cfde_xmlparser.cpp",
- "xfa/fde/xml/cfde_xmlparser.h",
- "xfa/fde/xml/cfde_xmlsyntaxparser.cpp",
- "xfa/fde/xml/cfde_xmlsyntaxparser.h",
- "xfa/fde/xml/cfde_xmltext.cpp",
- "xfa/fde/xml/cfde_xmltext.h",
"xfa/fgas/crt/cfgas_formatstring.cpp",
"xfa/fgas/crt/cfgas_formatstring.h",
"xfa/fgas/crt/fgas_language.h",
@@ -1887,12 +1887,12 @@ test("pdfium_unittests") {
if (pdf_enable_xfa) {
sources += [
"core/fxcrt/xml/cfx_saxreader_unittest.cpp",
+ "core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp",
"fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp",
"xfa/fde/cfde_txtedtbuf_unittest.cpp",
"xfa/fde/css/cfde_cssdeclaration_unittest.cpp",
"xfa/fde/css/cfde_cssstylesheet_unittest.cpp",
"xfa/fde/css/cfde_cssvaluelistparser_unittest.cpp",
- "xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp",
"xfa/fgas/layout/cfx_rtfbreak_unittest.cpp",
"xfa/fxfa/app/cxfa_textparser_unittest.cpp",
"xfa/fxfa/cxfa_ffapp_unittest.cpp",
diff --git a/xfa/fde/xml/cfde_xmlattributenode.cpp b/core/fxcrt/xml/cfx_xmlattributenode.cpp
index 0bfa949b12..9c81efc109 100644
--- a/xfa/fde/xml/cfde_xmlattributenode.cpp
+++ b/core/fxcrt/xml/cfx_xmlattributenode.cpp
@@ -4,32 +4,32 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlattributenode.h"
+#include "core/fxcrt/xml/cfx_xmlattributenode.h"
#include "core/fxcrt/fx_ext.h"
-CFDE_XMLAttributeNode::CFDE_XMLAttributeNode(const CFX_WideString& name)
- : CFDE_XMLNode(), name_(name) {
+CFX_XMLAttributeNode::CFX_XMLAttributeNode(const CFX_WideString& name)
+ : CFX_XMLNode(), name_(name) {
ASSERT(name_.GetLength() > 0);
}
-CFDE_XMLAttributeNode::~CFDE_XMLAttributeNode() {}
+CFX_XMLAttributeNode::~CFX_XMLAttributeNode() {}
-bool CFDE_XMLAttributeNode::HasAttribute(const CFX_WideString& name) const {
+bool CFX_XMLAttributeNode::HasAttribute(const CFX_WideString& name) const {
return attrs_.find(name) != attrs_.end();
}
-CFX_WideString CFDE_XMLAttributeNode::GetString(
+CFX_WideString CFX_XMLAttributeNode::GetString(
const CFX_WideString& name) const {
auto it = attrs_.find(name);
return it != attrs_.end() ? it->second : CFX_WideString();
}
-void CFDE_XMLAttributeNode::SetString(const CFX_WideString& name,
- const CFX_WideString& value) {
+void CFX_XMLAttributeNode::SetString(const CFX_WideString& name,
+ const CFX_WideString& value) {
attrs_[name] = value;
}
-void CFDE_XMLAttributeNode::RemoveAttribute(const CFX_WideString& name) {
+void CFX_XMLAttributeNode::RemoveAttribute(const CFX_WideString& name) {
attrs_.erase(name);
}
diff --git a/xfa/fde/xml/cfde_xmlattributenode.h b/core/fxcrt/xml/cfx_xmlattributenode.h
index 07a1ef1610..e8f358eb59 100644
--- a/xfa/fde/xml/cfde_xmlattributenode.h
+++ b/core/fxcrt/xml/cfx_xmlattributenode.h
@@ -4,23 +4,23 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
-#define XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
+#define CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
#include <map>
#include <memory>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
-class CFDE_XMLAttributeNode : public CFDE_XMLNode {
+class CFX_XMLAttributeNode : public CFX_XMLNode {
public:
- explicit CFDE_XMLAttributeNode(const CFX_WideString& name);
- ~CFDE_XMLAttributeNode() override;
+ explicit CFX_XMLAttributeNode(const CFX_WideString& name);
+ ~CFX_XMLAttributeNode() override;
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override = 0;
- std::unique_ptr<CFDE_XMLNode> Clone() override = 0;
+ // CFX_XMLNode
+ FX_XMLNODETYPE GetType() const override = 0;
+ std::unique_ptr<CFX_XMLNode> Clone() override = 0;
CFX_WideString GetName() const { return name_; }
const std::map<CFX_WideString, CFX_WideString>& GetAttributes() const {
@@ -41,4 +41,4 @@ class CFDE_XMLAttributeNode : public CFDE_XMLNode {
std::map<CFX_WideString, CFX_WideString> attrs_;
};
-#endif // XFA_FDE_XML_CFDE_XMLATTRIBUTENODE_H_
+#endif // CORE_FXCRT_XML_CFX_XMLATTRIBUTENODE_H_
diff --git a/core/fxcrt/xml/cfx_xmlchardata.cpp b/core/fxcrt/xml/cfx_xmlchardata.cpp
new file mode 100644
index 0000000000..185bd064df
--- /dev/null
+++ b/core/fxcrt/xml/cfx_xmlchardata.cpp
@@ -0,0 +1,22 @@
+// Copyright 2017 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 "core/fxcrt/xml/cfx_xmlchardata.h"
+
+#include "third_party/base/ptr_util.h"
+
+CFX_XMLCharData::CFX_XMLCharData(const CFX_WideString& wsCData)
+ : CFX_XMLText(wsCData) {}
+
+CFX_XMLCharData::~CFX_XMLCharData() {}
+
+FX_XMLNODETYPE CFX_XMLCharData::GetType() const {
+ return FX_XMLNODE_CharData;
+}
+
+std::unique_ptr<CFX_XMLNode> CFX_XMLCharData::Clone() {
+ return pdfium::MakeUnique<CFX_XMLCharData>(GetText());
+}
diff --git a/core/fxcrt/xml/cfx_xmlchardata.h b/core/fxcrt/xml/cfx_xmlchardata.h
new file mode 100644
index 0000000000..c5c007be90
--- /dev/null
+++ b/core/fxcrt/xml/cfx_xmlchardata.h
@@ -0,0 +1,24 @@
+// Copyright 2017 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 CORE_FXCRT_XML_CFX_XMLCHARDATA_H_
+#define CORE_FXCRT_XML_CFX_XMLCHARDATA_H_
+
+#include <memory>
+
+#include "core/fxcrt/fx_string.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
+
+class CFX_XMLCharData : public CFX_XMLText {
+ public:
+ explicit CFX_XMLCharData(const CFX_WideString& wsCData);
+ ~CFX_XMLCharData() override;
+
+ FX_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFX_XMLNode> Clone() override;
+};
+
+#endif // CORE_FXCRT_XML_CFX_XMLCHARDATA_H_
diff --git a/xfa/fde/xml/cfde_xmldoc.cpp b/core/fxcrt/xml/cfx_xmldoc.cpp
index fa44472098..4f58da91f2 100644
--- a/xfa/fde/xml/cfde_xmldoc.cpp
+++ b/core/fxcrt/xml/cfx_xmldoc.cpp
@@ -4,28 +4,28 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmldoc.h"
+#include "core/fxcrt/xml/cfx_xmldoc.h"
#include <utility>
#include <vector>
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlinstruction.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlinstruction.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
-
-CFDE_XMLDoc::CFDE_XMLDoc()
- : m_iStatus(0), m_pRoot(pdfium::MakeUnique<CFDE_XMLNode>()) {
- m_pRoot->InsertChildNode(new CFDE_XMLInstruction(L"xml"));
+
+CFX_XMLDoc::CFX_XMLDoc()
+ : m_iStatus(0), m_pRoot(pdfium::MakeUnique<CFX_XMLNode>()) {
+ m_pRoot->InsertChildNode(new CFX_XMLInstruction(L"xml"));
}
-CFDE_XMLDoc::~CFDE_XMLDoc() {}
+CFX_XMLDoc::~CFX_XMLDoc() {}
-bool CFDE_XMLDoc::LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser) {
+bool CFX_XMLDoc::LoadXML(std::unique_ptr<CFX_XMLParser> pXMLParser) {
if (!pXMLParser)
return false;
@@ -36,25 +36,25 @@ bool CFDE_XMLDoc::LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser) {
return true;
}
-int32_t CFDE_XMLDoc::DoLoad(IFX_Pause* pPause) {
+int32_t CFX_XMLDoc::DoLoad(IFX_Pause* pPause) {
if (m_iStatus < 100)
m_iStatus = m_pXMLParser->DoParser(pPause);
return m_iStatus;
}
-void CFDE_XMLDoc::CloseXML() {
+void CFX_XMLDoc::CloseXML() {
m_pXMLParser.reset();
}
-void CFDE_XMLDoc::SaveXMLNode(
+void CFX_XMLDoc::SaveXMLNode(
const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
- CFDE_XMLNode* pINode) {
- CFDE_XMLNode* pNode = (CFDE_XMLNode*)pINode;
+ CFX_XMLNode* pINode) {
+ CFX_XMLNode* pNode = (CFX_XMLNode*)pINode;
switch (pNode->GetType()) {
- case FDE_XMLNODE_Instruction: {
+ case FX_XMLNODE_Instruction: {
CFX_WideString ws;
- CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
+ CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
uint16_t wCodePage = pXMLStream->GetCodePage();
@@ -98,13 +98,13 @@ void CFDE_XMLDoc::SaveXMLNode(
}
break;
}
- case FDE_XMLNODE_Element: {
+ case FX_XMLNODE_Element: {
CFX_WideString ws;
ws = L"<";
- ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
pXMLStream->WriteString(ws.AsStringC());
- for (auto it : static_cast<CFDE_XMLElement*>(pNode)->GetAttributes()) {
+ for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
CFX_WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
@@ -122,13 +122,13 @@ void CFDE_XMLDoc::SaveXMLNode(
if (pNode->m_pChild) {
ws = L"\n>";
pXMLStream->WriteString(ws.AsStringC());
- CFDE_XMLNode* pChild = pNode->m_pChild;
+ CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
- SaveXMLNode(pXMLStream, static_cast<CFDE_XMLNode*>(pChild));
+ SaveXMLNode(pXMLStream, static_cast<CFX_XMLNode*>(pChild));
pChild = pChild->m_pNext;
}
ws = L"</";
- ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
ws += L"\n>";
} else {
ws = L"\n/>";
@@ -136,8 +136,8 @@ void CFDE_XMLDoc::SaveXMLNode(
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFDE_XMLText*>(pNode)->GetText();
+ case FX_XMLNODE_Text: {
+ CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&amp;");
ws.Replace(L"<", L"&lt;");
ws.Replace(L">", L"&gt;");
@@ -146,14 +146,14 @@ void CFDE_XMLDoc::SaveXMLNode(
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_CharData: {
+ case FX_XMLNODE_CharData: {
CFX_WideString ws = L"<![CDATA[";
- ws += static_cast<CFDE_XMLCharData*>(pNode)->GetText();
+ ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_Unknown:
+ case FX_XMLNODE_Unknown:
default:
break;
}
diff --git a/xfa/fde/xml/cfde_xmldoc.h b/core/fxcrt/xml/cfx_xmldoc.h
index c9c7db41b7..5966c096ba 100644
--- a/xfa/fde/xml/cfde_xmldoc.h
+++ b/core/fxcrt/xml/cfx_xmldoc.h
@@ -4,34 +4,34 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLDOC_H_
-#define XFA_FDE_XML_CFDE_XMLDOC_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLDOC_H_
+#define CORE_FXCRT_XML_CFX_XMLDOC_H_
#include <memory>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/cfx_seekablestreamproxy.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmlparser.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlparser.h"
-class CFDE_XMLDoc {
+class CFX_XMLDoc {
public:
- CFDE_XMLDoc();
- ~CFDE_XMLDoc();
+ CFX_XMLDoc();
+ ~CFX_XMLDoc();
- bool LoadXML(std::unique_ptr<CFDE_XMLParser> pXMLParser);
+ bool LoadXML(std::unique_ptr<CFX_XMLParser> pXMLParser);
int32_t DoLoad(IFX_Pause* pPause);
void CloseXML();
- CFDE_XMLNode* GetRoot() const { return m_pRoot.get(); }
+ CFX_XMLNode* GetRoot() const { return m_pRoot.get(); }
void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream,
- CFDE_XMLNode* pNode);
+ CFX_XMLNode* pNode);
private:
int32_t m_iStatus;
- std::unique_ptr<CFDE_XMLNode> m_pRoot;
- std::unique_ptr<CFDE_XMLParser> m_pXMLParser;
+ std::unique_ptr<CFX_XMLNode> m_pRoot;
+ std::unique_ptr<CFX_XMLParser> m_pXMLParser;
CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
};
-#endif // XFA_FDE_XML_CFDE_XMLDOC_H_
+#endif // CORE_FXCRT_XML_CFX_XMLDOC_H_
diff --git a/xfa/fde/xml/cfde_xmlelement.cpp b/core/fxcrt/xml/cfx_xmlelement.cpp
index 560cf89280..c6b70e1cc4 100644
--- a/xfa/fde/xml/cfde_xmlelement.cpp
+++ b/core/fxcrt/xml/cfx_xmlelement.cpp
@@ -4,33 +4,33 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
-CFDE_XMLElement::CFDE_XMLElement(const CFX_WideString& wsTag)
- : CFDE_XMLAttributeNode(wsTag) {}
+CFX_XMLElement::CFX_XMLElement(const CFX_WideString& wsTag)
+ : CFX_XMLAttributeNode(wsTag) {}
-CFDE_XMLElement::~CFDE_XMLElement() {}
+CFX_XMLElement::~CFX_XMLElement() {}
-FDE_XMLNODETYPE CFDE_XMLElement::GetType() const {
- return FDE_XMLNODE_Element;
+FX_XMLNODETYPE CFX_XMLElement::GetType() const {
+ return FX_XMLNODE_Element;
}
-std::unique_ptr<CFDE_XMLNode> CFDE_XMLElement::Clone() {
- auto pClone = pdfium::MakeUnique<CFDE_XMLElement>(GetName());
+std::unique_ptr<CFX_XMLNode> CFX_XMLElement::Clone() {
+ auto pClone = pdfium::MakeUnique<CFX_XMLElement>(GetName());
pClone->SetAttributes(GetAttributes());
CFX_WideString wsText;
- CFDE_XMLNode* pChild = m_pChild;
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
switch (pChild->GetType()) {
- case FDE_XMLNODE_Text:
- wsText += static_cast<CFDE_XMLText*>(pChild)->GetText();
+ case FX_XMLNODE_Text:
+ wsText += static_cast<CFX_XMLText*>(pChild)->GetText();
break;
default:
break;
@@ -41,21 +41,21 @@ std::unique_ptr<CFDE_XMLNode> CFDE_XMLElement::Clone() {
return pClone;
}
-CFX_WideString CFDE_XMLElement::GetLocalTagName() const {
+CFX_WideString CFX_XMLElement::GetLocalTagName() const {
FX_STRSIZE iFind = GetName().Find(L':', 0);
if (iFind < 0)
return GetName();
return GetName().Right(GetName().GetLength() - iFind - 1);
}
-CFX_WideString CFDE_XMLElement::GetNamespacePrefix() const {
+CFX_WideString CFX_XMLElement::GetNamespacePrefix() const {
FX_STRSIZE iFind = GetName().Find(L':', 0);
if (iFind < 0)
return CFX_WideString();
return GetName().Left(iFind);
}
-CFX_WideString CFDE_XMLElement::GetNamespaceURI() const {
+CFX_WideString CFX_XMLElement::GetNamespaceURI() const {
CFX_WideString wsAttri(L"xmlns");
CFX_WideString wsPrefix = GetNamespacePrefix();
if (wsPrefix.GetLength() > 0) {
@@ -63,14 +63,14 @@ CFX_WideString CFDE_XMLElement::GetNamespaceURI() const {
wsAttri += wsPrefix;
}
- auto* pNode = static_cast<const CFDE_XMLNode*>(this);
+ auto* pNode = static_cast<const CFX_XMLNode*>(this);
while (pNode) {
- if (pNode->GetType() != FDE_XMLNODE_Element)
+ if (pNode->GetType() != FX_XMLNODE_Element)
break;
- auto* pElement = static_cast<const CFDE_XMLElement*>(pNode);
+ auto* pElement = static_cast<const CFX_XMLElement*>(pNode);
if (!pElement->HasAttribute(wsAttri)) {
- pNode = pNode->GetNodeItem(CFDE_XMLNode::Parent);
+ pNode = pNode->GetNodeItem(CFX_XMLNode::Parent);
continue;
}
return pElement->GetString(wsAttri);
@@ -78,14 +78,14 @@ CFX_WideString CFDE_XMLElement::GetNamespaceURI() const {
return CFX_WideString();
}
-CFX_WideString CFDE_XMLElement::GetTextData() const {
+CFX_WideString CFX_XMLElement::GetTextData() const {
CFX_WideTextBuf buffer;
- CFDE_XMLNode* pChild = m_pChild;
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
switch (pChild->GetType()) {
- case FDE_XMLNODE_Text:
- case FDE_XMLNODE_CharData:
- buffer << static_cast<CFDE_XMLText*>(pChild)->GetText();
+ case FX_XMLNODE_Text:
+ case FX_XMLNODE_CharData:
+ buffer << static_cast<CFX_XMLText*>(pChild)->GetText();
break;
default:
break;
@@ -95,8 +95,8 @@ CFX_WideString CFDE_XMLElement::GetTextData() const {
return buffer.MakeString();
}
-void CFDE_XMLElement::SetTextData(const CFX_WideString& wsText) {
+void CFX_XMLElement::SetTextData(const CFX_WideString& wsText) {
if (wsText.GetLength() < 1)
return;
- InsertChildNode(new CFDE_XMLText(wsText));
+ InsertChildNode(new CFX_XMLText(wsText));
}
diff --git a/xfa/fde/xml/cfde_xmlelement.h b/core/fxcrt/xml/cfx_xmlelement.h
index a891ce8928..20780342af 100644
--- a/xfa/fde/xml/cfde_xmlelement.h
+++ b/core/fxcrt/xml/cfx_xmlelement.h
@@ -4,23 +4,23 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLELEMENT_H_
-#define XFA_FDE_XML_CFDE_XMLELEMENT_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLELEMENT_H_
+#define CORE_FXCRT_XML_CFX_XMLELEMENT_H_
#include <memory>
#include <vector>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlattributenode.h"
+#include "core/fxcrt/xml/cfx_xmlattributenode.h"
-class CFDE_XMLElement : public CFDE_XMLAttributeNode {
+class CFX_XMLElement : public CFX_XMLAttributeNode {
public:
- explicit CFDE_XMLElement(const CFX_WideString& wsTag);
- ~CFDE_XMLElement() override;
+ explicit CFX_XMLElement(const CFX_WideString& wsTag);
+ ~CFX_XMLElement() override;
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- std::unique_ptr<CFDE_XMLNode> Clone() override;
+ // CFX_XMLNode
+ FX_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFX_XMLNode> Clone() override;
CFX_WideString GetLocalTagName() const;
CFX_WideString GetNamespacePrefix() const;
@@ -30,4 +30,4 @@ class CFDE_XMLElement : public CFDE_XMLAttributeNode {
void SetTextData(const CFX_WideString& wsText);
};
-#endif // XFA_FDE_XML_CFDE_XMLELEMENT_H_
+#endif // CORE_FXCRT_XML_CFX_XMLELEMENT_H_
diff --git a/xfa/fde/xml/cfde_xmlinstruction.cpp b/core/fxcrt/xml/cfx_xmlinstruction.cpp
index d289d9e88a..d07b92e3c1 100644
--- a/xfa/fde/xml/cfde_xmlinstruction.cpp
+++ b/core/fxcrt/xml/cfx_xmlinstruction.cpp
@@ -4,33 +4,33 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlinstruction.h"
+#include "core/fxcrt/xml/cfx_xmlinstruction.h"
#include "core/fxcrt/fx_ext.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-CFDE_XMLInstruction::CFDE_XMLInstruction(const CFX_WideString& wsTarget)
- : CFDE_XMLAttributeNode(wsTarget) {}
+CFX_XMLInstruction::CFX_XMLInstruction(const CFX_WideString& wsTarget)
+ : CFX_XMLAttributeNode(wsTarget) {}
-CFDE_XMLInstruction::~CFDE_XMLInstruction() {}
+CFX_XMLInstruction::~CFX_XMLInstruction() {}
-FDE_XMLNODETYPE CFDE_XMLInstruction::GetType() const {
- return FDE_XMLNODE_Instruction;
+FX_XMLNODETYPE CFX_XMLInstruction::GetType() const {
+ return FX_XMLNODE_Instruction;
}
-std::unique_ptr<CFDE_XMLNode> CFDE_XMLInstruction::Clone() {
- auto pClone = pdfium::MakeUnique<CFDE_XMLInstruction>(GetName());
+std::unique_ptr<CFX_XMLNode> CFX_XMLInstruction::Clone() {
+ auto pClone = pdfium::MakeUnique<CFX_XMLInstruction>(GetName());
pClone->SetAttributes(GetAttributes());
pClone->m_TargetData = m_TargetData;
return pClone;
}
-void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) {
+void CFX_XMLInstruction::AppendData(const CFX_WideString& wsData) {
m_TargetData.push_back(wsData);
}
-void CFDE_XMLInstruction::RemoveData(int32_t index) {
+void CFX_XMLInstruction::RemoveData(int32_t index) {
if (pdfium::IndexInBounds(m_TargetData, index))
m_TargetData.erase(m_TargetData.begin() + index);
}
diff --git a/xfa/fde/xml/cfde_xmlinstruction.h b/core/fxcrt/xml/cfx_xmlinstruction.h
index e9c4ad3dfe..99554fc239 100644
--- a/xfa/fde/xml/cfde_xmlinstruction.h
+++ b/core/fxcrt/xml/cfx_xmlinstruction.h
@@ -4,23 +4,23 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
-#define XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_
+#define CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_
#include <memory>
#include <vector>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlattributenode.h"
+#include "core/fxcrt/xml/cfx_xmlattributenode.h"
-class CFDE_XMLInstruction : public CFDE_XMLAttributeNode {
+class CFX_XMLInstruction : public CFX_XMLAttributeNode {
public:
- explicit CFDE_XMLInstruction(const CFX_WideString& wsTarget);
- ~CFDE_XMLInstruction() override;
+ explicit CFX_XMLInstruction(const CFX_WideString& wsTarget);
+ ~CFX_XMLInstruction() override;
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- std::unique_ptr<CFDE_XMLNode> Clone() override;
+ // CFX_XMLNode
+ FX_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFX_XMLNode> Clone() override;
const std::vector<CFX_WideString>& GetTargetData() const {
return m_TargetData;
@@ -32,4 +32,4 @@ class CFDE_XMLInstruction : public CFDE_XMLAttributeNode {
std::vector<CFX_WideString> m_TargetData;
};
-#endif // XFA_FDE_XML_CFDE_XMLINSTRUCTION_H_
+#endif // CORE_FXCRT_XML_CFX_XMLINSTRUCTION_H_
diff --git a/xfa/fde/xml/cfde_xmlnode.cpp b/core/fxcrt/xml/cfx_xmlnode.cpp
index c81de7623a..47b3105f10 100644
--- a/xfa/fde/xml/cfde_xmlnode.cpp
+++ b/core/fxcrt/xml/cfx_xmlnode.cpp
@@ -4,44 +4,44 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include <vector>
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlinstruction.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlinstruction.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
-CFDE_XMLNode::CFDE_XMLNode()
+CFX_XMLNode::CFX_XMLNode()
: m_pParent(nullptr),
m_pChild(nullptr),
m_pPrior(nullptr),
m_pNext(nullptr) {}
-FDE_XMLNODETYPE CFDE_XMLNode::GetType() const {
- return FDE_XMLNODE_Unknown;
+FX_XMLNODETYPE CFX_XMLNode::GetType() const {
+ return FX_XMLNODE_Unknown;
}
-CFDE_XMLNode::~CFDE_XMLNode() {
+CFX_XMLNode::~CFX_XMLNode() {
DeleteChildren();
}
-void CFDE_XMLNode::DeleteChildren() {
- CFDE_XMLNode* pChild = m_pChild;
+void CFX_XMLNode::DeleteChildren() {
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
- CFDE_XMLNode* pNext = pChild->m_pNext;
+ CFX_XMLNode* pNext = pChild->m_pNext;
delete pChild;
pChild = pNext;
}
m_pChild = nullptr;
}
-int32_t CFDE_XMLNode::CountChildNodes() const {
+int32_t CFX_XMLNode::CountChildNodes() const {
int32_t iCount = 0;
- CFDE_XMLNode* pChild = m_pChild;
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
iCount++;
pChild = pChild->m_pNext;
@@ -49,8 +49,8 @@ int32_t CFDE_XMLNode::CountChildNodes() const {
return iCount;
}
-CFDE_XMLNode* CFDE_XMLNode::GetChildNode(int32_t index) const {
- CFDE_XMLNode* pChild = m_pChild;
+CFX_XMLNode* CFX_XMLNode::GetChildNode(int32_t index) const {
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
if (index == 0) {
return pChild;
@@ -61,9 +61,9 @@ CFDE_XMLNode* CFDE_XMLNode::GetChildNode(int32_t index) const {
return nullptr;
}
-int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
+int32_t CFX_XMLNode::GetChildNodeIndex(CFX_XMLNode* pNode) const {
int32_t index = 0;
- CFDE_XMLNode* pChild = m_pChild;
+ CFX_XMLNode* pChild = m_pChild;
while (pChild) {
if (pChild == pNode) {
return index;
@@ -74,9 +74,9 @@ int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const {
return -1;
}
-CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath,
- int32_t iLength,
- bool bQualifiedName) const {
+CFX_XMLNode* CFX_XMLNode::GetPath(const wchar_t* pPath,
+ int32_t iLength,
+ bool bQualifiedName) const {
ASSERT(pPath);
if (iLength < 0) {
iLength = FXSYS_wcslen(pPath);
@@ -97,22 +97,22 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath,
}
}
iLength -= pStart - pPath;
- CFDE_XMLNode* pFind = nullptr;
+ CFX_XMLNode* pFind = nullptr;
if (csPath.GetLength() < 1) {
- pFind = GetNodeItem(CFDE_XMLNode::Root);
+ pFind = GetNodeItem(CFX_XMLNode::Root);
} else if (csPath.Compare(L"..") == 0) {
pFind = m_pParent;
} else if (csPath.Compare(L".") == 0) {
- pFind = (CFDE_XMLNode*)this;
+ pFind = (CFX_XMLNode*)this;
} else {
CFX_WideString wsTag;
- CFDE_XMLNode* pNode = m_pChild;
+ CFX_XMLNode* pNode = m_pChild;
while (pNode) {
- if (pNode->GetType() == FDE_XMLNODE_Element) {
+ if (pNode->GetType() == FX_XMLNODE_Element) {
if (bQualifiedName)
- wsTag = static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ wsTag = static_cast<CFX_XMLElement*>(pNode)->GetName();
else
- wsTag = static_cast<CFDE_XMLElement*>(pNode)->GetLocalTagName();
+ wsTag = static_cast<CFX_XMLElement*>(pNode)->GetLocalTagName();
if (wsTag.Compare(csPath) == 0) {
if (iLength < 1)
@@ -132,7 +132,7 @@ CFDE_XMLNode* CFDE_XMLNode::GetPath(const wchar_t* pPath,
return pFind->GetPath(pStart, iLength, bQualifiedName);
}
-int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
+int32_t CFX_XMLNode::InsertChildNode(CFX_XMLNode* pNode, int32_t index) {
pNode->m_pParent = this;
if (!m_pChild) {
m_pChild = pNode;
@@ -148,7 +148,7 @@ int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
return 0;
}
int32_t iCount = 0;
- CFDE_XMLNode* pFind = m_pChild;
+ CFX_XMLNode* pFind = m_pChild;
while (++iCount != index && pFind->m_pNext) {
pFind = pFind->m_pNext;
}
@@ -160,7 +160,7 @@ int32_t CFDE_XMLNode::InsertChildNode(CFDE_XMLNode* pNode, int32_t index) {
return iCount;
}
-void CFDE_XMLNode::RemoveChildNode(CFDE_XMLNode* pNode) {
+void CFX_XMLNode::RemoveChildNode(CFX_XMLNode* pNode) {
ASSERT(m_pChild && pNode);
if (m_pChild == pNode) {
m_pChild = pNode->m_pNext;
@@ -174,45 +174,45 @@ void CFDE_XMLNode::RemoveChildNode(CFDE_XMLNode* pNode) {
pNode->m_pPrior = nullptr;
}
-CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
+CFX_XMLNode* CFX_XMLNode::GetNodeItem(CFX_XMLNode::NodeItem eItem) const {
switch (eItem) {
- case CFDE_XMLNode::Root: {
- CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
+ case CFX_XMLNode::Root: {
+ CFX_XMLNode* pParent = (CFX_XMLNode*)this;
while (pParent->m_pParent) {
pParent = pParent->m_pParent;
}
return pParent;
}
- case CFDE_XMLNode::Parent:
+ case CFX_XMLNode::Parent:
return m_pParent;
- case CFDE_XMLNode::FirstSibling: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ case CFX_XMLNode::FirstSibling: {
+ CFX_XMLNode* pItem = (CFX_XMLNode*)this;
while (pItem->m_pPrior) {
pItem = pItem->m_pPrior;
}
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ return pItem == (CFX_XMLNode*)this ? nullptr : pItem;
}
- case CFDE_XMLNode::PriorSibling:
+ case CFX_XMLNode::PriorSibling:
return m_pPrior;
- case CFDE_XMLNode::NextSibling:
+ case CFX_XMLNode::NextSibling:
return m_pNext;
- case CFDE_XMLNode::LastSibling: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ case CFX_XMLNode::LastSibling: {
+ CFX_XMLNode* pItem = (CFX_XMLNode*)this;
while (pItem->m_pNext)
pItem = pItem->m_pNext;
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ return pItem == (CFX_XMLNode*)this ? nullptr : pItem;
}
- case CFDE_XMLNode::FirstNeighbor: {
- CFDE_XMLNode* pParent = (CFDE_XMLNode*)this;
+ case CFX_XMLNode::FirstNeighbor: {
+ CFX_XMLNode* pParent = (CFX_XMLNode*)this;
while (pParent->m_pParent)
pParent = pParent->m_pParent;
- return pParent == (CFDE_XMLNode*)this ? nullptr : pParent;
+ return pParent == (CFX_XMLNode*)this ? nullptr : pParent;
}
- case CFDE_XMLNode::PriorNeighbor: {
+ case CFX_XMLNode::PriorNeighbor: {
if (!m_pPrior)
return m_pParent;
- CFDE_XMLNode* pItem = m_pPrior;
+ CFX_XMLNode* pItem = m_pPrior;
while (pItem->m_pChild) {
pItem = pItem->m_pChild;
while (pItem->m_pNext)
@@ -220,12 +220,12 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
}
return pItem;
}
- case CFDE_XMLNode::NextNeighbor: {
+ case CFX_XMLNode::NextNeighbor: {
if (m_pChild)
return m_pChild;
if (m_pNext)
return m_pNext;
- CFDE_XMLNode* pItem = m_pParent;
+ CFX_XMLNode* pItem = m_pParent;
while (pItem) {
if (pItem->m_pNext)
return pItem->m_pNext;
@@ -233,8 +233,8 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
}
return nullptr;
}
- case CFDE_XMLNode::LastNeighbor: {
- CFDE_XMLNode* pItem = (CFDE_XMLNode*)this;
+ case CFX_XMLNode::LastNeighbor: {
+ CFX_XMLNode* pItem = (CFX_XMLNode*)this;
while (pItem->m_pParent) {
pItem = pItem->m_pParent;
}
@@ -245,15 +245,15 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
break;
pItem = pItem->m_pChild;
}
- return pItem == (CFDE_XMLNode*)this ? nullptr : pItem;
+ return pItem == (CFX_XMLNode*)this ? nullptr : pItem;
}
- case CFDE_XMLNode::FirstChild:
+ case CFX_XMLNode::FirstChild:
return m_pChild;
- case CFDE_XMLNode::LastChild: {
+ case CFX_XMLNode::LastChild: {
if (!m_pChild)
return nullptr;
- CFDE_XMLNode* pChild = m_pChild;
+ CFX_XMLNode* pChild = m_pChild;
while (pChild->m_pNext)
pChild = pChild->m_pNext;
return pChild;
@@ -264,9 +264,9 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const {
return nullptr;
}
-int32_t CFDE_XMLNode::GetNodeLevel() const {
+int32_t CFX_XMLNode::GetNodeLevel() const {
int32_t iLevel = 0;
- const CFDE_XMLNode* pItem = m_pParent;
+ const CFX_XMLNode* pItem = m_pParent;
while (pItem) {
iLevel++;
pItem = pItem->m_pParent;
@@ -274,10 +274,10 @@ int32_t CFDE_XMLNode::GetNodeLevel() const {
return iLevel;
}
-bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
- CFDE_XMLNode* pNode) {
+bool CFX_XMLNode::InsertNodeItem(CFX_XMLNode::NodeItem eItem,
+ CFX_XMLNode* pNode) {
switch (eItem) {
- case CFDE_XMLNode::NextSibling: {
+ case CFX_XMLNode::NextSibling: {
pNode->m_pParent = m_pParent;
pNode->m_pNext = m_pNext;
pNode->m_pPrior = this;
@@ -287,7 +287,7 @@ bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
m_pNext = pNode;
return true;
}
- case CFDE_XMLNode::PriorSibling: {
+ case CFX_XMLNode::PriorSibling: {
pNode->m_pParent = m_pParent;
pNode->m_pNext = this;
pNode->m_pPrior = m_pPrior;
@@ -304,10 +304,10 @@ bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem,
}
}
-CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
- CFDE_XMLNode* pNode = nullptr;
+CFX_XMLNode* CFX_XMLNode::RemoveNodeItem(CFX_XMLNode::NodeItem eItem) {
+ CFX_XMLNode* pNode = nullptr;
switch (eItem) {
- case CFDE_XMLNode::NextSibling:
+ case CFX_XMLNode::NextSibling:
if (m_pNext) {
pNode = m_pNext;
m_pNext = pNode->m_pNext;
@@ -325,17 +325,17 @@ CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) {
return pNode;
}
-std::unique_ptr<CFDE_XMLNode> CFDE_XMLNode::Clone() {
+std::unique_ptr<CFX_XMLNode> CFX_XMLNode::Clone() {
return nullptr;
}
-void CFDE_XMLNode::SaveXMLNode(
+void CFX_XMLNode::SaveXMLNode(
const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream) {
- CFDE_XMLNode* pNode = (CFDE_XMLNode*)this;
+ CFX_XMLNode* pNode = (CFX_XMLNode*)this;
switch (pNode->GetType()) {
- case FDE_XMLNODE_Instruction: {
+ case FX_XMLNODE_Instruction: {
CFX_WideString ws;
- CFDE_XMLInstruction* pInstruction = (CFDE_XMLInstruction*)pNode;
+ CFX_XMLInstruction* pInstruction = (CFX_XMLInstruction*)pNode;
if (pInstruction->GetName().CompareNoCase(L"xml") == 0) {
ws = L"<?xml version=\"1.0\" encoding=\"";
uint16_t wCodePage = pXMLStream->GetCodePage();
@@ -379,13 +379,13 @@ void CFDE_XMLNode::SaveXMLNode(
}
break;
}
- case FDE_XMLNODE_Element: {
+ case FX_XMLNODE_Element: {
CFX_WideString ws;
ws = L"<";
- ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
pXMLStream->WriteString(ws.AsStringC());
- for (auto it : static_cast<CFDE_XMLElement*>(pNode)->GetAttributes()) {
+ for (auto it : static_cast<CFX_XMLElement*>(pNode)->GetAttributes()) {
CFX_WideString wsValue = it.second;
wsValue.Replace(L"&", L"&amp;");
wsValue.Replace(L"<", L"&lt;");
@@ -403,13 +403,13 @@ void CFDE_XMLNode::SaveXMLNode(
if (pNode->m_pChild) {
ws = L"\n>";
pXMLStream->WriteString(ws.AsStringC());
- CFDE_XMLNode* pChild = pNode->m_pChild;
+ CFX_XMLNode* pChild = pNode->m_pChild;
while (pChild) {
pChild->SaveXMLNode(pXMLStream);
pChild = pChild->m_pNext;
}
ws = L"</";
- ws += static_cast<CFDE_XMLElement*>(pNode)->GetName();
+ ws += static_cast<CFX_XMLElement*>(pNode)->GetName();
ws += L"\n>";
} else {
ws = L"\n/>";
@@ -417,8 +417,8 @@ void CFDE_XMLNode::SaveXMLNode(
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_Text: {
- CFX_WideString ws = static_cast<CFDE_XMLText*>(pNode)->GetText();
+ case FX_XMLNODE_Text: {
+ CFX_WideString ws = static_cast<CFX_XMLText*>(pNode)->GetText();
ws.Replace(L"&", L"&amp;");
ws.Replace(L"<", L"&lt;");
ws.Replace(L">", L"&gt;");
@@ -427,14 +427,14 @@ void CFDE_XMLNode::SaveXMLNode(
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_CharData: {
+ case FX_XMLNODE_CharData: {
CFX_WideString ws = L"<![CDATA[";
- ws += static_cast<CFDE_XMLCharData*>(pNode)->GetText();
+ ws += static_cast<CFX_XMLCharData*>(pNode)->GetText();
ws += L"]]>";
pXMLStream->WriteString(ws.AsStringC());
break;
}
- case FDE_XMLNODE_Unknown:
+ case FX_XMLNODE_Unknown:
default:
break;
}
diff --git a/core/fxcrt/xml/cfx_xmlnode.h b/core/fxcrt/xml/cfx_xmlnode.h
new file mode 100644
index 0000000000..7cbc2b6642
--- /dev/null
+++ b/core/fxcrt/xml/cfx_xmlnode.h
@@ -0,0 +1,75 @@
+// Copyright 2017 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 CORE_FXCRT_XML_CFX_XMLNODE_H_
+#define CORE_FXCRT_XML_CFX_XMLNODE_H_
+
+#include <memory>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_seekablestreamproxy.h"
+
+enum FX_XMLNODETYPE {
+ FX_XMLNODE_Unknown = 0,
+ FX_XMLNODE_Instruction,
+ FX_XMLNODE_Element,
+ FX_XMLNODE_Text,
+ FX_XMLNODE_CharData,
+};
+
+struct FX_XMLNODE {
+ int32_t iNodeNum;
+ FX_XMLNODETYPE eNodeType;
+};
+
+class CFX_XMLNode {
+ public:
+ enum NodeItem {
+ Root = 0,
+ Parent,
+ FirstSibling,
+ PriorSibling,
+ NextSibling,
+ LastSibling,
+ FirstNeighbor,
+ PriorNeighbor,
+ NextNeighbor,
+ LastNeighbor,
+ FirstChild,
+ LastChild
+ };
+
+ CFX_XMLNode();
+ virtual ~CFX_XMLNode();
+
+ virtual FX_XMLNODETYPE GetType() const;
+ virtual std::unique_ptr<CFX_XMLNode> Clone();
+
+ int32_t CountChildNodes() const;
+ CFX_XMLNode* GetChildNode(int32_t index) const;
+ int32_t GetChildNodeIndex(CFX_XMLNode* pNode) const;
+ int32_t InsertChildNode(CFX_XMLNode* pNode, int32_t index = -1);
+ void RemoveChildNode(CFX_XMLNode* pNode);
+ void DeleteChildren();
+
+ CFX_XMLNode* GetPath(const wchar_t* pPath,
+ int32_t iLength = -1,
+ bool bQualifiedName = true) const;
+
+ int32_t GetNodeLevel() const;
+ CFX_XMLNode* GetNodeItem(CFX_XMLNode::NodeItem eItem) const;
+ bool InsertNodeItem(CFX_XMLNode::NodeItem eItem, CFX_XMLNode* pNode);
+ CFX_XMLNode* RemoveNodeItem(CFX_XMLNode::NodeItem eItem);
+
+ void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream);
+
+ CFX_XMLNode* m_pParent;
+ CFX_XMLNode* m_pChild;
+ CFX_XMLNode* m_pPrior;
+ CFX_XMLNode* m_pNext;
+};
+
+#endif // CORE_FXCRT_XML_CFX_XMLNODE_H_
diff --git a/xfa/fde/xml/cfde_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index c8b300f81d..0e328f33ea 100644
--- a/xfa/fde/xml/cfde_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -4,75 +4,75 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlparser.h"
+#include "core/fxcrt/xml/cfx_xmlparser.h"
#include "core/fxcrt/fx_basic.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlinstruction.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlinstruction.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
-CFDE_XMLParser::CFDE_XMLParser(
- CFDE_XMLNode* pParent,
+CFX_XMLParser::CFX_XMLParser(
+ CFX_XMLNode* pParent,
const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream)
: m_nElementStart(0),
m_dwCheckStatus(0),
m_dwCurrentCheckStatus(0),
m_pStream(pStream),
- m_pParser(pdfium::MakeUnique<CFDE_XMLSyntaxParser>(m_pStream)),
+ m_pParser(pdfium::MakeUnique<CFX_XMLSyntaxParser>(m_pStream)),
m_pParent(pParent),
m_pChild(nullptr),
- m_syntaxParserResult(FDE_XmlSyntaxResult::None) {
+ m_syntaxParserResult(FX_XmlSyntaxResult::None) {
ASSERT(m_pParent && m_pStream);
m_NodeStack.push(m_pParent);
}
-CFDE_XMLParser::~CFDE_XMLParser() {}
+CFX_XMLParser::~CFX_XMLParser() {}
-int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
+int32_t CFX_XMLParser::DoParser(IFX_Pause* pPause) {
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::Error)
return -1;
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::EndOfString)
return 100;
int32_t iCount = 0;
while (true) {
m_syntaxParserResult = m_pParser->DoSyntaxParse();
switch (m_syntaxParserResult) {
- case FDE_XmlSyntaxResult::InstructionOpen:
+ case FX_XmlSyntaxResult::InstructionOpen:
break;
- case FDE_XmlSyntaxResult::InstructionClose:
+ case FX_XmlSyntaxResult::InstructionClose:
if (m_pChild) {
- if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ if (m_pChild->GetType() != FX_XMLNODE_Instruction) {
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
break;
}
}
m_pChild = m_pParent;
break;
- case FDE_XmlSyntaxResult::ElementOpen:
+ case FX_XmlSyntaxResult::ElementOpen:
if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 2)
m_nElementStart = m_pParser->GetCurrentPos() - 1;
break;
- case FDE_XmlSyntaxResult::ElementBreak:
+ case FX_XmlSyntaxResult::ElementBreak:
break;
- case FDE_XmlSyntaxResult::ElementClose:
- if (m_pChild->GetType() != FDE_XMLNODE_Element) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ case FX_XmlSyntaxResult::ElementClose:
+ if (m_pChild->GetType() != FX_XMLNODE_Element) {
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
break;
}
m_ws1 = m_pParser->GetTagName();
- m_ws2 = static_cast<CFDE_XMLElement*>(m_pChild)->GetName();
+ m_ws2 = static_cast<CFX_XMLElement*>(m_pChild)->GetName();
if (m_ws1.GetLength() > 0 && m_ws1 != m_ws2) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
break;
}
if (!m_NodeStack.empty())
m_NodeStack.pop();
if (m_NodeStack.empty()) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
break;
} else if (m_dwCurrentCheckStatus != 0 && m_NodeStack.size() == 2) {
m_nSize[m_dwCurrentCheckStatus - 1] =
@@ -84,26 +84,26 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
m_pChild = m_pParent;
iCount++;
break;
- case FDE_XmlSyntaxResult::TargetName:
+ case FX_XmlSyntaxResult::TargetName:
m_ws1 = m_pParser->GetTargetName();
if (m_ws1 == L"originalXFAVersion" || m_ws1 == L"acrobat") {
- m_pChild = new CFDE_XMLInstruction(m_ws1);
+ m_pChild = new CFX_XMLInstruction(m_ws1);
m_pParent->InsertChildNode(m_pChild);
} else {
m_pChild = nullptr;
}
m_ws1.clear();
break;
- case FDE_XmlSyntaxResult::TagName:
+ case FX_XmlSyntaxResult::TagName:
m_ws1 = m_pParser->GetTagName();
- m_pChild = new CFDE_XMLElement(m_ws1);
+ m_pChild = new CFX_XMLElement(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_NodeStack.push(m_pChild);
m_pParent = m_pChild;
if (m_dwCheckStatus != 0x03 && m_NodeStack.size() == 3) {
CFX_WideString wsTag =
- static_cast<CFDE_XMLElement*>(m_pChild)->GetLocalTagName();
+ static_cast<CFX_XMLElement*>(m_pChild)->GetLocalTagName();
if (wsTag == L"template") {
m_dwCheckStatus |= 0x01;
m_dwCurrentCheckStatus = 0x01;
@@ -117,36 +117,36 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
}
}
break;
- case FDE_XmlSyntaxResult::AttriName:
+ case FX_XmlSyntaxResult::AttriName:
m_ws1 = m_pParser->GetAttributeName();
break;
- case FDE_XmlSyntaxResult::AttriValue:
+ case FX_XmlSyntaxResult::AttriValue:
if (m_pChild) {
m_ws2 = m_pParser->GetAttributeName();
- if (m_pChild->GetType() == FDE_XMLNODE_Element)
- static_cast<CFDE_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2);
+ if (m_pChild->GetType() == FX_XMLNODE_Element)
+ static_cast<CFX_XMLElement*>(m_pChild)->SetString(m_ws1, m_ws2);
}
m_ws1.clear();
break;
- case FDE_XmlSyntaxResult::Text:
+ case FX_XmlSyntaxResult::Text:
m_ws1 = m_pParser->GetTextData();
- m_pChild = new CFDE_XMLText(m_ws1);
+ m_pChild = new CFX_XMLText(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_pChild = m_pParent;
break;
- case FDE_XmlSyntaxResult::CData:
+ case FX_XmlSyntaxResult::CData:
m_ws1 = m_pParser->GetTextData();
- m_pChild = new CFDE_XMLCharData(m_ws1);
+ m_pChild = new CFX_XMLCharData(m_ws1);
m_pParent->InsertChildNode(m_pChild);
m_pChild = m_pParent;
break;
- case FDE_XmlSyntaxResult::TargetData:
+ case FX_XmlSyntaxResult::TargetData:
if (m_pChild) {
- if (m_pChild->GetType() != FDE_XMLNODE_Instruction) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ if (m_pChild->GetType() != FX_XMLNODE_Instruction) {
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
break;
}
- auto* instruction = static_cast<CFDE_XMLInstruction*>(m_pChild);
+ auto* instruction = static_cast<CFX_XMLInstruction*>(m_pChild);
if (!m_ws1.IsEmpty())
instruction->AppendData(m_ws1);
instruction->AppendData(m_pParser->GetTargetData());
@@ -156,15 +156,15 @@ int32_t CFDE_XMLParser::DoParser(IFX_Pause* pPause) {
default:
break;
}
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
- m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::Error ||
+ m_syntaxParserResult == FX_XmlSyntaxResult::EndOfString) {
break;
}
if (pPause && iCount > 500 && pPause->NeedToPauseNow()) {
break;
}
}
- return (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
+ return (m_syntaxParserResult == FX_XmlSyntaxResult::Error ||
m_NodeStack.size() != 1)
? -1
: m_pParser->GetStatus();
diff --git a/xfa/fde/xml/cfde_xmlparser.h b/core/fxcrt/xml/cfx_xmlparser.h
index 14b2127068..dc3cc4c297 100644
--- a/xfa/fde/xml/cfde_xmlparser.h
+++ b/core/fxcrt/xml/cfx_xmlparser.h
@@ -4,26 +4,26 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLPARSER_H_
-#define XFA_FDE_XML_CFDE_XMLPARSER_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLPARSER_H_
+#define CORE_FXCRT_XML_CFX_XMLPARSER_H_
#include <memory>
#include <stack>
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+#include "core/fxcrt/xml/cfx_xmlsyntaxparser.h"
-class CFDE_XMLElement;
-class CFDE_XMLNode;
+class CFX_XMLElement;
+class CFX_XMLNode;
class CFX_SeekableStreamProxy;
class IFX_Pause;
-class CFDE_XMLParser {
+class CFX_XMLParser {
public:
- CFDE_XMLParser(CFDE_XMLNode* pParent,
- const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream);
- ~CFDE_XMLParser();
+ CFX_XMLParser(CFX_XMLNode* pParent,
+ const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream);
+ ~CFX_XMLParser();
int32_t DoParser(IFX_Pause* pPause);
@@ -35,13 +35,13 @@ class CFDE_XMLParser {
private:
CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
- std::unique_ptr<CFDE_XMLSyntaxParser> m_pParser;
- CFDE_XMLNode* m_pParent;
- CFDE_XMLNode* m_pChild;
- std::stack<CFDE_XMLNode*> m_NodeStack;
+ std::unique_ptr<CFX_XMLSyntaxParser> m_pParser;
+ CFX_XMLNode* m_pParent;
+ CFX_XMLNode* m_pChild;
+ std::stack<CFX_XMLNode*> m_NodeStack;
CFX_WideString m_ws1;
CFX_WideString m_ws2;
- FDE_XmlSyntaxResult m_syntaxParserResult;
+ FX_XmlSyntaxResult m_syntaxParserResult;
};
-#endif // XFA_FDE_XML_CFDE_XMLPARSER_H_
+#endif // CORE_FXCRT_XML_CFX_XMLPARSER_H_
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index 5d671bb39a..e7bef71085 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+#include "core/fxcrt/xml/cfx_xmlsyntaxparser.h"
#include <algorithm>
@@ -19,13 +19,13 @@ bool IsXMLWhiteSpace(wchar_t ch) {
return ch == L' ' || ch == 0x0A || ch == 0x0D || ch == 0x09;
}
-struct FDE_XMLNAMECHAR {
+struct FX_XMLNAMECHAR {
uint16_t wStart;
uint16_t wEnd;
bool bStartChar;
};
-const FDE_XMLNAMECHAR g_XMLNameChars[] = {
+const FX_XMLNAMECHAR g_XMLNameChars[] = {
{L'-', L'.', false}, {L'0', L'9', false}, {L':', L':', false},
{L'A', L'Z', true}, {L'_', L'_', true}, {L'a', L'z', true},
{0xB7, 0xB7, false}, {0xC0, 0xD6, true}, {0xD8, 0xF6, true},
@@ -79,7 +79,7 @@ int32_t GetUTF8EncodeLength(const std::vector<wchar_t>& src,
} // namespace
-CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
+CFX_XMLSyntaxParser::CFX_XMLSyntaxParser(
const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream)
: m_pStream(pStream),
m_iXMLPlaneSize(32 * 1024),
@@ -96,14 +96,14 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
m_pCurrentBlock(nullptr),
m_iIndexInBlock(0),
m_iTextDataLength(0),
- m_syntaxParserResult(FDE_XmlSyntaxResult::None),
+ m_syntaxParserResult(FX_XmlSyntaxResult::None),
m_syntaxParserState(FDE_XmlSyntaxState::Text),
m_wQuotationMark(0),
m_iEntityStart(-1) {
ASSERT(pStream);
m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+ m_CurNode.eNodeType = FX_XMLNODE_Unknown;
m_iXMLPlaneSize =
std::min(m_iXMLPlaneSize,
@@ -113,7 +113,7 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
FX_SAFE_STRSIZE alloc_size_safe = m_iXMLPlaneSize;
alloc_size_safe += 1; // For NUL.
if (!alloc_size_safe.IsValid() || alloc_size_safe.ValueOrDie() <= 0) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return;
}
@@ -124,22 +124,22 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser(
m_BlockBuffer.GetAvailableBlock();
}
-CFDE_XMLSyntaxParser::~CFDE_XMLSyntaxParser() {}
+CFX_XMLSyntaxParser::~CFX_XMLSyntaxParser() {}
-FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error ||
- m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString) {
+FX_XmlSyntaxResult CFX_XMLSyntaxParser::DoSyntaxParse() {
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::Error ||
+ m_syntaxParserResult == FX_XmlSyntaxResult::EndOfString) {
return m_syntaxParserResult;
}
int32_t iStreamLength = m_pStream->GetLength();
int32_t iPos;
- FDE_XmlSyntaxResult syntaxParserResult = FDE_XmlSyntaxResult::None;
+ FX_XmlSyntaxResult syntaxParserResult = FX_XmlSyntaxResult::None;
while (true) {
if (m_Start >= m_End) {
if (m_bEOS || m_iCurrentPos >= iStreamLength) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
+ m_syntaxParserResult = FX_XmlSyntaxResult::EndOfString;
return m_syntaxParserResult;
}
m_ParsedChars += m_End;
@@ -152,7 +152,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
iPos = m_pStream->GetPosition();
if (m_iBufferChars < 1) {
m_iCurrentPos = iStreamLength;
- m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString;
+ m_syntaxParserResult = FX_XmlSyntaxResult::EndOfString;
return m_syntaxParserResult;
}
m_iCurrentPos = iPos;
@@ -171,7 +171,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_iEntityStart = -1;
- syntaxParserResult = FDE_XmlSyntaxResult::Text;
+ syntaxParserResult = FX_XmlSyntaxResult::Text;
} else {
m_Start++;
m_syntaxParserState = FDE_XmlSyntaxState::Node;
@@ -191,26 +191,26 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_iLastNodeNum++;
m_iCurrentNodeNum = m_iLastNodeNum;
m_CurNode.iNodeNum = m_iLastNodeNum;
- m_CurNode.eNodeType = FDE_XMLNODE_Instruction;
+ m_CurNode.eNodeType = FX_XMLNODE_Instruction;
m_XMLNodeStack.push(m_CurNode);
m_Start++;
m_syntaxParserState = FDE_XmlSyntaxState::Target;
- syntaxParserResult = FDE_XmlSyntaxResult::InstructionOpen;
+ syntaxParserResult = FX_XmlSyntaxResult::InstructionOpen;
} else {
m_iLastNodeNum++;
m_iCurrentNodeNum = m_iLastNodeNum;
m_CurNode.iNodeNum = m_iLastNodeNum;
- m_CurNode.eNodeType = FDE_XMLNODE_Element;
+ m_CurNode.eNodeType = FX_XMLNODE_Element;
m_XMLNodeStack.push(m_CurNode);
m_syntaxParserState = FDE_XmlSyntaxState::Tag;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementOpen;
+ syntaxParserResult = FX_XmlSyntaxResult::ElementOpen;
}
break;
case FDE_XmlSyntaxState::Target:
case FDE_XmlSyntaxState::Tag:
if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
if (m_BlockBuffer.IsEmpty()) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
@@ -219,9 +219,9 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (m_syntaxParserState != FDE_XmlSyntaxState::Target)
- syntaxParserResult = FDE_XmlSyntaxResult::TagName;
+ syntaxParserResult = FX_XmlSyntaxResult::TagName;
else
- syntaxParserResult = FDE_XmlSyntaxResult::TargetName;
+ syntaxParserResult = FX_XmlSyntaxResult::TargetName;
m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
} else {
@@ -229,7 +229,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -244,12 +244,12 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
if (m_BlockBuffer.IsEmpty()) {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Element) {
+ if (m_CurNode.eNodeType == FX_XMLNODE_Element) {
if (ch == L'>' || ch == L'/') {
m_syntaxParserState = FDE_XmlSyntaxState::BreakElement;
break;
}
- } else if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ } else if (m_CurNode.eNodeType == FX_XMLNODE_Instruction) {
if (ch == L'?') {
m_syntaxParserState = FDE_XmlSyntaxState::CloseInstruction;
m_Start++;
@@ -258,10 +258,10 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
}
break;
}
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
} else {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ if (m_CurNode.eNodeType == FX_XMLNODE_Instruction) {
if (ch != '=' && !IsXMLWhiteSpace(ch)) {
m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
break;
@@ -272,14 +272,14 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_syntaxParserState = FDE_XmlSyntaxState::AttriEqualSign;
- syntaxParserResult = FDE_XmlSyntaxResult::AttriName;
+ syntaxParserResult = FX_XmlSyntaxResult::AttriName;
}
} else {
if (m_iIndexInBlock == m_iAllocStep) {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -293,11 +293,11 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
break;
}
if (ch != L'=') {
- if (m_CurNode.eNodeType == FDE_XMLNODE_Instruction) {
+ if (m_CurNode.eNodeType == FX_XMLNODE_Instruction) {
m_syntaxParserState = FDE_XmlSyntaxState::TargetData;
break;
}
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
} else {
m_syntaxParserState = FDE_XmlSyntaxState::AttriQuotation;
@@ -310,7 +310,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
break;
}
if (ch != L'\"' && ch != L'\'') {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
} else {
m_wQuotationMark = ch;
@@ -321,7 +321,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
case FDE_XmlSyntaxState::AttriValue:
if (ch == m_wQuotationMark) {
if (m_iEntityStart > -1) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_iTextDataLength = m_BlockBuffer.GetDataLength();
@@ -331,7 +331,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_BlockBuffer.GetAvailableBlock();
m_Start++;
m_syntaxParserState = FDE_XmlSyntaxState::AttriName;
- syntaxParserResult = FDE_XmlSyntaxResult::AttriValue;
+ syntaxParserResult = FX_XmlSyntaxResult::AttriValue;
} else {
ParseTextChar(ch);
}
@@ -342,7 +342,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -353,11 +353,11 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_BlockBuffer.Reset(true);
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ syntaxParserResult = FX_XmlSyntaxResult::TargetData;
} else {
m_Start++;
if (m_XMLNodeStack.empty()) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_XMLNodeStack.pop();
@@ -365,24 +365,24 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_CurNode = m_XMLNodeStack.top();
} else {
m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+ m_CurNode.eNodeType = FX_XMLNODE_Unknown;
}
m_iCurrentNodeNum = m_CurNode.iNodeNum;
m_BlockBuffer.Reset(true);
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::InstructionClose;
+ syntaxParserResult = FX_XmlSyntaxResult::InstructionClose;
}
break;
case FDE_XmlSyntaxState::BreakElement:
if (ch == L'>') {
m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementBreak;
+ syntaxParserResult = FX_XmlSyntaxResult::ElementBreak;
} else if (ch == L'/') {
m_syntaxParserState = FDE_XmlSyntaxState::CloseElement;
} else {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_Start++;
@@ -391,7 +391,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
if (!IsXMLNameChar(ch, m_BlockBuffer.IsEmpty())) {
if (ch == L'>') {
if (m_XMLNodeStack.empty()) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
m_XMLNodeStack.pop();
@@ -399,7 +399,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
m_CurNode = m_XMLNodeStack.top();
} else {
m_CurNode.iNodeNum = -1;
- m_CurNode.eNodeType = FDE_XMLNODE_Unknown;
+ m_CurNode.eNodeType = FX_XMLNODE_Unknown;
}
m_iCurrentNodeNum = m_CurNode.iNodeNum;
m_iTextDataLength = m_BlockBuffer.GetDataLength();
@@ -407,9 +407,9 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_syntaxParserState = FDE_XmlSyntaxState::Text;
- syntaxParserResult = FDE_XmlSyntaxResult::ElementClose;
+ syntaxParserResult = FX_XmlSyntaxResult::ElementClose;
} else if (!IsXMLWhiteSpace(ch)) {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
} else {
@@ -417,7 +417,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -442,7 +442,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
case FDE_XmlSyntaxState::SkipCData: {
if (FXSYS_wcsnicmp(m_Buffer.data() + m_Start, L"]]>", 3) == 0) {
m_Start += 3;
- syntaxParserResult = FDE_XmlSyntaxResult::CData;
+ syntaxParserResult = FX_XmlSyntaxResult::CData;
m_iTextDataLength = m_BlockBuffer.GetDataLength();
m_BlockBuffer.Reset(true);
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
@@ -453,7 +453,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock)
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
m_BlockBuffer.IncrementDataLength();
@@ -517,7 +517,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -546,7 +546,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_Start++;
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ syntaxParserResult = FX_XmlSyntaxResult::TargetData;
break;
}
}
@@ -564,9 +564,9 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
m_Start++;
- syntaxParserResult = FDE_XmlSyntaxResult::TargetData;
+ syntaxParserResult = FX_XmlSyntaxResult::TargetData;
} else {
- m_syntaxParserResult = FDE_XmlSyntaxResult::Error;
+ m_syntaxParserResult = FX_XmlSyntaxResult::Error;
return m_syntaxParserResult;
}
} else {
@@ -574,7 +574,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
if (!m_pCurrentBlock) {
- return FDE_XmlSyntaxResult::Error;
+ return FX_XmlSyntaxResult::Error;
}
}
m_pCurrentBlock[m_iIndexInBlock++] = ch;
@@ -585,14 +585,14 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() {
default:
break;
}
- if (syntaxParserResult != FDE_XmlSyntaxResult::None)
+ if (syntaxParserResult != FX_XmlSyntaxResult::None)
return syntaxParserResult;
}
}
- return FDE_XmlSyntaxResult::Text;
+ return FX_XmlSyntaxResult::Text;
}
-int32_t CFDE_XMLSyntaxParser::GetStatus() const {
+int32_t CFX_XMLSyntaxParser::GetStatus() const {
if (!m_pStream)
return -1;
@@ -600,15 +600,15 @@ int32_t CFDE_XMLSyntaxParser::GetStatus() const {
if (iStreamLength < 1)
return 100;
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::Error)
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::Error)
return -1;
- if (m_syntaxParserResult == FDE_XmlSyntaxResult::EndOfString)
+ if (m_syntaxParserResult == FX_XmlSyntaxResult::EndOfString)
return 100;
return m_iParsedBytes * 100 / iStreamLength;
}
-FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const {
+FX_FILESIZE CFX_XMLSyntaxParser::GetCurrentBinaryPos() const {
if (!m_pStream)
return 0;
@@ -616,7 +616,7 @@ FX_FILESIZE CFDE_XMLSyntaxParser::GetCurrentBinaryPos() const {
return m_iParsedBytes + nDstLen;
}
-void CFDE_XMLSyntaxParser::ParseTextChar(wchar_t character) {
+void CFX_XMLSyntaxParser::ParseTextChar(wchar_t character) {
if (m_iIndexInBlock == m_iAllocStep) {
std::tie(m_pCurrentBlock, m_iIndexInBlock) =
m_BlockBuffer.GetAvailableBlock();
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser.h b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
index 8b6c9ac8b5..519f2833d6 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser.h
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
-#define XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLSYNTAXPARSER_H_
+#define CORE_FXCRT_XML_CFX_XMLSYNTAXPARSER_H_
#include <stack>
#include <vector>
@@ -14,9 +14,9 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/cfx_seekablestreamproxy.h"
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
-enum class FDE_XmlSyntaxResult {
+enum class FX_XmlSyntaxResult {
None,
InstructionOpen,
InstructionClose,
@@ -34,13 +34,13 @@ enum class FDE_XmlSyntaxResult {
EndOfString
};
-class CFDE_XMLSyntaxParser {
+class CFX_XMLSyntaxParser {
public:
- explicit CFDE_XMLSyntaxParser(
+ explicit CFX_XMLSyntaxParser(
const CFX_RetainPtr<CFX_SeekableStreamProxy>& pStream);
- ~CFDE_XMLSyntaxParser();
+ ~CFX_XMLSyntaxParser();
- FDE_XmlSyntaxResult DoSyntaxParse();
+ FX_XmlSyntaxResult DoSyntaxParse();
int32_t GetStatus() const;
FX_FILESIZE GetCurrentPos() const { return m_ParsedChars + m_Start; }
@@ -110,14 +110,14 @@ class CFDE_XMLSyntaxParser {
bool m_bEOS;
FX_FILESIZE m_Start; // Start position in m_Buffer
FX_FILESIZE m_End; // End position in m_Buffer
- FDE_XMLNODE m_CurNode;
- std::stack<FDE_XMLNODE> m_XMLNodeStack;
+ FX_XMLNODE m_CurNode;
+ std::stack<FX_XMLNODE> m_XMLNodeStack;
CFX_BlockBuffer m_BlockBuffer;
int32_t m_iAllocStep;
wchar_t* m_pCurrentBlock; // Pointer into CFX_BlockBuffer
int32_t m_iIndexInBlock;
int32_t m_iTextDataLength;
- FDE_XmlSyntaxResult m_syntaxParserResult;
+ FX_XmlSyntaxResult m_syntaxParserResult;
FDE_XmlSyntaxState m_syntaxParserState;
wchar_t m_wQuotationMark;
int32_t m_iEntityStart;
@@ -125,4 +125,4 @@ class CFDE_XMLSyntaxParser {
wchar_t m_SkipChar;
};
-#endif // XFA_FDE_XML_CFDE_XMLSYNTAXPARSER_H_
+#endif // CORE_FXCRT_XML_CFX_XMLSYNTAXPARSER_H_
diff --git a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp
index 45ad3bb2f0..60c0d34655 100644
--- a/xfa/fde/xml/cfde_xmlsyntaxparser_unittest.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser_unittest.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xfa/fde/xml/cfde_xmlsyntaxparser.h"
+#include "core/fxcrt/xml/cfx_xmlsyntaxparser.h"
#include <memory>
@@ -11,9 +11,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/test_support.h"
-class CFDE_XMLSyntaxParserTest : public pdfium::FPDF_Test {};
+class CFX_XMLSyntaxParserTest : public pdfium::FPDF_Test {};
-TEST_F(CFDE_XMLSyntaxParserTest, CData) {
+TEST_F(CFX_XMLSyntaxParserTest, CData) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![CDATA[\n"
@@ -33,33 +33,33 @@ TEST_F(CFDE_XMLSyntaxParserTest, CData) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::CData, parser.DoSyntaxParse());
ASSERT_EQ(cdata, parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
+TEST_F(CFX_XMLSyntaxParserTest, CDataWithInnerScript) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![CDATA[\n"
@@ -81,33 +81,33 @@ TEST_F(CFDE_XMLSyntaxParserTest, CDataWithInnerScript) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::CData, parser.DoSyntaxParse());
ASSERT_EQ(cdata, parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
+TEST_F(CFX_XMLSyntaxParserTest, ArrowBangArrow) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!>\n"
@@ -118,31 +118,31 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangArrow) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
+TEST_F(CFX_XMLSyntaxParserTest, ArrowBangBracketArrow) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![>\n"
@@ -153,26 +153,26 @@ TEST_F(CFDE_XMLSyntaxParserTest, ArrowBangBracketArrow) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
+TEST_F(CFX_XMLSyntaxParserTest, IncompleteCData) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![CDATA>\n"
@@ -183,26 +183,26 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncompleteCData) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
+TEST_F(CFX_XMLSyntaxParserTest, UnClosedCData) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![CDATA[\n"
@@ -213,26 +213,26 @@ TEST_F(CFDE_XMLSyntaxParserTest, UnClosedCData) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
// Parser walks to end of input.
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
+TEST_F(CFX_XMLSyntaxParserTest, EmptyCData) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <![CDATA[]]>\n"
@@ -243,33 +243,33 @@ TEST_F(CFDE_XMLSyntaxParserTest, EmptyCData) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::CData, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::CData, parser.DoSyntaxParse());
ASSERT_EQ(L"", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
+TEST_F(CFX_XMLSyntaxParserTest, Comment) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!-- A Comment -->\n"
@@ -280,30 +280,30 @@ TEST_F(CFDE_XMLSyntaxParserTest, Comment) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
+TEST_F(CFX_XMLSyntaxParserTest, IncorrectCommentStart) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!- A Comment -->\n"
@@ -314,30 +314,30 @@ TEST_F(CFDE_XMLSyntaxParserTest, IncorrectCommentStart) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
+TEST_F(CFX_XMLSyntaxParserTest, CommentEmpty) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!---->\n"
@@ -348,30 +348,30 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentEmpty) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
+TEST_F(CFX_XMLSyntaxParserTest, CommentThreeDash) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!--->\n"
@@ -382,24 +382,24 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentThreeDash) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
+TEST_F(CFX_XMLSyntaxParserTest, CommentTwoDash) {
const char* input =
"<script contentType=\"application/x-javascript\">\n"
" <!-->\n"
@@ -410,24 +410,24 @@ TEST_F(CFDE_XMLSyntaxParserTest, CommentTwoDash) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"\n ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
+TEST_F(CFX_XMLSyntaxParserTest, Entities) {
const char* input =
"<script contentType=\"application/x-javascript\">"
"&#66;"
@@ -442,27 +442,27 @@ TEST_F(CFDE_XMLSyntaxParserTest, Entities) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L"BTH\xab48", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
+TEST_F(CFX_XMLSyntaxParserTest, EntityOverflowHex) {
const char* input =
"<script contentType=\"application/x-javascript\">"
"&#xaDBDFFFFF;"
@@ -474,27 +474,27 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowHex) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L" ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
-TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
+TEST_F(CFX_XMLSyntaxParserTest, EntityOverflowDecimal) {
const char* input =
"<script contentType=\"application/x-javascript\">"
"&#2914910205;"
@@ -506,22 +506,22 @@ TEST_F(CFDE_XMLSyntaxParserTest, EntityOverflowDecimal) {
reinterpret_cast<uint8_t*>(const_cast<char*>(input)), strlen(input));
stream->SetCodePage(FX_CODEPAGE_UTF8);
- CFDE_XMLSyntaxParser parser(stream);
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
+ CFX_XMLSyntaxParser parser(stream);
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementOpen, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::TagName, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriName, parser.DoSyntaxParse());
ASSERT_EQ(L"contentType", parser.GetAttributeName());
- ASSERT_EQ(FDE_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::AttriValue, parser.DoSyntaxParse());
ASSERT_EQ(L"application/x-javascript", parser.GetAttributeValue());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
- ASSERT_EQ(FDE_XmlSyntaxResult::Text, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementBreak, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::Text, parser.DoSyntaxParse());
ASSERT_EQ(L" ", parser.GetTextData());
- ASSERT_EQ(FDE_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::ElementClose, parser.DoSyntaxParse());
ASSERT_EQ(L"script", parser.GetTagName());
- ASSERT_EQ(FDE_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
+ ASSERT_EQ(FX_XmlSyntaxResult::EndOfString, parser.DoSyntaxParse());
}
diff --git a/core/fxcrt/xml/cfx_xmltext.cpp b/core/fxcrt/xml/cfx_xmltext.cpp
new file mode 100644
index 0000000000..4c41fcd9f8
--- /dev/null
+++ b/core/fxcrt/xml/cfx_xmltext.cpp
@@ -0,0 +1,22 @@
+// Copyright 2017 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 "core/fxcrt/xml/cfx_xmltext.h"
+
+#include "third_party/base/ptr_util.h"
+
+CFX_XMLText::CFX_XMLText(const CFX_WideString& wsText)
+ : CFX_XMLNode(), m_wsText(wsText) {}
+
+CFX_XMLText::~CFX_XMLText() {}
+
+FX_XMLNODETYPE CFX_XMLText::GetType() const {
+ return FX_XMLNODE_Text;
+}
+
+std::unique_ptr<CFX_XMLNode> CFX_XMLText::Clone() {
+ return pdfium::MakeUnique<CFX_XMLText>(m_wsText);
+}
diff --git a/xfa/fde/xml/cfde_xmltext.h b/core/fxcrt/xml/cfx_xmltext.h
index 6987c49980..20fb858302 100644
--- a/xfa/fde/xml/cfde_xmltext.h
+++ b/core/fxcrt/xml/cfx_xmltext.h
@@ -4,22 +4,22 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FDE_XML_CFDE_XMLTEXT_H_
-#define XFA_FDE_XML_CFDE_XMLTEXT_H_
+#ifndef CORE_FXCRT_XML_CFX_XMLTEXT_H_
+#define CORE_FXCRT_XML_CFX_XMLTEXT_H_
#include <memory>
#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
-class CFDE_XMLText : public CFDE_XMLNode {
+class CFX_XMLText : public CFX_XMLNode {
public:
- explicit CFDE_XMLText(const CFX_WideString& wsText);
- ~CFDE_XMLText() override;
+ explicit CFX_XMLText(const CFX_WideString& wsText);
+ ~CFX_XMLText() override;
- // CFDE_XMLNode
- FDE_XMLNODETYPE GetType() const override;
- std::unique_ptr<CFDE_XMLNode> Clone() override;
+ // CFX_XMLNode
+ FX_XMLNODETYPE GetType() const override;
+ std::unique_ptr<CFX_XMLNode> Clone() override;
CFX_WideString GetText() const { return m_wsText; }
void SetText(const CFX_WideString& wsText) { m_wsText = wsText; }
@@ -28,4 +28,4 @@ class CFDE_XMLText : public CFDE_XMLNode {
CFX_WideString m_wsText;
};
-#endif // XFA_FDE_XML_CFDE_XMLTEXT_H_
+#endif // CORE_FXCRT_XML_CFX_XMLTEXT_H_
diff --git a/testing/libfuzzer/pdf_xml_fuzzer.cc b/testing/libfuzzer/pdf_xml_fuzzer.cc
index 92b61bcd65..be77016b60 100644
--- a/testing/libfuzzer/pdf_xml_fuzzer.cc
+++ b/testing/libfuzzer/pdf_xml_fuzzer.cc
@@ -10,30 +10,30 @@
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_safe_types.h"
#include "core/fxcrt/fx_system.h"
+#include "core/fxcrt/xml/cfx_xmldoc.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlparser.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmldoc.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmlparser.h"
namespace {
-CFDE_XMLNode* XFA_FDEExtension_GetDocumentNode(
- CFDE_XMLDoc* pXMLDoc,
+CFX_XMLNode* XFA_FDEExtension_GetDocumentNode(
+ CFX_XMLDoc* pXMLDoc,
bool bVerifyWellFormness = false) {
if (!pXMLDoc) {
return nullptr;
}
- CFDE_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot();
- for (CFDE_XMLNode* pXMLNode =
- pXMLFakeRoot->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
+ CFX_XMLNode* pXMLFakeRoot = pXMLDoc->GetRoot();
+ for (CFX_XMLNode* pXMLNode =
+ pXMLFakeRoot->GetNodeItem(CFX_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() == FX_XMLNODE_Element) {
if (bVerifyWellFormness) {
- for (CFDE_XMLNode* pNextNode =
- pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling);
+ for (CFX_XMLNode* pNextNode =
+ pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling);
pNextNode;
- pNextNode = pNextNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pNextNode->GetType() == FDE_XMLNODE_Element) {
+ pNextNode = pNextNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pNextNode->GetType() == FX_XMLNODE_Element) {
return nullptr;
}
}
@@ -54,8 +54,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
CFX_RetainPtr<CFX_SeekableStreamProxy> stream =
pdfium::MakeRetain<CFX_SeekableStreamProxy>(const_cast<uint8_t*>(data),
size);
- auto doc = pdfium::MakeUnique<CFDE_XMLDoc>();
- if (!doc->LoadXML(pdfium::MakeUnique<CFDE_XMLParser>(doc->GetRoot(), stream)))
+ auto doc = pdfium::MakeUnique<CFX_XMLDoc>();
+ if (!doc->LoadXML(pdfium::MakeUnique<CFX_XMLParser>(doc->GetRoot(), stream)))
return 0;
if (doc->DoLoad(nullptr) < 100)
diff --git a/xfa/fde/xml/cfde_xmlchardata.cpp b/xfa/fde/xml/cfde_xmlchardata.cpp
deleted file mode 100644
index bb2991937b..0000000000
--- a/xfa/fde/xml/cfde_xmlchardata.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 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/fde/xml/cfde_xmlchardata.h"
-
-#include "third_party/base/ptr_util.h"
-
-CFDE_XMLCharData::CFDE_XMLCharData(const CFX_WideString& wsCData)
- : CFDE_XMLText(wsCData) {}
-
-CFDE_XMLCharData::~CFDE_XMLCharData() {}
-
-FDE_XMLNODETYPE CFDE_XMLCharData::GetType() const {
- return FDE_XMLNODE_CharData;
-}
-
-std::unique_ptr<CFDE_XMLNode> CFDE_XMLCharData::Clone() {
- return pdfium::MakeUnique<CFDE_XMLCharData>(GetText());
-}
diff --git a/xfa/fde/xml/cfde_xmlchardata.h b/xfa/fde/xml/cfde_xmlchardata.h
deleted file mode 100644
index 56babbc8b4..0000000000
--- a/xfa/fde/xml/cfde_xmlchardata.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 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_FDE_XML_CFDE_XMLCHARDATA_H_
-#define XFA_FDE_XML_CFDE_XMLCHARDATA_H_
-
-#include <memory>
-
-#include "core/fxcrt/fx_string.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
-
-class CFDE_XMLCharData : public CFDE_XMLText {
- public:
- explicit CFDE_XMLCharData(const CFX_WideString& wsCData);
- ~CFDE_XMLCharData() override;
-
- FDE_XMLNODETYPE GetType() const override;
- std::unique_ptr<CFDE_XMLNode> Clone() override;
-};
-
-#endif // XFA_FDE_XML_CFDE_XMLCHARDATA_H_
diff --git a/xfa/fde/xml/cfde_xmlnode.h b/xfa/fde/xml/cfde_xmlnode.h
deleted file mode 100644
index 71e1a712e0..0000000000
--- a/xfa/fde/xml/cfde_xmlnode.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2017 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_FDE_XML_CFDE_XMLNODE_H_
-#define XFA_FDE_XML_CFDE_XMLNODE_H_
-
-#include <memory>
-
-#include "core/fxcrt/cfx_retain_ptr.h"
-#include "core/fxcrt/cfx_seekablestreamproxy.h"
-
-enum FDE_XMLNODETYPE {
- FDE_XMLNODE_Unknown = 0,
- FDE_XMLNODE_Instruction,
- FDE_XMLNODE_Element,
- FDE_XMLNODE_Text,
- FDE_XMLNODE_CharData,
-};
-
-struct FDE_XMLNODE {
- int32_t iNodeNum;
- FDE_XMLNODETYPE eNodeType;
-};
-
-class CFDE_XMLNode {
- public:
- enum NodeItem {
- Root = 0,
- Parent,
- FirstSibling,
- PriorSibling,
- NextSibling,
- LastSibling,
- FirstNeighbor,
- PriorNeighbor,
- NextNeighbor,
- LastNeighbor,
- FirstChild,
- LastChild
- };
-
- CFDE_XMLNode();
- virtual ~CFDE_XMLNode();
-
- virtual FDE_XMLNODETYPE GetType() const;
- virtual std::unique_ptr<CFDE_XMLNode> Clone();
-
- int32_t CountChildNodes() const;
- CFDE_XMLNode* GetChildNode(int32_t index) const;
- int32_t GetChildNodeIndex(CFDE_XMLNode* pNode) const;
- int32_t InsertChildNode(CFDE_XMLNode* pNode, int32_t index = -1);
- void RemoveChildNode(CFDE_XMLNode* pNode);
- void DeleteChildren();
-
- CFDE_XMLNode* GetPath(const wchar_t* pPath,
- int32_t iLength = -1,
- bool bQualifiedName = true) const;
-
- int32_t GetNodeLevel() const;
- CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const;
- bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode);
- CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem);
-
- void SaveXMLNode(const CFX_RetainPtr<CFX_SeekableStreamProxy>& pXMLStream);
-
- CFDE_XMLNode* m_pParent;
- CFDE_XMLNode* m_pChild;
- CFDE_XMLNode* m_pPrior;
- CFDE_XMLNode* m_pNext;
-};
-
-#endif // XFA_FDE_XML_CFDE_XMLNODE_H_
diff --git a/xfa/fde/xml/cfde_xmltext.cpp b/xfa/fde/xml/cfde_xmltext.cpp
deleted file mode 100644
index 2af66ac70c..0000000000
--- a/xfa/fde/xml/cfde_xmltext.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 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/fde/xml/cfde_xmltext.h"
-
-#include "third_party/base/ptr_util.h"
-
-CFDE_XMLText::CFDE_XMLText(const CFX_WideString& wsText)
- : CFDE_XMLNode(), m_wsText(wsText) {}
-
-CFDE_XMLText::~CFDE_XMLText() {}
-
-FDE_XMLNODETYPE CFDE_XMLText::GetType() const {
- return FDE_XMLNODE_Text;
-}
-
-std::unique_ptr<CFDE_XMLNode> CFDE_XMLText::Clone() {
- return pdfium::MakeUnique<CFDE_XMLText>(m_wsText);
-}
diff --git a/xfa/fxfa/app/cxfa_loadercontext.h b/xfa/fxfa/app/cxfa_loadercontext.h
index 16d9608bac..553252e200 100644
--- a/xfa/fxfa/app/cxfa_loadercontext.h
+++ b/xfa/fxfa/app/cxfa_loadercontext.h
@@ -13,7 +13,7 @@
#include "core/fxcrt/fx_system.h"
#include "xfa/fde/css/cfde_csscomputedstyle.h"
-class CFDE_XMLNode;
+class CFX_XMLNode;
class CXFA_Node;
class CXFA_LoaderContext {
@@ -30,7 +30,7 @@ class CXFA_LoaderContext {
int32_t m_iLines;
int32_t m_iTotalLines;
uint32_t m_dwFlags;
- CFDE_XMLNode* m_pXMLNode;
+ CFX_XMLNode* m_pXMLNode;
CXFA_Node* m_pNode;
CFX_RetainPtr<CFDE_CSSComputedStyle> m_pParentStyle;
std::vector<float> m_lineHeights;
diff --git a/xfa/fxfa/app/cxfa_textlayout.cpp b/xfa/fxfa/app/cxfa_textlayout.cpp
index 880bdf4585..69f5f53db3 100644
--- a/xfa/fxfa/app/cxfa_textlayout.cpp
+++ b/xfa/fxfa/app/cxfa_textlayout.cpp
@@ -9,6 +9,9 @@
#include <algorithm>
#include <utility>
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_brush.h"
@@ -17,9 +20,6 @@
#include "xfa/fde/cfde_renderdevice.h"
#include "xfa/fde/css/cfde_csscomputedstyle.h"
#include "xfa/fde/css/cfde_cssstyleselector.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/app/cxfa_linkuserdata.h"
#include "xfa/fxfa/app/cxfa_loadercontext.h"
#include "xfa/fxfa/app/cxfa_pieceline.h"
@@ -66,21 +66,20 @@ void CXFA_TextLayout::GetTextDataNode() {
m_pTextDataNode = pNode;
}
-CFDE_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
+CFX_XMLNode* CXFA_TextLayout::GetXMLContainerNode() {
if (!m_bRichText)
return nullptr;
- CFDE_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode();
+ CFX_XMLNode* pXMLRoot = m_pTextDataNode->GetXMLMappingNode();
if (!pXMLRoot)
return nullptr;
- CFDE_XMLNode* pXMLContainer = nullptr;
- for (CFDE_XMLNode* pXMLChild =
- pXMLRoot->GetNodeItem(CFDE_XMLNode::FirstChild);
+ CFX_XMLNode* pXMLContainer = nullptr;
+ for (CFX_XMLNode* pXMLChild = pXMLRoot->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLChild->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLChild->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
CFX_WideString wsTag = pXMLElement->GetLocalTagName();
if (wsTag == L"body" || wsTag == L"html") {
pXMLContainer = pXMLChild;
@@ -159,7 +158,7 @@ void CXFA_TextLayout::InitBreak(float fLineWidth) {
void CXFA_TextLayout::InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
float fLineWidth,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle) {
if (!pStyle) {
InitBreak(fLineWidth);
@@ -460,24 +459,24 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
m_pBreak->Reset();
if (m_bRichText) {
- CFDE_XMLNode* pContainerNode = GetXMLContainerNode();
+ CFX_XMLNode* pContainerNode = GetXMLContainerNode();
if (!pContainerNode)
return true;
- CFDE_XMLNode* pXMLNode = m_pLoader->m_pXMLNode;
+ CFX_XMLNode* pXMLNode = m_pLoader->m_pXMLNode;
if (!pXMLNode)
return true;
- CFDE_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode;
+ CFX_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode;
for (; pXMLNode;
- pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle,
true, nullptr)) {
break;
}
}
while (!pXMLNode) {
- pXMLNode = pSaveXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
+ pXMLNode = pSaveXMLNode->GetNodeItem(CFX_XMLNode::Parent);
if (pXMLNode == pContainerNode)
break;
if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle,
@@ -485,11 +484,11 @@ bool CXFA_TextLayout::Layout(int32_t iBlock) {
break;
}
pSaveXMLNode = pXMLNode;
- pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling);
+ pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling);
if (!pXMLNode)
continue;
for (; pXMLNode;
- pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (!LoadRichText(pXMLNode, szText, fLinePos,
m_pLoader->m_pParentStyle, true, nullptr)) {
break;
@@ -645,7 +644,7 @@ bool CXFA_TextLayout::Loader(const CFX_SizeF& szText,
return true;
if (m_bRichText) {
- CFDE_XMLNode* pXMLContainer = GetXMLContainerNode();
+ CFX_XMLNode* pXMLContainer = GetXMLContainerNode();
if (pXMLContainer) {
if (!m_textParser.IsParsed())
m_textParser.DoParse(pXMLContainer, m_pTextProvider);
@@ -694,7 +693,7 @@ void CXFA_TextLayout::LoadText(CXFA_Node* pNode,
}
bool CXFA_TextLayout::LoadRichText(
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
const CFX_SizeF& szText,
float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
@@ -716,16 +715,16 @@ bool CXFA_TextLayout::LoadRichText(
if (bEndBreak) {
bool bCurOl = false;
bool bCurLi = false;
- CFDE_XMLElement* pElement = nullptr;
+ CFX_XMLElement* pElement = nullptr;
if (pContext) {
if (m_bBlockContinue ||
(m_pLoader && pXMLNode == m_pLoader->m_pXMLNode)) {
m_bBlockContinue = true;
}
- if (pXMLNode->GetType() == FDE_XMLNODE_Text) {
+ if (pXMLNode->GetType() == FX_XMLNODE_Text) {
bContentNode = true;
- } else if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ } else if (pXMLNode->GetType() == FX_XMLNODE_Element) {
+ pElement = static_cast<CFX_XMLElement*>(pXMLNode);
wsName = pElement->GetLocalTagName();
}
if (wsName == L"ol") {
@@ -771,7 +770,7 @@ bool CXFA_TextLayout::LoadRichText(
bContentNode ? pParentStyle.Get() : pStyle.Get());
CFX_WideString wsText;
if (bContentNode && iTabCount == 0) {
- wsText = static_cast<CFDE_XMLText*>(pXMLNode)->GetText();
+ wsText = static_cast<CFX_XMLText*>(pXMLNode)->GetText();
} else if (wsName == L"br") {
wsText = L'\n';
} else if (wsName == L"li") {
@@ -834,10 +833,10 @@ bool CXFA_TextLayout::LoadRichText(
}
}
- for (CFDE_XMLNode* pChildNode =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pChildNode =
+ pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pChildNode;
- pChildNode = pChildNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pChildNode = pChildNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (bCurOl)
iLiCount++;
@@ -872,7 +871,7 @@ bool CXFA_TextLayout::LoadRichText(
if (IsEnd(bSavePieces)) {
if (m_pLoader && m_pLoader->m_iTotalLines > -1) {
m_pLoader->m_pXMLNode =
- pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling);
+ pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling);
m_pLoader->m_pParentStyle = pParentStyle;
}
return false;
diff --git a/xfa/fxfa/app/cxfa_textlayout.h b/xfa/fxfa/app/cxfa_textlayout.h
index 5bce1c9ab2..75c2d56324 100644
--- a/xfa/fxfa/app/cxfa_textlayout.h
+++ b/xfa/fxfa/app/cxfa_textlayout.h
@@ -21,7 +21,7 @@ class CFDE_Brush;
class CFDE_CSSComputedStyle;
class CFDE_Pen;
class CFDE_RenderDevice;
-class CFDE_XMLNode;
+class CFX_XMLNode;
class CFX_RTFBreak;
class CXFA_LoaderContext;
class CXFA_LinkUserData;
@@ -64,13 +64,13 @@ class CXFA_TextLayout {
private:
void GetTextDataNode();
- CFDE_XMLNode* GetXMLContainerNode();
+ CFX_XMLNode* GetXMLContainerNode();
std::unique_ptr<CFX_RTFBreak> CreateBreak(bool bDefault);
void InitBreak(float fLineWidth);
void InitBreak(CFDE_CSSComputedStyle* pStyle,
FDE_CSSDisplay eDisplay,
float fLineWidth,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle = nullptr);
bool Loader(const CFX_SizeF& szText,
float& fLinePos,
@@ -79,7 +79,7 @@ class CXFA_TextLayout {
const CFX_SizeF& szText,
float& fLinePos,
bool bSavePieces);
- bool LoadRichText(CFDE_XMLNode* pXMLNode,
+ bool LoadRichText(CFX_XMLNode* pXMLNode,
const CFX_SizeF& szText,
float& fLinePos,
const CFX_RetainPtr<CFDE_CSSComputedStyle>& pParentStyle,
diff --git a/xfa/fxfa/app/cxfa_textparser.cpp b/xfa/fxfa/app/cxfa_textparser.cpp
index 1243f5b7ea..33bd2b9deb 100644
--- a/xfa/fxfa/app/cxfa_textparser.cpp
+++ b/xfa/fxfa/app/cxfa_textparser.cpp
@@ -11,13 +11,13 @@
#include <vector>
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
#include "xfa/fde/css/cfde_csscomputedstyle.h"
#include "xfa/fde/css/cfde_cssstyleselector.h"
#include "xfa/fde/css/cfde_cssstylesheet.h"
#include "xfa/fde/css/fde_css.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fxfa/app/cxfa_csstagprovider.h"
#include "xfa/fxfa/app/cxfa_textparsecontext.h"
@@ -175,7 +175,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::CreateStyle(
}
CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
if (it == m_mapXMLNodeToParseContext.end())
@@ -198,7 +198,7 @@ CFX_RetainPtr<CFDE_CSSComputedStyle> CXFA_TextParser::ComputeStyle(
return pStyle;
}
-void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer,
+void CXFA_TextParser::DoParse(CFX_XMLNode* pXMLContainer,
CXFA_TextProvider* pTextProvider) {
if (!pXMLContainer || !pTextProvider || m_bParsed)
return;
@@ -209,7 +209,7 @@ void CXFA_TextParser::DoParse(CFDE_XMLNode* pXMLContainer,
ParseRichText(pXMLContainer, pRootStyle.Get());
}
-void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
+void CXFA_TextParser::ParseRichText(CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle) {
if (!pXMLNode)
return;
@@ -240,10 +240,9 @@ void CXFA_TextParser::ParseRichText(CFDE_XMLNode* pXMLNode,
m_mapXMLNodeToParseContext[pXMLNode] = std::move(pTextContext);
}
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
ParseRichText(pXMLChild, pNewStyle.Get());
}
}
@@ -271,12 +270,12 @@ bool CXFA_TextParser::TagValidate(const CFX_WideString& wsName) const {
}
std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo(
- CFDE_XMLNode* pXMLNode) {
+ CFX_XMLNode* pXMLNode) {
auto tagProvider = pdfium::MakeUnique<CXFA_CSSTagProvider>();
CFX_WideString wsName;
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ if (pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
wsName = pXMLElement->GetLocalTagName();
tagProvider->SetTagName(wsName);
tagProvider->m_bTagAvailable = TagValidate(wsName);
@@ -284,7 +283,7 @@ std::unique_ptr<CXFA_CSSTagProvider> CXFA_TextParser::ParseTagInfo(
CFX_WideString wsValue = pXMLElement->GetString(L"style");
if (!wsValue.IsEmpty())
tagProvider->SetAttribute(L"style", wsValue);
- } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) {
+ } else if (pXMLNode->GetType() == FX_XMLNODE_Text) {
tagProvider->m_bTagAvailable = true;
tagProvider->m_bContent = true;
}
@@ -363,7 +362,7 @@ float CXFA_TextParser::GetFontSize(CXFA_TextProvider* pTextProvider,
int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle,
- CFDE_XMLNode* pXMLNode) const {
+ CFX_XMLNode* pXMLNode) const {
if (pStyle) {
CFX_WideString wsValue;
if (pStyle->GetCustomStyle(L"xfa-font-horizontal-scale", wsValue))
@@ -379,7 +378,7 @@ int32_t CXFA_TextParser::GetHorScale(CXFA_TextProvider* pTextProvider,
return wsValue.GetInteger();
}
}
- pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
+ pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::Parent);
}
}
@@ -490,15 +489,15 @@ float CXFA_TextParser::GetLineHeight(CXFA_TextProvider* pTextProvider,
}
bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFX_WideString& wsValue) {
wsValue.clear();
if (!pXMLNode)
return false;
bool bRet = false;
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ if (pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLNode);
CFX_WideString wsAttr = pElement->GetString(L"xfa:embed");
if (wsAttr.IsEmpty())
return false;
@@ -531,7 +530,7 @@ bool CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
}
CXFA_TextParseContext* CXFA_TextParser::GetParseContextFromMap(
- CFDE_XMLNode* pXMLNode) {
+ CFX_XMLNode* pXMLNode) {
auto it = m_mapXMLNodeToParseContext.find(pXMLNode);
return it != m_mapXMLNodeToParseContext.end() ? it->second.get() : nullptr;
}
diff --git a/xfa/fxfa/app/cxfa_textparser.h b/xfa/fxfa/app/cxfa_textparser.h
index 29f03a8dea..04bd51fafe 100644
--- a/xfa/fxfa/app/cxfa_textparser.h
+++ b/xfa/fxfa/app/cxfa_textparser.h
@@ -19,7 +19,7 @@
class CFDE_CSSComputedStyle;
class CFDE_CSSStyleSelector;
class CFDE_CSSStyleSheet;
-class CFDE_XMLNode;
+class CFX_XMLNode;
class CXFA_CSSTagProvider;
class CXFA_TextParseContext;
class CXFA_TextProvider;
@@ -31,12 +31,12 @@ class CXFA_TextParser {
virtual ~CXFA_TextParser();
void Reset();
- void DoParse(CFDE_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider);
+ void DoParse(CFX_XMLNode* pXMLContainer, CXFA_TextProvider* pTextProvider);
CFX_RetainPtr<CFDE_CSSComputedStyle> CreateRootStyle(
CXFA_TextProvider* pTextProvider);
CFX_RetainPtr<CFDE_CSSComputedStyle> ComputeStyle(
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle);
bool IsParsed() const { return m_bParsed; }
@@ -57,7 +57,7 @@ class CXFA_TextParser {
int32_t GetHorScale(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle,
- CFDE_XMLNode* pXMLNode) const;
+ CFX_XMLNode* pXMLNode) const;
int32_t GetVerScale(CXFA_TextProvider* pTextProvider,
CFDE_CSSComputedStyle* pStyle) const;
@@ -78,18 +78,18 @@ class CXFA_TextParser {
float fVerScale) const;
bool GetEmbbedObj(CXFA_TextProvider* pTextProvider,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
CFX_WideString& wsValue);
- CXFA_TextParseContext* GetParseContextFromMap(CFDE_XMLNode* pXMLNode);
+ CXFA_TextParseContext* GetParseContextFromMap(CFX_XMLNode* pXMLNode);
protected:
bool TagValidate(const CFX_WideString& str) const;
private:
void InitCSSData(CXFA_TextProvider* pTextProvider);
- void ParseRichText(CFDE_XMLNode* pXMLNode,
+ void ParseRichText(CFX_XMLNode* pXMLNode,
CFDE_CSSComputedStyle* pParentStyle);
- std::unique_ptr<CXFA_CSSTagProvider> ParseTagInfo(CFDE_XMLNode* pXMLNode);
+ std::unique_ptr<CXFA_CSSTagProvider> ParseTagInfo(CFX_XMLNode* pXMLNode);
std::unique_ptr<CFDE_CSSStyleSheet> LoadDefaultSheetStyle();
CFX_RetainPtr<CFDE_CSSComputedStyle> CreateStyle(
CFDE_CSSComputedStyle* pParentStyle);
@@ -97,7 +97,7 @@ class CXFA_TextParser {
bool m_bParsed;
bool m_cssInitialized;
std::unique_ptr<CFDE_CSSStyleSelector> m_pSelector;
- std::map<CFDE_XMLNode*, std::unique_ptr<CXFA_TextParseContext>>
+ std::map<CFX_XMLNode*, std::unique_ptr<CXFA_TextParseContext>>
m_mapXMLNodeToParseContext;
};
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index 760def2759..7f53027e5c 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -10,12 +10,12 @@
#include <memory>
#include <vector>
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/app/xfa_ffcheckbutton.h"
#include "xfa/fxfa/app/xfa_ffchoicelist.h"
#include "xfa/fxfa/app/xfa_fffield.h"
@@ -63,14 +63,14 @@ CXFA_Node* CXFA_TextProvider::GetTextNode(bool& bRichText) {
return pChildNode;
} else if (m_eType == XFA_TEXTPROVIDERTYPE_Datasets) {
CXFA_Node* pBind = m_pWidgetAcc->GetDatasets();
- CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
+ CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
ASSERT(pXMLNode);
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild =
+ pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLChild->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLChild);
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLChild->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLChild);
if (XFA_RecognizeRichText(pElement)) {
bRichText = true;
}
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp
index 3565370bde..04741f9082 100644
--- a/xfa/fxfa/cxfa_ffdoc.cpp
+++ b/xfa/fxfa/cxfa_ffdoc.cpp
@@ -17,9 +17,9 @@
#include "core/fxcrt/cfx_checksumcontext.h"
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_memory.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_ffapp.h"
@@ -171,15 +171,15 @@ int32_t CXFA_FFDoc::StartLoad() {
return m_pDocumentParser->StartParse(m_pStream, XFA_XDPPACKET_XDP);
}
-bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
+bool XFA_GetPDFContentsFromPDFXML(CFX_XMLNode* pPDFElement,
uint8_t*& pByteBuffer,
int32_t& iBufferSize) {
- CFDE_XMLElement* pDocumentElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pPDFElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLElement* pDocumentElement = nullptr;
+ for (CFX_XMLNode* pXMLNode =
+ pPDFElement->GetNodeItem(CFX_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
CFX_WideString wsTagName = pXMLElement->GetName();
if (wsTagName == L"document") {
pDocumentElement = pXMLElement;
@@ -190,12 +190,12 @@ bool XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement,
if (!pDocumentElement) {
return false;
}
- CFDE_XMLElement* pChunkElement = nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pDocumentElement->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLElement* pChunkElement = nullptr;
+ for (CFX_XMLNode* pXMLNode =
+ pDocumentElement->GetNodeItem(CFX_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
CFX_WideString wsTagName = pXMLElement->GetName();
if (wsTagName == L"chunk") {
pChunkElement = pXMLElement;
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index be7556ee24..ad8f4bf5fa 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -9,10 +9,10 @@
#include <algorithm>
#include <vector>
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_textout.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/app/cxfa_textlayout.h"
#include "xfa/fxfa/app/xfa_ffwidgetacc.h"
#include "xfa/fxfa/cxfa_ffapp.h"
@@ -265,9 +265,9 @@ void CXFA_WidgetAcc::SetImageEdit(const CFX_WideString& wsContentType,
if (pHrefNode) {
pHrefNode->SetCData(XFA_ATTRIBUTE_Value, wsHref);
} else {
- CFDE_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
- ASSERT(pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element);
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
+ CFX_XMLNode* pXMLNode = pBind->GetXMLMappingNode();
+ ASSERT(pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element);
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"href", wsHref);
}
}
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp
index c1eda8d9e6..0c702fe53c 100644
--- a/xfa/fxfa/parser/cxfa_dataexporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp
@@ -10,10 +10,10 @@
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_codepage.h"
+#include "core/fxcrt/xml/cfx_xmldoc.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmldoc.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_widgetdata.h"
@@ -215,12 +215,12 @@ void RegenerateFormFile_Changed(CXFA_Node* pNode,
pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, false);
if (pRawValueNode->GetElementType() == XFA_Element::SharpxHTML &&
wsContentType == L"text/html") {
- CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode();
+ CFX_XMLNode* pExDataXML = pNode->GetXMLMappingNode();
if (!pExDataXML)
break;
- CFDE_XMLNode* pRichTextXML =
- pExDataXML->GetNodeItem(CFDE_XMLNode::FirstChild);
+ CFX_XMLNode* pRichTextXML =
+ pExDataXML->GetNodeItem(CFX_XMLNode::FirstChild);
if (!pRichTextXML)
break;
@@ -454,19 +454,19 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) {
return;
if (iChildNum > 0) {
- CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
- ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element);
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
+ ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element);
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
if (pXMLElement->HasAttribute(L"xfa:dataNode"))
pXMLElement->RemoveAttribute(L"xfa:dataNode");
return;
}
- CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
- ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element);
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
- L"dataGroup");
+ CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
+ ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element);
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
+ L"dataGroup");
}
CXFA_DataExporter::CXFA_DataExporter(CXFA_Document* pDocument)
@@ -497,7 +497,7 @@ bool CXFA_DataExporter::Export(
CXFA_Node* pNode,
uint32_t dwFlag,
const char* pChecksum) {
- CFDE_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc();
+ CFX_XMLDoc* pXMLDoc = m_pDocument->GetXMLDoc();
if (pNode->IsModelNode()) {
switch (pNode->GetPacketID()) {
case XFA_XDPPACKET_XDP: {
@@ -511,9 +511,9 @@ bool CXFA_DataExporter::Export(
break;
}
case XFA_XDPPACKET_Datasets: {
- CFDE_XMLElement* pElement =
- static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode());
- if (!pElement || pElement->GetType() != FDE_XMLNODE_Element)
+ CFX_XMLElement* pElement =
+ static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode());
+ if (!pElement || pElement->GetType() != FX_XMLNODE_Element)
return false;
CXFA_Node* pDataNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -528,9 +528,9 @@ bool CXFA_DataExporter::Export(
}
case XFA_XDPPACKET_Template:
default: {
- CFDE_XMLElement* pElement =
- static_cast<CFDE_XMLElement*>(pNode->GetXMLMappingNode());
- if (!pElement || pElement->GetType() != FDE_XMLNODE_Element)
+ CFX_XMLElement* pElement =
+ static_cast<CFX_XMLElement*>(pNode->GetXMLMappingNode());
+ if (!pElement || pElement->GetType() != FX_XMLNODE_Element)
return false;
pXMLDoc->SaveXMLNode(pStream, pElement);
@@ -550,9 +550,9 @@ bool CXFA_DataExporter::Export(
break;
}
}
- CFDE_XMLElement* pElement =
- static_cast<CFDE_XMLElement*>(pExportNode->GetXMLMappingNode());
- if (!pElement || pElement->GetType() != FDE_XMLNODE_Element)
+ CFX_XMLElement* pElement =
+ static_cast<CFX_XMLElement*>(pExportNode->GetXMLMappingNode());
+ if (!pElement || pElement->GetType() != FX_XMLNODE_Element)
return false;
XFA_DataExporter_DealWithDataGroupNode(pExportNode);
diff --git a/xfa/fxfa/parser/cxfa_dataimporter.cpp b/xfa/fxfa/parser/cxfa_dataimporter.cpp
index d87d0914e4..cb5a42c428 100644
--- a/xfa/fxfa/parser/cxfa_dataimporter.cpp
+++ b/xfa/fxfa/parser/cxfa_dataimporter.cpp
@@ -9,8 +9,8 @@
#include <memory>
#include "core/fxcrt/fx_stream.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/fxfa_basic.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -53,8 +53,8 @@ bool CXFA_DataImporter::ImportData(
pDataModel->InsertChild(pChildNode);
}
} else {
- CFDE_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode();
- CFDE_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
+ CFX_XMLNode* pXMLNode = pImportDataRoot->GetXMLMappingNode();
+ CFX_XMLNode* pParentXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::Parent);
if (pParentXMLNode)
pParentXMLNode->RemoveChildNode(pXMLNode);
pDataModel->InsertChild(pImportDataRoot);
diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp
index 7c979fec22..8e39dafa84 100644
--- a/xfa/fxfa/parser/cxfa_document.cpp
+++ b/xfa/fxfa/parser/cxfa_document.cpp
@@ -127,7 +127,7 @@ void CXFA_Document::SetRoot(CXFA_Node* pNewRoot) {
RemovePurgeNode(pNewRoot);
}
-CFDE_XMLDoc* CXFA_Document::GetXMLDoc() const {
+CFX_XMLDoc* CXFA_Document::GetXMLDoc() const {
return m_pParser->GetXMLDoc();
}
diff --git a/xfa/fxfa/parser/cxfa_document.h b/xfa/fxfa/parser/cxfa_document.h
index 101b23332e..03586b6591 100644
--- a/xfa/fxfa/parser/cxfa_document.h
+++ b/xfa/fxfa/parser/cxfa_document.h
@@ -40,7 +40,7 @@ enum XFA_DocFlag {
XFA_DOCFLAG_Scripting = 0x0008
};
-class CFDE_XMLDoc;
+class CFX_XMLDoc;
class CScript_DataWindow;
class CScript_EventPseudoModel;
class CScript_HostPseudoModel;
@@ -66,7 +66,7 @@ class CXFA_Document {
CXFA_Node* GetRoot() const { return m_pRootNode; }
- CFDE_XMLDoc* GetXMLDoc() const;
+ CFX_XMLDoc* GetXMLDoc() const;
CXFA_FFNotify* GetNotify() const;
CXFA_LocaleMgr* GetLocalMgr();
CXFA_Object* GetXFAObject(XFA_HashCode wsNodeNameHash);
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index a6860d6b52..eb7cadc01c 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -6,8 +6,8 @@
#include "xfa/fxfa/parser/cxfa_document_parser.h"
+#include "core/fxcrt/xml/cfx_xmldoc.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmldoc.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
@@ -40,7 +40,7 @@ int32_t CXFA_DocumentParser::DoParse(IFX_Pause* pPause) {
return nRetStatus;
}
-CFDE_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const {
+CFX_XMLDoc* CXFA_DocumentParser::GetXMLDoc() const {
return m_nodeParser.GetXMLDoc();
}
diff --git a/xfa/fxfa/parser/cxfa_document_parser.h b/xfa/fxfa/parser/cxfa_document_parser.h
index 90bd47f829..d876244e35 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.h
+++ b/xfa/fxfa/parser/cxfa_document_parser.h
@@ -11,7 +11,7 @@
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
-class CFDE_XMLDoc;
+class CFX_XMLDoc;
class CXFA_Document;
class CXFA_FFNotify;
class CXFA_Notify;
@@ -27,7 +27,7 @@ class CXFA_DocumentParser {
XFA_XDPPACKET ePacketID);
int32_t DoParse(IFX_Pause* pPause);
- CFDE_XMLDoc* GetXMLDoc() const;
+ CFX_XMLDoc* GetXMLDoc() const;
CXFA_FFNotify* GetNotify() const;
CXFA_Document* GetDocument() const;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 83c05d1269..ce45ae10db 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -15,12 +15,12 @@
#include "core/fxcrt/cfx_decimal.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "fxjs/cfxjse_value.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/app/xfa_ffnotify.h"
#include "xfa/fxfa/cxfa_eventparam.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
@@ -517,11 +517,11 @@ CXFA_Node* CXFA_Node::Clone(bool bRecursive) {
MergeAllData(pClone);
pClone->UpdateNameHash();
if (IsNeedSavingXMLNode()) {
- std::unique_ptr<CFDE_XMLNode> pCloneXML;
+ std::unique_ptr<CFX_XMLNode> pCloneXML;
if (IsAttributeInXML()) {
CFX_WideString wsName;
GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
- auto pCloneXMLElement = pdfium::MakeUnique<CFDE_XMLElement>(wsName);
+ auto pCloneXMLElement = pdfium::MakeUnique<CFX_XMLElement>(wsName);
CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
if (!wsValue.IsEmpty()) {
pCloneXMLElement->SetTextData(CFX_WideString(wsValue));
@@ -1284,12 +1284,12 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
auto pParser = pdfium::MakeUnique<CXFA_SimpleParser>(m_pDocument, false);
if (!pParser)
return;
- CFDE_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression, nullptr);
+ CFX_XMLNode* pXMLNode = pParser->ParseXMLData(wsExpression, nullptr);
if (!pXMLNode)
return;
if (bIgnoreRoot &&
- (pXMLNode->GetType() != FDE_XMLNODE_Element ||
- XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLNode)))) {
+ (pXMLNode->GetType() != FX_XMLNODE_Element ||
+ XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLNode)))) {
bIgnoreRoot = false;
}
CXFA_Node* pFakeRoot = Clone(false);
@@ -1299,27 +1299,27 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
CFX_WideString(wsContentType));
}
- std::unique_ptr<CFDE_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode());
+ std::unique_ptr<CFX_XMLNode> pFakeXMLRoot(pFakeRoot->GetXMLMappingNode());
if (!pFakeXMLRoot) {
- CFDE_XMLNode* pThisXMLRoot = GetXMLMappingNode();
+ CFX_XMLNode* pThisXMLRoot = GetXMLMappingNode();
pFakeXMLRoot = pThisXMLRoot ? pThisXMLRoot->Clone() : nullptr;
}
if (!pFakeXMLRoot) {
pFakeXMLRoot =
- pdfium::MakeUnique<CFDE_XMLElement>(CFX_WideString(GetClassName()));
+ pdfium::MakeUnique<CFX_XMLElement>(CFX_WideString(GetClassName()));
}
if (bIgnoreRoot) {
- CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
while (pXMLChild) {
- CFDE_XMLNode* pXMLSibling =
- pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling);
+ CFX_XMLNode* pXMLSibling =
+ pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling);
pXMLNode->RemoveChildNode(pXMLChild);
pFakeXMLRoot->InsertChildNode(pXMLChild);
pXMLChild = pXMLSibling;
}
} else {
- CFDE_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
+ CFX_XMLNode* pXMLParent = pXMLNode->GetNodeItem(CFX_XMLNode::Parent);
if (pXMLParent) {
pXMLParent->RemoveChildNode(pXMLNode);
}
@@ -1349,10 +1349,10 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
}
if (GetPacketID() == XFA_XDPPACKET_Form &&
GetElementType() == XFA_Element::ExData) {
- CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
+ CFX_XMLNode* pTempXMLNode = GetXMLMappingNode();
SetXMLMappingNode(pFakeXMLRoot.release());
SetFlag(XFA_NodeFlag_OwnXMLNode, false);
- if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent))
+ if (pTempXMLNode && !pTempXMLNode->GetNodeItem(CFX_XMLNode::Parent))
pFakeXMLRoot.reset(pTempXMLNode);
else
pFakeXMLRoot = nullptr;
@@ -1396,10 +1396,10 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) {
CFX_WideString bsXMLHeader = L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
if (GetPacketID() == XFA_XDPPACKET_Form ||
GetPacketID() == XFA_XDPPACKET_Datasets) {
- CFDE_XMLNode* pElement = nullptr;
+ CFX_XMLNode* pElement = nullptr;
if (GetPacketID() == XFA_XDPPACKET_Datasets) {
pElement = GetXMLMappingNode();
- if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) {
+ if (!pElement || pElement->GetType() != FX_XMLNODE_Element) {
pArguments->GetReturnValue()->SetString(
bsXMLHeader.UTF8Encode().AsStringC());
return;
@@ -3366,9 +3366,9 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
}
CFX_ByteString bsAttributeName = pArguments->GetUTF8String(0);
CFX_WideString wsAttributeValue;
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- wsAttributeValue = static_cast<CFDE_XMLElement*>(pXMLNode)->GetString(
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
+ wsAttributeValue = static_cast<CFX_XMLElement*>(pXMLNode)->GetString(
CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str());
}
pArguments->GetReturnValue()->SetString(
@@ -3382,9 +3382,9 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) {
}
CFX_ByteString bsValue = pArguments->GetUTF8String(0);
CFX_ByteString bsName = pArguments->GetUTF8String(1);
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetString(
CFX_WideString::FromUTF8(bsName.AsStringC()),
CFX_WideString::FromUTF8(bsValue.AsStringC()));
}
@@ -3399,9 +3399,9 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) {
CFX_ByteString bsName = pArguments->GetUTF8String(0);
CFX_WideString wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
if (pXMLElement->HasAttribute(wsName.c_str())) {
pXMLElement->RemoveAttribute(wsName.c_str());
}
@@ -3413,16 +3413,16 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
pXMLElement->SetTextData(pValue->ToWideString());
}
} else {
CFX_WideString wsTextData;
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (pXMLNode && pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
wsTextData = pXMLElement->GetTextData();
}
pValue->SetString(wsTextData.UTF8Encode().AsStringC());
@@ -3782,11 +3782,11 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
}
if (eAttr == XFA_ATTRIBUTE_Value) {
- FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
+ FX_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
switch (eXMLType) {
- case FDE_XMLNODE_Element:
+ case FX_XMLNODE_Element:
if (IsAttributeInXML()) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ static_cast<CFX_XMLElement*>(m_pXMLNode)
->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
wsValue);
} else {
@@ -3803,13 +3803,13 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
}
}
if (bDeleteChildren) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
+ static_cast<CFX_XMLElement*>(m_pXMLNode)->DeleteChildren();
}
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
+ static_cast<CFX_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
}
break;
- case FDE_XMLNODE_Text:
- static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue);
+ case FX_XMLNODE_Text:
+ static_cast<CFX_XMLText*>(m_pXMLNode)->SetText(wsValue);
break;
default:
ASSERT(0);
@@ -3819,12 +3819,12 @@ bool CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
if (pInfo) {
- ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
+ ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element);
CFX_WideString wsAttrName = pInfo->pName;
if (pInfo->eName == XFA_ATTRIBUTE_ContentType) {
wsAttrName = L"xfa:" + wsAttrName;
}
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue);
+ static_cast<CFX_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue);
}
return true;
}
@@ -3839,11 +3839,11 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
SetUserData(pKey, pClone, &deleteWideStringCallBack);
OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
if (IsNeedSavingXMLNode()) {
- FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
+ FX_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
switch (eXMLType) {
- case FDE_XMLNODE_Element:
+ case FX_XMLNODE_Element:
if (IsAttributeInXML()) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ static_cast<CFX_XMLElement*>(m_pXMLNode)
->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)),
wsXMLValue);
} else {
@@ -3860,13 +3860,13 @@ bool CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
}
}
if (bDeleteChildren) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
+ static_cast<CFX_XMLElement*>(m_pXMLNode)->DeleteChildren();
}
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue);
+ static_cast<CFX_XMLElement*>(m_pXMLNode)->SetTextData(wsXMLValue);
}
break;
- case FDE_XMLNODE_Text:
- static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsXMLValue);
+ case FX_XMLNODE_Text:
+ static_cast<CFX_XMLText*>(m_pXMLNode)->SetText(wsXMLValue);
break;
default:
ASSERT(0);
@@ -3955,26 +3955,26 @@ bool CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr,
SetMapModuleValue(pKey, pValue);
OnChanged(eAttr, bNotify, false);
if (IsNeedSavingXMLNode()) {
- ASSERT(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
+ ASSERT(m_pXMLNode->GetType() == FX_XMLNODE_Element);
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
if (pInfo) {
switch (eType) {
case XFA_ATTRIBUTETYPE_Enum:
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ static_cast<CFX_XMLElement*>(m_pXMLNode)
->SetString(
pInfo->pName,
GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)
->pName);
break;
case XFA_ATTRIBUTETYPE_Boolean:
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ static_cast<CFX_XMLElement*>(m_pXMLNode)
->SetString(pInfo->pName, pValue ? L"1" : L"0");
break;
case XFA_ATTRIBUTETYPE_Integer: {
CFX_WideString wsValue;
wsValue.Format(
L"%d", static_cast<int32_t>(reinterpret_cast<uintptr_t>(pValue)));
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ static_cast<CFX_XMLElement*>(m_pXMLNode)
->SetString(pInfo->pName, wsValue);
break;
}
@@ -4293,27 +4293,27 @@ CXFA_Node* CXFA_Node::GetModelNode() {
bool CXFA_Node::TryNamespace(CFX_WideString& wsNamespace) {
wsNamespace.clear();
if (IsModelNode() || GetElementType() == XFA_Element::Packet) {
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
- if (!pXMLNode || pXMLNode->GetType() != FDE_XMLNODE_Element) {
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
+ if (!pXMLNode || pXMLNode->GetType() != FX_XMLNODE_Element) {
return false;
}
- wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI();
+ wsNamespace = static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI();
return true;
} else if (GetPacketID() == XFA_XDPPACKET_Datasets) {
- CFDE_XMLNode* pXMLNode = GetXMLMappingNode();
+ CFX_XMLNode* pXMLNode = GetXMLMappingNode();
if (!pXMLNode) {
return false;
}
- if (pXMLNode->GetType() != FDE_XMLNODE_Element) {
+ if (pXMLNode->GetType() != FX_XMLNODE_Element) {
return true;
}
if (GetElementType() == XFA_Element::DataValue &&
GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData) {
return XFA_FDEExtension_ResolveNamespaceQualifier(
- static_cast<CFDE_XMLElement*>(pXMLNode),
+ static_cast<CFX_XMLElement*>(pXMLNode),
GetCData(XFA_ATTRIBUTE_QualifiedName), &wsNamespace);
}
- wsNamespace = static_cast<CFDE_XMLElement*>(pXMLNode)->GetNamespaceURI();
+ wsNamespace = static_cast<CFX_XMLElement*>(pXMLNode)->GetNamespaceURI();
return true;
} else {
CXFA_Node* pModelNode = GetModelNode();
@@ -4448,7 +4448,7 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
pNotify->OnChildAdded(this);
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
- ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent));
+ ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFX_XMLNode::Parent));
m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index);
pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
}
@@ -4495,7 +4495,7 @@ bool CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
pNotify->OnChildAdded(this);
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
- ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent));
+ ASSERT(!pNode->m_pXMLNode->GetNodeItem(CFX_XMLNode::Parent));
m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex);
pNode->ClearFlag(XFA_NodeFlag_OwnXMLNode);
}
@@ -4543,17 +4543,17 @@ bool CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
if (pNode->IsAttributeInXML()) {
ASSERT(pNode->m_pXMLNode == m_pXMLNode &&
- m_pXMLNode->GetType() == FDE_XMLNODE_Element);
- if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) {
- CFDE_XMLElement* pXMLElement =
- static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode);
+ m_pXMLNode->GetType() == FX_XMLNODE_Element);
+ if (pNode->m_pXMLNode->GetType() == FX_XMLNODE_Element) {
+ CFX_XMLElement* pXMLElement =
+ static_cast<CFX_XMLElement*>(pNode->m_pXMLNode);
CFX_WideStringC wsAttributeName =
pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
pXMLElement->RemoveAttribute(wsAttributeName.c_str());
}
CFX_WideString wsName;
pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, false);
- CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName);
+ CFX_XMLElement* pNewXMLElement = new CFX_XMLElement(wsName);
CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
if (!wsValue.IsEmpty()) {
pNewXMLElement->SetTextData(CFX_WideString(wsValue));
@@ -4799,10 +4799,10 @@ void CXFA_Node::UpdateNameHash() {
}
}
-CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
+CFX_XMLNode* CXFA_Node::CreateXMLMappingNode() {
if (!m_pXMLNode) {
CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name));
- m_pXMLNode = new CFDE_XMLElement(wsTag);
+ m_pXMLNode = new CFX_XMLElement(wsTag);
SetFlag(XFA_NodeFlag_OwnXMLNode, false);
}
return m_pXMLNode;
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 970d267ff3..db4b2ce553 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -13,7 +13,7 @@
#include "core/fxcrt/fx_string.h"
#include "xfa/fxfa/parser/cxfa_object.h"
-class CFDE_XMLNode;
+class CFX_XMLNode;
class CFXJSE_Argument;
class CXFA_WidgetData;
@@ -95,9 +95,9 @@ class CXFA_Node : public CXFA_Object {
bool IsFormContainer() const {
return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
}
- void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
- CFDE_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
- CFDE_XMLNode* CreateXMLMappingNode();
+ void SetXMLMappingNode(CFX_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
+ CFX_XMLNode* GetXMLMappingNode() const { return m_pXMLNode; }
+ CFX_XMLNode* CreateXMLMappingNode();
bool IsNeedSavingXMLNode();
uint32_t GetNameHash() const { return m_dwNameHash; }
bool IsUnnamed() const { return m_dwNameHash == 0; }
@@ -592,7 +592,7 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* m_pChild;
CXFA_Node* m_pLastChild;
CXFA_Node* m_pParent;
- CFDE_XMLNode* m_pXMLNode;
+ CFX_XMLNode* m_pXMLNode;
uint16_t m_ePacket;
uint16_t m_uNodeFlags;
uint32_t m_dwNameHash;
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index 642b7641bd..9fd684c0a9 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -13,14 +13,14 @@
#include "core/fxcrt/cfx_seekablestreamproxy.h"
#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmldoc.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlinstruction.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmlparser.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "third_party/base/ptr_util.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmldoc.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlinstruction.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmlparser.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -29,25 +29,25 @@
namespace {
-CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc,
- bool bVerifyWellFormness = false) {
+CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc,
+ bool bVerifyWellFormness = false) {
if (!pXMLDoc)
return nullptr;
- for (CFDE_XMLNode* pXMLNode =
- pXMLDoc->GetRoot()->GetNodeItem(CFDE_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pXMLNode->GetType() != FDE_XMLNODE_Element)
+ for (CFX_XMLNode* pXMLNode =
+ pXMLDoc->GetRoot()->GetNodeItem(CFX_XMLNode::FirstChild);
+ pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pXMLNode->GetType() != FX_XMLNODE_Element)
continue;
if (!bVerifyWellFormness)
return pXMLNode;
- for (CFDE_XMLNode* pNextNode =
- pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling);
+ for (CFX_XMLNode* pNextNode =
+ pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling);
pNextNode;
- pNextNode = pNextNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (pNextNode->GetType() == FDE_XMLNODE_Element)
+ pNextNode = pNextNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (pNextNode->GetType() == FX_XMLNODE_Element)
return nullptr;
}
return pXMLNode;
@@ -55,7 +55,7 @@ CFDE_XMLNode* GetDocumentNode(CFDE_XMLDoc* pXMLDoc,
return nullptr;
}
-CFX_WideString GetElementTagNamespaceURI(CFDE_XMLElement* pElement) {
+CFX_WideString GetElementTagNamespaceURI(CFX_XMLElement* pElement) {
CFX_WideString wsNodeStr = pElement->GetNamespacePrefix();
CFX_WideString wsNamespaceURI;
if (!XFA_FDEExtension_ResolveNamespaceQualifier(
@@ -65,14 +65,14 @@ CFX_WideString GetElementTagNamespaceURI(CFDE_XMLElement* pElement) {
return wsNamespaceURI;
}
-bool MatchNodeName(CFDE_XMLNode* pNode,
+bool MatchNodeName(CFX_XMLNode* pNode,
const CFX_WideStringC& wsLocalTagName,
const CFX_WideStringC& wsNamespaceURIPrefix,
uint32_t eMatchFlags = XFA_XDPPACKET_FLAGS_NOMATCH) {
- if (!pNode || pNode->GetType() != FDE_XMLNODE_Element)
+ if (!pNode || pNode->GetType() != FX_XMLNODE_Element)
return false;
- CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pNode);
+ CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pNode);
CFX_WideString wsNodeStr = pElement->GetLocalTagName();
if (wsNodeStr != wsLocalTagName)
return false;
@@ -100,7 +100,7 @@ bool GetAttributeLocalName(const CFX_WideStringC& wsAttributeName,
return true;
}
-bool ResolveAttribute(CFDE_XMLElement* pElement,
+bool ResolveAttribute(CFX_XMLElement* pElement,
const CFX_WideStringC& wsAttributeName,
CFX_WideString& wsLocalAttrName,
CFX_WideString& wsNamespaceURI) {
@@ -122,7 +122,7 @@ bool ResolveAttribute(CFDE_XMLElement* pElement,
return true;
}
-bool FindAttributeWithNS(CFDE_XMLElement* pElement,
+bool FindAttributeWithNS(CFX_XMLElement* pElement,
const CFX_WideStringC& wsLocalAttributeName,
const CFX_WideStringC& wsNamespaceURIPrefix,
CFX_WideString& wsValue,
@@ -164,7 +164,7 @@ bool FindAttributeWithNS(CFDE_XMLElement* pElement,
return false;
}
-CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) {
+CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) {
if (MatchNodeName(pXMLDocumentNode,
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName,
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI,
@@ -177,10 +177,10 @@ CFDE_XMLNode* GetDataSetsFromXDP(CFDE_XMLNode* pXMLDocumentNode) {
XFA_GetPacketByIndex(XFA_PACKET_XDP)->eFlags)) {
return nullptr;
}
- for (CFDE_XMLNode* pDatasetsNode =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pDatasetsNode =
+ pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild);
pDatasetsNode;
- pDatasetsNode = pDatasetsNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pDatasetsNode = pDatasetsNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
if (!MatchNodeName(pDatasetsNode,
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pName,
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI,
@@ -197,24 +197,23 @@ bool IsStringAllWhitespace(CFX_WideString wsText) {
return wsText.IsEmpty();
}
-void ConvertXMLToPlainText(CFDE_XMLElement* pRootXMLNode,
+void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode,
CFX_WideString& wsOutput) {
- for (CFDE_XMLNode* pXMLChild =
- pRootXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild =
+ pRootXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
switch (pXMLChild->GetType()) {
- case FDE_XMLNODE_Element: {
+ case FX_XMLNODE_Element: {
CFX_WideString wsTextData =
- static_cast<CFDE_XMLElement*>(pXMLChild)->GetTextData();
+ static_cast<CFX_XMLElement*>(pXMLChild)->GetTextData();
wsTextData += L"\n";
wsOutput += wsTextData;
break;
}
- case FDE_XMLNODE_Text:
- case FDE_XMLNODE_CharData: {
- CFX_WideString wsText =
- static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
+ case FX_XMLNODE_Text:
+ case FX_XMLNODE_CharData: {
+ CFX_WideString wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
if (IsStringAllWhitespace(wsText))
continue;
@@ -250,7 +249,7 @@ const XFA_PACKETINFO* GetPacketByName(const CFX_WideStringC& wsName) {
} // namespace
-bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode) {
+bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode) {
return pRichTextXMLNode && GetElementTagNamespaceURI(pRichTextXMLNode) ==
L"http://www.w3.org/1999/xhtml";
}
@@ -283,9 +282,9 @@ int32_t CXFA_SimpleParser::StartParse(
wCodePage != FX_CODEPAGE_UTF8) {
m_pStream->SetCodePage(FX_CODEPAGE_UTF8);
}
- m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
+ m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>();
auto pNewParser =
- pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream);
+ pdfium::MakeUnique<CFX_XMLParser>(m_pXMLDoc->GetRoot(), m_pStream);
m_pXMLParser = pNewParser.get();
if (!m_pXMLDoc->LoadXML(std::move(pNewParser)))
return XFA_PARSESTATUS_StatusErr;
@@ -314,15 +313,15 @@ int32_t CXFA_SimpleParser::DoParse(IFX_Pause* pPause) {
return XFA_PARSESTATUS_Done;
}
-CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML,
- IFX_Pause* pPause) {
+CFX_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML,
+ IFX_Pause* pPause) {
CloseParser();
- m_pXMLDoc = pdfium::MakeUnique<CFDE_XMLDoc>();
+ m_pXMLDoc = pdfium::MakeUnique<CFX_XMLDoc>();
auto pStream = pdfium::MakeRetain<CFX_SeekableStreamProxy>(
const_cast<uint8_t*>(wsXML.raw_str()), wsXML.GetLength());
auto pParser =
- pdfium::MakeUnique<CFDE_XMLParser>(m_pXMLDoc->GetRoot(), pStream);
+ pdfium::MakeUnique<CFX_XMLParser>(m_pXMLDoc->GetRoot(), pStream);
pParser->m_dwCheckStatus = 0x03;
if (!m_pXMLDoc->LoadXML(std::move(pParser)))
return nullptr;
@@ -334,25 +333,25 @@ CFDE_XMLNode* CXFA_SimpleParser::ParseXMLData(const CFX_ByteString& wsXML,
}
void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode) {
+ CFX_XMLNode* pXMLNode) {
XFA_XDPPACKET ePacketID = (XFA_XDPPACKET)pXFANode->GetPacketID();
if (ePacketID == XFA_XDPPACKET_Datasets) {
if (pXFANode->GetElementType() == XFA_Element::DataValue) {
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild =
+ pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- FDE_XMLNODETYPE eNodeType = pXMLChild->GetType();
- if (eNodeType == FDE_XMLNODE_Instruction)
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
+ if (eNodeType == FX_XMLNODE_Instruction)
continue;
- if (eNodeType == FDE_XMLNODE_Element) {
+ if (eNodeType == FX_XMLNODE_Element) {
CXFA_Node* pXFAChild = m_pFactory->CreateNode(XFA_XDPPACKET_Datasets,
XFA_Element::DataValue);
if (!pXFAChild)
return;
- CFDE_XMLElement* child = static_cast<CFDE_XMLElement*>(pXMLChild);
+ CFX_XMLElement* child = static_cast<CFX_XMLElement*>(pXMLChild);
CFX_WideString wsNodeStr = child->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
CFX_WideString wsChildValue;
@@ -382,18 +381,18 @@ CXFA_Node* CXFA_SimpleParser::GetRootNode() const {
return m_pRootNode;
}
-CFDE_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const {
+CFX_XMLDoc* CXFA_SimpleParser::GetXMLDoc() const {
return m_pXMLDoc.get();
}
bool XFA_FDEExtension_ResolveNamespaceQualifier(
- CFDE_XMLElement* pNode,
+ CFX_XMLElement* pNode,
const CFX_WideStringC& wsQualifier,
CFX_WideString* wsNamespaceURI) {
if (!pNode)
return false;
- CFDE_XMLNode* pFakeRoot = pNode->GetNodeItem(CFDE_XMLNode::Root);
+ CFX_XMLNode* pFakeRoot = pNode->GetNodeItem(CFX_XMLNode::Root);
CFX_WideString wsNSAttribute;
bool bRet = false;
if (wsQualifier.IsEmpty()) {
@@ -402,12 +401,12 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(
} else {
wsNSAttribute = L"xmlns:" + wsQualifier;
}
- for (CFDE_XMLNode* pParent = pNode; pParent != pFakeRoot;
- pParent = pParent->GetNodeItem(CFDE_XMLNode::Parent)) {
- if (pParent->GetType() != FDE_XMLNODE_Element)
+ for (CFX_XMLNode* pParent = pNode; pParent != pFakeRoot;
+ pParent = pParent->GetNodeItem(CFX_XMLNode::Parent)) {
+ if (pParent->GetType() != FX_XMLNODE_Element)
continue;
- auto* pElement = static_cast<CFDE_XMLElement*>(pParent);
+ auto* pElement = static_cast<CFX_XMLElement*>(pParent);
if (pElement->HasAttribute(wsNSAttribute.c_str())) {
*wsNamespaceURI = pElement->GetString(wsNSAttribute.c_str());
return true;
@@ -417,7 +416,7 @@ bool XFA_FDEExtension_ResolveNamespaceQualifier(
return bRet;
}
-CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode,
+CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
switch (ePacketID) {
case XFA_XDPPACKET_UNKNOWN:
@@ -444,7 +443,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode,
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
if (!MatchNodeName(pXMLDocumentNode,
XFA_GetPacketByIndex(XFA_PACKET_XDP)->pName,
@@ -461,7 +460,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
m_pRootNode = pXFARootNode;
pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa");
- CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
+ CFX_XMLElement* pElement = static_cast<CFX_XMLElement*>(pXMLDocumentNode);
for (auto it : pElement->GetAttributes()) {
if (it.first == L"uuid")
pXFARootNode->SetCData(XFA_ATTRIBUTE_Uuid, it.second);
@@ -469,12 +468,12 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
pXFARootNode->SetCData(XFA_ATTRIBUTE_TimeStamp, it.second);
}
- CFDE_XMLNode* pXMLConfigDOMRoot = nullptr;
+ CFX_XMLNode* pXMLConfigDOMRoot = nullptr;
CXFA_Node* pXFAConfigDOMRoot = nullptr;
- for (CFDE_XMLNode* pChildItem =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pChildItem =
+ pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild);
pChildItem;
- pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pChildItem = pChildItem->GetNodeItem(CFX_XMLNode::NextSibling)) {
const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByIndex(XFA_PACKET_Config);
if (!MatchNodeName(pChildItem, pPacketInfo->pName, pPacketInfo->pURI,
pPacketInfo->eFlags)) {
@@ -489,19 +488,19 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
pXFARootNode->InsertChild(pXFAConfigDOMRoot, nullptr);
}
- CFDE_XMLNode* pXMLDatasetsDOMRoot = nullptr;
- CFDE_XMLNode* pXMLFormDOMRoot = nullptr;
- CFDE_XMLNode* pXMLTemplateDOMRoot = nullptr;
- for (CFDE_XMLNode* pChildItem =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ CFX_XMLNode* pXMLDatasetsDOMRoot = nullptr;
+ CFX_XMLNode* pXMLFormDOMRoot = nullptr;
+ CFX_XMLNode* pXMLTemplateDOMRoot = nullptr;
+ for (CFX_XMLNode* pChildItem =
+ pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild);
pChildItem;
- pChildItem = pChildItem->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- if (!pChildItem || pChildItem->GetType() != FDE_XMLNODE_Element)
+ pChildItem = pChildItem->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ if (!pChildItem || pChildItem->GetType() != FX_XMLNODE_Element)
continue;
if (pChildItem == pXMLConfigDOMRoot)
continue;
- CFDE_XMLElement* pElement = reinterpret_cast<CFDE_XMLElement*>(pChildItem);
+ CFX_XMLElement* pElement = reinterpret_cast<CFX_XMLElement*>(pChildItem);
CFX_WideString wsPacketName = pElement->GetLocalTagName();
const XFA_PACKETINFO* pPacketInfo =
GetPacketByName(wsPacketName.AsStringC());
@@ -570,7 +569,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
if (!MatchNodeName(pXMLDocumentNode,
XFA_GetPacketByIndex(XFA_PACKET_Config)->pName,
@@ -593,7 +592,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Config(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
CXFA_Node* pNode = nullptr;
if (ePacketID == XFA_XDPPACKET_Template) {
@@ -609,8 +608,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
pNode->SetCData(XFA_ATTRIBUTE_Name,
XFA_GetPacketByIndex(XFA_PACKET_Template)->pName);
if (m_bDocumentParser) {
- CFDE_XMLElement* pXMLDocumentElement =
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
+ CFX_XMLElement* pXMLDocumentElement =
+ static_cast<CFX_XMLElement*>(pXMLDocumentNode);
CFX_WideString wsNamespaceURI = pXMLDocumentElement->GetNamespaceURI();
if (wsNamespaceURI.IsEmpty())
wsNamespaceURI = pXMLDocumentElement->GetString(L"xmlns:xfa");
@@ -625,8 +624,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
XFA_GetPacketByIndex(XFA_PACKET_Form)->pName,
XFA_GetPacketByIndex(XFA_PACKET_Form)->pURI,
XFA_GetPacketByIndex(XFA_PACKET_Form)->eFlags)) {
- CFDE_XMLElement* pXMLDocumentElement =
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode);
+ CFX_XMLElement* pXMLDocumentElement =
+ static_cast<CFX_XMLElement*>(pXMLDocumentNode);
CFX_WideString wsChecksum = pXMLDocumentElement->GetString(L"checksum");
if (wsChecksum.GetLength() != 28 ||
m_pXMLParser->m_dwCheckStatus != 0x03) {
@@ -674,9 +673,9 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
- CFDE_XMLNode* pDatasetsXMLNode = GetDataSetsFromXDP(pXMLDocumentNode);
+ CFX_XMLNode* pDatasetsXMLNode = GetDataSetsFromXDP(pXMLDocumentNode);
if (pDatasetsXMLNode) {
CXFA_Node* pNode =
m_pFactory->CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel);
@@ -692,23 +691,23 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
return pNode;
}
- CFDE_XMLNode* pDataXMLNode = nullptr;
+ CFX_XMLNode* pDataXMLNode = nullptr;
if (MatchNodeName(pXMLDocumentNode, L"data",
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->pURI,
XFA_GetPacketByIndex(XFA_PACKET_Datasets)->eFlags)) {
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode)
+ static_cast<CFX_XMLElement*>(pXMLDocumentNode)
->RemoveAttribute(L"xmlns:xfa");
pDataXMLNode = pXMLDocumentNode;
} else {
- CFDE_XMLElement* pDataElement = new CFDE_XMLElement(L"xfa:data");
- CFDE_XMLNode* pParentXMLNode =
- pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::Parent);
+ CFX_XMLElement* pDataElement = new CFX_XMLElement(L"xfa:data");
+ CFX_XMLNode* pParentXMLNode =
+ pXMLDocumentNode->GetNodeItem(CFX_XMLNode::Parent);
if (pParentXMLNode)
pParentXMLNode->RemoveChildNode(pXMLDocumentNode);
- ASSERT(pXMLDocumentNode->GetType() == FDE_XMLNODE_Element);
- if (pXMLDocumentNode->GetType() == FDE_XMLNODE_Element) {
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode)
+ ASSERT(pXMLDocumentNode->GetType() == FX_XMLNODE_Element);
+ if (pXMLDocumentNode->GetType() == FX_XMLNODE_Element) {
+ static_cast<CFX_XMLElement*>(pXMLDocumentNode)
->RemoveAttribute(L"xmlns:xfa");
}
pDataElement->InsertChildNode(pXMLDocumentNode);
@@ -724,7 +723,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
return nullptr;
}
CFX_WideString wsLocalName =
- static_cast<CFDE_XMLElement*>(pDataXMLNode)->GetLocalTagName();
+ static_cast<CFX_XMLElement*>(pDataXMLNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsLocalName);
if (!DataLoader(pNode, pDataXMLNode, true))
return nullptr;
@@ -738,7 +737,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
CXFA_Node* pNode = nullptr;
if (ePacketID == XFA_XDPPACKET_LocaleSet) {
@@ -793,7 +792,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_LocaleConnectionSourceSet(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
if (!MatchNodeName(pXMLDocumentNode,
XFA_GetPacketByIndex(XFA_PACKET_Xdc)->pName,
@@ -813,7 +812,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Xdc(
}
CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID) {
CXFA_Node* pNode =
m_pFactory->CreateNode(XFA_XDPPACKET_XDP, XFA_Element::Packet);
@@ -821,7 +820,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User(
return nullptr;
CFX_WideString wsName =
- static_cast<CFDE_XMLElement*>(pXMLDocumentNode)->GetLocalTagName();
+ static_cast<CFX_XMLElement*>(pXMLDocumentNode)->GetLocalTagName();
pNode->SetCData(XFA_ATTRIBUTE_Name, wsName);
if (!UserPacketLoader(pNode, pXMLDocumentNode))
return nullptr;
@@ -831,28 +830,28 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_User(
}
CXFA_Node* CXFA_SimpleParser::UserPacketLoader(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLDoc) {
+ CFX_XMLNode* pXMLDoc) {
return pXFANode;
}
CXFA_Node* CXFA_SimpleParser::DataLoader(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLDoc,
+ CFX_XMLNode* pXMLDoc,
bool bDoTransform) {
ParseDataGroup(pXFANode, pXMLDoc, XFA_XDPPACKET_Datasets);
return pXFANode;
}
CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLDoc,
+ CFX_XMLNode* pXMLDoc,
XFA_XDPPACKET ePacketID,
bool bUseAttribute) {
bool bOneOfPropertyFound = false;
- for (CFDE_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
switch (pXMLChild->GetType()) {
- case FDE_XMLNODE_Element: {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
+ case FX_XMLNODE_Element: {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
CFX_WideString wsTagName = pXMLElement->GetLocalTagName();
XFA_Element eType = XFA_GetElementTypeForName(wsTagName.AsStringC());
if (eType == XFA_Element::Unknown)
@@ -914,8 +913,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
break;
}
} break;
- case FDE_XMLNODE_Instruction:
- ParseInstruction(pXFANode, static_cast<CFDE_XMLInstruction*>(pXMLChild),
+ case FX_XMLNODE_Instruction:
+ ParseInstruction(pXFANode, static_cast<CFX_XMLInstruction*>(pXMLChild),
ePacketID);
break;
default:
@@ -926,7 +925,7 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
}
void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID) {
XFA_Element element = XFA_Element::Sharptext;
if (pXFANode->GetElementType() == XFA_Element::ExData) {
@@ -941,31 +940,30 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
pXFANode->SetXMLMappingNode(pXMLNode);
CFX_WideString wsValue;
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- FDE_XMLNODETYPE eNodeType = pXMLChild->GetType();
- if (eNodeType == FDE_XMLNODE_Instruction)
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
+ if (eNodeType == FX_XMLNODE_Instruction)
continue;
if (element == XFA_Element::SharpxHTML) {
- if (eNodeType != FDE_XMLNODE_Element)
+ if (eNodeType != FX_XMLNODE_Element)
break;
- if (XFA_RecognizeRichText(static_cast<CFDE_XMLElement*>(pXMLChild)))
- XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild),
+ if (XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLChild)))
+ XFA_GetPlainTextFromRichText(static_cast<CFX_XMLElement*>(pXMLChild),
wsValue);
} else if (element == XFA_Element::Sharpxml) {
- if (eNodeType != FDE_XMLNODE_Element)
+ if (eNodeType != FX_XMLNODE_Element)
break;
- ConvertXMLToPlainText(static_cast<CFDE_XMLElement*>(pXMLChild), wsValue);
+ ConvertXMLToPlainText(static_cast<CFX_XMLElement*>(pXMLChild), wsValue);
} else {
- if (eNodeType == FDE_XMLNODE_Element)
+ if (eNodeType == FX_XMLNODE_Element)
break;
- if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData)
- wsValue = static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
+ if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData)
+ wsValue = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
}
break;
}
@@ -983,15 +981,14 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
}
void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID) {
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
switch (pXMLChild->GetType()) {
- case FDE_XMLNODE_Element: {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLChild);
+ case FX_XMLNODE_Element: {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
{
CFX_WideString wsNamespaceURI =
GetElementTagNamespaceURI(pXMLElement);
@@ -1024,13 +1021,13 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
}
}
if (eNodeType == XFA_Element::DataModel) {
- for (CFDE_XMLNode* pXMLDataChild =
- pXMLElement->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pXMLDataChild =
+ pXMLElement->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem(
- CFDE_XMLNode::NextSibling)) {
- if (pXMLDataChild->GetType() == FDE_XMLNODE_Element) {
+ CFX_XMLNode::NextSibling)) {
+ if (pXMLDataChild->GetType() == FX_XMLNODE_Element) {
if (!XFA_RecognizeRichText(
- static_cast<CFDE_XMLElement*>(pXMLDataChild))) {
+ static_cast<CFX_XMLElement*>(pXMLDataChild))) {
eNodeType = XFA_Element::DataGroup;
break;
}
@@ -1094,9 +1091,9 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
pXFAChild->SetFlag(XFA_NodeFlag_Initialized, false);
continue;
}
- case FDE_XMLNODE_CharData:
- case FDE_XMLNODE_Text: {
- CFDE_XMLText* pXMLText = static_cast<CFDE_XMLText*>(pXMLChild);
+ case FX_XMLNODE_CharData:
+ case FX_XMLNODE_Text: {
+ CFX_XMLText* pXMLText = static_cast<CFX_XMLText*>(pXMLChild);
CFX_WideString wsText = pXMLText->GetText();
if (IsStringAllWhitespace(wsText))
continue;
@@ -1119,30 +1116,28 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
}
void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID) {
CFX_WideTextBuf wsValueTextBuf;
CFX_WideTextBuf wsCurValueTextBuf;
bool bMarkAsCompound = false;
- CFDE_XMLNode* pXMLCurValueNode = nullptr;
- for (CFDE_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ CFX_XMLNode* pXMLCurValueNode = nullptr;
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- FDE_XMLNODETYPE eNodeType = pXMLChild->GetType();
- if (eNodeType == FDE_XMLNODE_Instruction)
+ pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
+ if (eNodeType == FX_XMLNODE_Instruction)
continue;
CFX_WideString wsText;
- if (eNodeType == FDE_XMLNODE_Text || eNodeType == FDE_XMLNODE_CharData) {
- wsText = static_cast<CFDE_XMLText*>(pXMLChild)->GetText();
+ if (eNodeType == FX_XMLNODE_Text || eNodeType == FX_XMLNODE_CharData) {
+ wsText = static_cast<CFX_XMLText*>(pXMLChild)->GetText();
if (!pXMLCurValueNode)
pXMLCurValueNode = pXMLChild;
wsCurValueTextBuf << wsText;
- } else if (XFA_RecognizeRichText(
- static_cast<CFDE_XMLElement*>(pXMLChild))) {
- XFA_GetPlainTextFromRichText(static_cast<CFDE_XMLElement*>(pXMLChild),
+ } else if (XFA_RecognizeRichText(static_cast<CFX_XMLElement*>(pXMLChild))) {
+ XFA_GetPlainTextFromRichText(static_cast<CFX_XMLElement*>(pXMLChild),
wsText);
if (!pXMLCurValueNode)
pXMLCurValueNode = pXMLChild;
@@ -1174,7 +1169,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
return;
CFX_WideString wsNodeStr =
- static_cast<CFDE_XMLElement*>(pXMLChild)->GetLocalTagName();
+ static_cast<CFX_XMLElement*>(pXMLChild)->GetLocalTagName();
pXFAChild->SetCData(XFA_ATTRIBUTE_Name, wsNodeStr);
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
pXFANode->InsertChild(pXFAChild);
@@ -1209,7 +1204,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
}
void CXFA_SimpleParser::ParseInstruction(CXFA_Node* pXFANode,
- CFDE_XMLInstruction* pXMLInstruction,
+ CFX_XMLInstruction* pXMLInstruction,
XFA_XDPPACKET ePacketID) {
if (!m_bDocumentParser)
return;
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.h b/xfa/fxfa/parser/cxfa_simple_parser.h
index 88a7679e74..cb1efcc1d5 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.h
+++ b/xfa/fxfa/parser/cxfa_simple_parser.h
@@ -13,10 +13,10 @@
class CXFA_Document;
class CXFA_Node;
-class CFDE_XMLDoc;
-class CFDE_XMLInstruction;
-class CFDE_XMLNode;
-class CFDE_XMLParser;
+class CFX_XMLDoc;
+class CFX_XMLInstruction;
+class CFX_XMLNode;
+class CFX_XMLParser;
class IFX_SeekableStream;
class IFX_Pause;
class CFX_SeekableStreamProxy;
@@ -29,55 +29,55 @@ class CXFA_SimpleParser {
int32_t StartParse(const CFX_RetainPtr<IFX_SeekableStream>& pStream,
XFA_XDPPACKET ePacketID);
int32_t DoParse(IFX_Pause* pPause);
- CFDE_XMLNode* ParseXMLData(const CFX_ByteString& wsXML, IFX_Pause* pPause);
- void ConstructXFANode(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLNode);
+ CFX_XMLNode* ParseXMLData(const CFX_ByteString& wsXML, IFX_Pause* pPause);
+ void ConstructXFANode(CXFA_Node* pXFANode, CFX_XMLNode* pXMLNode);
CXFA_Node* GetRootNode() const;
- CFDE_XMLDoc* GetXMLDoc() const;
+ CFX_XMLDoc* GetXMLDoc() const;
void CloseParser();
void SetFactory(CXFA_Document* pFactory);
private:
- CXFA_Node* ParseAsXDPPacket(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_XDP(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_XDP(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_Config(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_Config(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_TemplateForm(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_TemplateForm(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_Data(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_Data(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
CXFA_Node* ParseAsXDPPacket_LocaleConnectionSourceSet(
- CFDE_XMLNode* pXMLDocumentNode,
+ CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_Xdc(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_Xdc(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
- CXFA_Node* ParseAsXDPPacket_User(CFDE_XMLNode* pXMLDocumentNode,
+ CXFA_Node* ParseAsXDPPacket_User(CFX_XMLNode* pXMLDocumentNode,
XFA_XDPPACKET ePacketID);
CXFA_Node* NormalLoader(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLDoc,
+ CFX_XMLNode* pXMLDoc,
XFA_XDPPACKET ePacketID,
bool bUseAttribute);
CXFA_Node* DataLoader(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLDoc,
+ CFX_XMLNode* pXMLDoc,
bool bDoTransform);
- CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFDE_XMLNode* pXMLDoc);
+ CXFA_Node* UserPacketLoader(CXFA_Node* pXFANode, CFX_XMLNode* pXMLDoc);
void ParseContentNode(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID);
void ParseDataValue(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID);
void ParseDataGroup(CXFA_Node* pXFANode,
- CFDE_XMLNode* pXMLNode,
+ CFX_XMLNode* pXMLNode,
XFA_XDPPACKET ePacketID);
void ParseInstruction(CXFA_Node* pXFANode,
- CFDE_XMLInstruction* pXMLInstruction,
+ CFX_XMLInstruction* pXMLInstruction,
XFA_XDPPACKET ePacketID);
- CFDE_XMLParser* m_pXMLParser;
- std::unique_ptr<CFDE_XMLDoc> m_pXMLDoc;
+ CFX_XMLParser* m_pXMLParser;
+ std::unique_ptr<CFX_XMLDoc> m_pXMLDoc;
CFX_RetainPtr<CFX_SeekableStreamProxy> m_pStream;
CFX_RetainPtr<IFX_SeekableStream> m_pFileRead;
CXFA_Document* m_pFactory;
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 82aec1f00d..f338595605 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -10,9 +10,9 @@
#include <vector>
#include "core/fxcrt/fx_ext.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
#include "third_party/base/stl_util.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
@@ -142,8 +142,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
image.GetContentType(wsContentType);
image.GetHref(wsHref);
}
- CFDE_XMLElement* pXMLDataElement =
- static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
+ CFX_XMLElement* pXMLDataElement =
+ static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
pDataNode->SetAttributeValue(wsValue, wsFormattedValue);
@@ -168,10 +168,10 @@ void CreateDataBinding(CXFA_Node* pFormNode,
pValue->SetCData(XFA_ATTRIBUTE_Value, text);
}
} else {
- CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
- ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element);
- static_cast<CFDE_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
- L"dataGroup");
+ CFX_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode();
+ ASSERT(pXMLNode->GetType() == FX_XMLNODE_Element);
+ static_cast<CFX_XMLElement*>(pXMLNode)->SetString(L"xfa:dataNode",
+ L"dataGroup");
}
} else if (!wsValue.IsEmpty()) {
pWidgetData->GetFormatDataValue(wsValue, wsFormattedValue);
@@ -281,8 +281,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
XFA_Element::Image);
CXFA_Image image = defValue.GetImage();
if (image) {
- CFDE_XMLElement* pXMLDataElement =
- static_cast<CFDE_XMLElement*>(pDataNode->GetXMLMappingNode());
+ CFX_XMLElement* pXMLDataElement =
+ static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode());
ASSERT(pXMLDataElement);
CFX_WideString wsContentType =
@@ -1356,7 +1356,7 @@ CXFA_Node* CXFA_Document::GetNotBindNode(
void CXFA_Document::DoDataMerge() {
CXFA_Node* pDatasetsRoot = ToNode(GetXFAObject(XFA_HASHCODE_Datasets));
if (!pDatasetsRoot) {
- CFDE_XMLElement* pDatasetsXMLNode = new CFDE_XMLElement(L"xfa:datasets");
+ CFX_XMLElement* pDatasetsXMLNode = new CFX_XMLElement(L"xfa:datasets");
pDatasetsXMLNode->SetString(L"xmlns:xfa",
L"http://www.xfa.org/schema/xfa-data/1.0/");
pDatasetsRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataModel);
@@ -1392,7 +1392,7 @@ void CXFA_Document::DoDataMerge() {
}
if (!pDataRoot) {
- CFDE_XMLElement* pDataRootXMLNode = new CFDE_XMLElement(L"xfa:data");
+ CFX_XMLElement* pDataRootXMLNode = new CFX_XMLElement(L"xfa:data");
pDataRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataGroup);
pDataRoot->SetCData(XFA_ATTRIBUTE_Name, L"data");
pDataRoot->SetXMLMappingNode(pDataRootXMLNode);
@@ -1441,8 +1441,8 @@ void CXFA_Document::DoDataMerge() {
CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name);
CFX_WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form"
: wsFormName);
- CFDE_XMLElement* pDataTopLevelXMLNode =
- new CFDE_XMLElement(wsDataTopLevelName);
+ CFX_XMLElement* pDataTopLevelXMLNode =
+ new CFX_XMLElement(wsDataTopLevelName);
pDataTopLevel = CreateNode(XFA_XDPPACKET_Datasets, XFA_Element::DataGroup);
pDataTopLevel->SetCData(XFA_ATTRIBUTE_Name, wsDataTopLevelName);
diff --git a/xfa/fxfa/parser/xfa_utils.cpp b/xfa/fxfa/parser/xfa_utils.cpp
index 2ffba9b2e6..1c5adc75c9 100644
--- a/xfa/fxfa/parser/xfa_utils.cpp
+++ b/xfa/fxfa/parser/xfa_utils.cpp
@@ -9,10 +9,10 @@
#include <algorithm>
#include "core/fxcrt/fx_ext.h"
-#include "xfa/fde/xml/cfde_xmlchardata.h"
-#include "xfa/fde/xml/cfde_xmlelement.h"
-#include "xfa/fde/xml/cfde_xmlnode.h"
-#include "xfa/fde/xml/cfde_xmltext.h"
+#include "core/fxcrt/xml/cfx_xmlchardata.h"
+#include "core/fxcrt/xml/cfx_xmlelement.h"
+#include "core/fxcrt/xml/cfx_xmlnode.h"
+#include "core/fxcrt/xml/cfx_xmltext.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
@@ -171,14 +171,14 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) {
return CXFA_LocaleValue(iVTType, pWidgetData->GetRawValue(),
pWidgetData->GetNode()->GetDocument()->GetLocalMgr());
}
-void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
+void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode,
CFX_WideString& wsPlainText) {
if (!pXMLNode) {
return;
}
switch (pXMLNode->GetType()) {
- case FDE_XMLNODE_Element: {
- CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode);
+ case FX_XMLNODE_Element: {
+ CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLNode);
CFX_WideString wsTag = pXMLElement->GetLocalTagName();
uint32_t uTag = FX_HashCode_GetW(wsTag.AsStringC(), true);
if (uTag == 0x0001f714) {
@@ -195,20 +195,18 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
}
break;
}
- case FDE_XMLNODE_Text:
- case FDE_XMLNODE_CharData: {
- CFX_WideString wsContent =
- static_cast<CFDE_XMLText*>(pXMLNode)->GetText();
+ case FX_XMLNODE_Text:
+ case FX_XMLNODE_CharData: {
+ CFX_WideString wsContent = static_cast<CFX_XMLText*>(pXMLNode)->GetText();
wsPlainText += wsContent;
break;
}
default:
break;
}
- for (CFDE_XMLNode* pChildXML =
- pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild);
+ for (CFX_XMLNode* pChildXML = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
pChildXML;
- pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) {
+ pChildXML = pChildXML->GetNodeItem(CFX_XMLNode::NextSibling)) {
XFA_GetPlainTextFromRichText(pChildXML, wsPlainText);
}
}
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 80f6d096ed..bc05381fc3 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -10,8 +10,8 @@
#include "core/fxcrt/cfx_seekablestreamproxy.h"
#include "xfa/fxfa/fxfa_basic.h"
-class CFDE_XMLElement;
-class CFDE_XMLNode;
+class CFX_XMLElement;
+class CFX_XMLNode;
class CXFA_LocaleValue;
class CXFA_Node;
class CXFA_WidgetData;
@@ -20,7 +20,7 @@ double XFA_GetFractionalScale(uint32_t idx);
int XFA_GetMaxFractionalScale();
bool XFA_FDEExtension_ResolveNamespaceQualifier(
- CFDE_XMLElement* pNode,
+ CFX_XMLElement* pNode,
const CFX_WideStringC& wsQualifier,
CFX_WideString* wsNamespaceURI);
@@ -147,8 +147,8 @@ CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData);
double XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal);
int32_t XFA_MapRotation(int32_t nRotation);
-bool XFA_RecognizeRichText(CFDE_XMLElement* pRichTextXMLNode);
-void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode,
+bool XFA_RecognizeRichText(CFX_XMLElement* pRichTextXMLNode);
+void XFA_GetPlainTextFromRichText(CFX_XMLNode* pXMLNode,
CFX_WideString& wsPlainText);
bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode);