diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_dataexporter.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_document.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 32 |
3 files changed, 28 insertions, 23 deletions
diff --git a/xfa/fxfa/parser/cxfa_dataexporter.cpp b/xfa/fxfa/parser/cxfa_dataexporter.cpp index f7715dc374..c86a7f7d51 100644 --- a/xfa/fxfa/parser/cxfa_dataexporter.cpp +++ b/xfa/fxfa/parser/cxfa_dataexporter.cpp @@ -152,12 +152,13 @@ void RecognizeXFAVersionNumber(CXFA_Node* pTemplateRoot, if (!pTemplateRoot) return; - WideString wsTemplateNS; - if (!pTemplateRoot->JSNode()->TryNamespace(wsTemplateNS)) + pdfium::Optional<WideString> templateNS = + pTemplateRoot->JSNode()->TryNamespace(); + if (!templateNS) return; XFA_VERSION eVersion = - pTemplateRoot->GetDocument()->RecognizeXFAVersionNumber(wsTemplateNS); + pTemplateRoot->GetDocument()->RecognizeXFAVersionNumber(*templateNS); if (eVersion == XFA_VERSION_UNKNOWN) eVersion = XFA_VERSION_DEFAULT; diff --git a/xfa/fxfa/parser/cxfa_document.cpp b/xfa/fxfa/parser/cxfa_document.cpp index 82a71dea28..44fc9089c1 100644 --- a/xfa/fxfa/parser/cxfa_document.cpp +++ b/xfa/fxfa/parser/cxfa_document.cpp @@ -151,14 +151,16 @@ CXFA_Object* CXFA_Document::GetXFAObject(XFA_HashCode dwNodeNameHash) { if (pDatasetsChild->GetNameHash() != XFA_HASHCODE_Data) continue; - WideString wsNamespaceURI; - if (!pDatasetsChild->JSNode()->TryNamespace(wsNamespaceURI)) + pdfium::Optional<WideString> namespaceURI = + pDatasetsChild->JSNode()->TryNamespace(); + if (!namespaceURI) continue; - WideString wsDatasetsURI; - if (!pDatasetsNode->JSNode()->TryNamespace(wsDatasetsURI)) + pdfium::Optional<WideString> datasetsURI = + pDatasetsNode->JSNode()->TryNamespace(); + if (!datasetsURI) continue; - if (wsNamespaceURI == wsDatasetsURI) + if (*namespaceURI == *datasetsURI) return pDatasetsChild; } return nullptr; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 4cf7601531..89a6500fa6 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -1052,12 +1052,11 @@ CXFA_Node* MaybeCreateDataNode(CXFA_Document* pDocument, if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) continue; - WideString wsNamespace; - if (!pDDGroupNode->JSNode()->TryNamespace(wsNamespace) || - wsNamespace != L"http://ns.adobe.com/data-description/") { + pdfium::Optional<WideString> ns = pDDGroupNode->JSNode()->TryNamespace(); + if (!ns || *ns != L"http://ns.adobe.com/data-description/") continue; - } } + CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(wsName.AsStringView()); if (!pDDNode) @@ -1231,12 +1230,12 @@ void UpdateDataRelation(CXFA_Node* pDataNode, CXFA_Node* pDataDescriptionNode) { if (pDDGroupNode->GetElementType() != XFA_Element::DataGroup) continue; - WideString wsNamespace; - if (!pDDGroupNode->JSNode()->TryNamespace(wsNamespace) || - wsNamespace != L"http://ns.adobe.com/data-description/") { + pdfium::Optional<WideString> ns = + pDDGroupNode->JSNode()->TryNamespace(); + if (!ns || *ns != L"http://ns.adobe.com/data-description/") continue; - } } + CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(dwNameHash); if (!pDDNode) continue; @@ -1398,8 +1397,8 @@ void CXFA_Document::DoDataMerge() { pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); } CXFA_Node *pDataRoot = nullptr, *pDDRoot = nullptr; - WideString wsDatasetsURI; - pDatasetsRoot->JSNode()->TryNamespace(wsDatasetsURI); + WideString wsDatasetsURI = + pDatasetsRoot->JSNode()->TryNamespace().value_or(WideString()); for (CXFA_Node* pChildNode = pDatasetsRoot->GetNodeItem(XFA_NODEITEM_FirstChild); pChildNode; @@ -1407,16 +1406,19 @@ void CXFA_Document::DoDataMerge() { if (pChildNode->GetElementType() != XFA_Element::DataGroup) continue; - WideString wsNamespaceURI; if (!pDDRoot && pChildNode->GetNameHash() == XFA_HASHCODE_DataDescription) { - if (!pChildNode->JSNode()->TryNamespace(wsNamespaceURI)) + pdfium::Optional<WideString> namespaceURI = + pChildNode->JSNode()->TryNamespace(); + if (!namespaceURI) continue; - if (wsNamespaceURI == L"http://ns.adobe.com/data-description/") + if (*namespaceURI == L"http://ns.adobe.com/data-description/") pDDRoot = pChildNode; } else if (!pDataRoot && pChildNode->GetNameHash() == XFA_HASHCODE_Data) { - if (!pChildNode->JSNode()->TryNamespace(wsNamespaceURI)) + pdfium::Optional<WideString> namespaceURI = + pChildNode->JSNode()->TryNamespace(); + if (!namespaceURI) continue; - if (wsNamespaceURI == wsDatasetsURI) + if (*namespaceURI == wsDatasetsURI) pDataRoot = pChildNode; } if (pDataRoot && pDDRoot) |