From 6b4ca9e68925b85d42ac18aeece33be62d92ca3b Mon Sep 17 00:00:00 2001 From: lihucheng Date: Tue, 5 Jul 2022 15:05:02 +0800 Subject: [PATCH] Fix the missing attribute of xmlPullParse parsing result Fix the xml logical code issue:https://gitee.com/openharmony/js_api_module/issues/I5FHP8 Signed-off-by: lihucheng --- xml/js_xml.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xml/js_xml.cpp b/xml/js_xml.cpp index 082edfb..c6f70e2 100644 --- a/xml/js_xml.cpp +++ b/xml/js_xml.cpp @@ -531,7 +531,9 @@ namespace OHOS::xml { napi_call_function(env, global, attrFunc_, argc, argv, &returnVal); bool bRec = false; napi_get_value_bool(env, returnVal, &bRec); - return bRec; + if (!bRec) { + return bRec; + } } return true; } @@ -560,6 +562,7 @@ namespace OHOS::xml { } if (attrFunc_ && attriCount_) { bRec = ParseAttri(env, thisVar); + attriCount_ = 0; } if (attrFunc_ && attriCount_ && !bRec) { break; @@ -898,7 +901,7 @@ namespace OHOS::xml { bool throwOnResolveFailure, TextEnum textEnum) { size_t start = position_; - std::string result = " "; + std::string result = ""; if (textEnum == TextEnum::TEXT && text_ != "") { result.append(text_); }