summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_simple_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_simple_parser.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_simple_parser.cpp75
1 files changed, 27 insertions, 48 deletions
diff --git a/xfa/fxfa/parser/cxfa_simple_parser.cpp b/xfa/fxfa/parser/cxfa_simple_parser.cpp
index f21506d557..eee5cb3d83 100644
--- a/xfa/fxfa/parser/cxfa_simple_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_simple_parser.cpp
@@ -106,19 +106,16 @@ CFX_XMLNode* GetDocumentNode(CFX_XMLDoc* pXMLDoc,
if (!pXMLDoc)
return nullptr;
- for (CFX_XMLNode* pXMLNode =
- pXMLDoc->GetRoot()->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLNode; pXMLNode = pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLNode = pXMLDoc->GetRoot()->GetFirstChild(); pXMLNode;
+ pXMLNode = pXMLNode->GetNextSibling()) {
if (pXMLNode->GetType() != FX_XMLNODE_Element)
continue;
if (!bVerifyWellFormness)
return pXMLNode;
- for (CFX_XMLNode* pNextNode =
- pXMLNode->GetNodeItem(CFX_XMLNode::NextSibling);
- pNextNode;
- pNextNode = pNextNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pNextNode = pXMLNode->GetNextSibling(); pNextNode;
+ pNextNode = pNextNode->GetNextSibling()) {
if (pNextNode->GetType() == FX_XMLNODE_Element)
return nullptr;
}
@@ -249,10 +246,8 @@ CFX_XMLNode* GetDataSetsFromXDP(CFX_XMLNode* pXMLDocumentNode) {
return nullptr;
}
- for (CFX_XMLNode* pDatasetsNode =
- pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pDatasetsNode;
- pDatasetsNode = pDatasetsNode->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pDatasetsNode = pXMLDocumentNode->GetFirstChild();
+ pDatasetsNode; pDatasetsNode = pDatasetsNode->GetNextSibling()) {
if (MatchNodeName(pDatasetsNode, datasets_packet->name,
datasets_packet->uri, datasets_packet->flags)) {
return pDatasetsNode;
@@ -267,10 +262,8 @@ bool IsStringAllWhitespace(WideString wsText) {
}
void ConvertXMLToPlainText(CFX_XMLElement* pRootXMLNode, WideString& wsOutput) {
- for (CFX_XMLNode* pXMLChild =
- pRootXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pRootXMLNode->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
switch (pXMLChild->GetType()) {
case FX_XMLNODE_Element: {
WideString wsTextData =
@@ -328,9 +321,8 @@ WideString GetPlainTextFromRichText(CFX_XMLNode* pXMLNode) {
default:
break;
}
- for (CFX_XMLNode* pChildXML = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pChildXML;
- pChildXML = pChildXML->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pChildXML = pXMLNode->GetFirstChild(); pChildXML;
+ pChildXML = pChildXML->GetNextSibling()) {
wsPlainText += GetPlainTextFromRichText(pChildXML);
}
@@ -423,10 +415,8 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
XFA_PacketType ePacketID = pXFANode->GetPacketType();
if (ePacketID == XFA_PacketType::Datasets) {
if (pXFANode->GetElementType() == XFA_Element::DataValue) {
- for (CFX_XMLNode* pXMLChild =
- pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
if (eNodeType == FX_XMLNODE_Instruction)
continue;
@@ -526,10 +516,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
CFX_XMLNode* pXMLConfigDOMRoot = nullptr;
CXFA_Node* pXFAConfigDOMRoot = nullptr;
- for (CFX_XMLNode* pChildItem =
- pXMLDocumentNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pChildItem;
- pChildItem = pChildItem->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pChildItem = pXMLDocumentNode->GetFirstChild(); pChildItem;
+ pChildItem = pChildItem->GetNextSibling()) {
const PacketInfo* pPacketInfo = GetPacketByIndex(XFA_PacketType::Config);
if (!MatchNodeName(pChildItem, pPacketInfo->name, pPacketInfo->uri,
pPacketInfo->flags)) {
@@ -547,10 +535,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP(
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(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pChildItem = pXMLDocumentNode->GetFirstChild(); pChildItem;
+ pChildItem = pChildItem->GetNextSibling()) {
if (!pChildItem || pChildItem->GetType() != FX_XMLNODE_Element)
continue;
if (pChildItem == pXMLConfigDOMRoot)
@@ -754,8 +740,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
pDataXMLNode = pXMLDocumentNode;
} else {
CFX_XMLElement* pDataElement = new CFX_XMLElement(L"xfa:data");
- CFX_XMLNode* pParentXMLNode =
- pXMLDocumentNode->GetNodeItem(CFX_XMLNode::Parent);
+ CFX_XMLNode* pParentXMLNode = pXMLDocumentNode->GetParent();
if (pParentXMLNode)
pParentXMLNode->RemoveChildNode(pXMLDocumentNode);
@@ -863,9 +848,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode,
XFA_PacketType ePacketID,
bool bUseAttribute) {
bool bOneOfPropertyFound = false;
- for (CFX_XMLNode* pXMLChild = pXMLDoc->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pXMLDoc->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
switch (pXMLChild->GetType()) {
case FX_XMLNODE_Element: {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
@@ -958,9 +942,8 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
pXFANode->SetXMLMappingNode(pXMLNode);
WideString wsValue;
- for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
if (eNodeType == FX_XMLNODE_Instruction)
continue;
@@ -1003,9 +986,8 @@ void CXFA_SimpleParser::ParseContentNode(CXFA_Node* pXFANode,
void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
CFX_XMLNode* pXMLNode,
XFA_PacketType ePacketID) {
- for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
switch (pXMLChild->GetType()) {
case FX_XMLNODE_Element: {
CFX_XMLElement* pXMLElement = static_cast<CFX_XMLElement*>(pXMLChild);
@@ -1040,10 +1022,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
}
}
if (eNodeType == XFA_Element::DataModel) {
- for (CFX_XMLNode* pXMLDataChild =
- pXMLElement->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNodeItem(
- CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLDataChild = pXMLElement->GetFirstChild();
+ pXMLDataChild; pXMLDataChild = pXMLDataChild->GetNextSibling()) {
if (pXMLDataChild->GetType() == FX_XMLNODE_Element) {
if (!XFA_RecognizeRichText(
static_cast<CFX_XMLElement*>(pXMLDataChild))) {
@@ -1145,9 +1125,8 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
CFX_WideTextBuf wsCurValueTextBuf;
bool bMarkAsCompound = false;
CFX_XMLNode* pXMLCurValueNode = nullptr;
- for (CFX_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFX_XMLNode::FirstChild);
- pXMLChild;
- pXMLChild = pXMLChild->GetNodeItem(CFX_XMLNode::NextSibling)) {
+ for (CFX_XMLNode* pXMLChild = pXMLNode->GetFirstChild(); pXMLChild;
+ pXMLChild = pXMLChild->GetNextSibling()) {
FX_XMLNODETYPE eNodeType = pXMLChild->GetType();
if (eNodeType == FX_XMLNODE_Instruction)
continue;