Skip to content

Commit 936e007

Browse files
author
door7302
committed
fix issue for merge option
1 parent 7c4a1a1 commit 936e007

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

parser/parser.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func StreamData(m string, s string, payload ...string) {
9595

9696
}
9797

98-
func advancedSplit(path string) []string {
98+
func advancedSplit(path string, merge bool) []string {
9999

100100
if strings.Contains(path, "=") && strings.Contains(path, "[") {
101101
var newPath string
@@ -118,7 +118,15 @@ func advancedSplit(path string) []string {
118118
newPath += string(w)
119119
}
120120
}
121-
return strings.Split(newPath, "£££")
121+
lp := strings.Split(newPath, "£££")
122+
if merge {
123+
for i, v := range lp {
124+
if strings.Contains(v, "=") {
125+
lp[i] = re1.ReplaceAllString(v, "x")
126+
}
127+
}
128+
}
129+
return lp
122130
}
123131
return strings.Split(path, "/")
124132
}
@@ -192,11 +200,8 @@ func parseXpath(xpath string, value string, merge bool) error {
192200

193201
key = make([]string, 0)
194202

195-
if merge {
196-
xpath = re1.ReplaceAllString(xpath, "x")
197-
}
198-
StreamData(fmt.Sprintf("XPATH Extracted: %s", xpath), "OK")
199-
lpath := advancedSplit(xpath)
203+
lpath := advancedSplit(xpath, merge)
204+
StreamData(fmt.Sprintf("XPATH Extracted: %s", strings.Join(lpath, "/")), "OK")
200205

201206
parent = root
202207
for i, v := range lpath {

0 commit comments

Comments
 (0)