Mock Version: 3.5 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target aarch64 --nodeps /builddir/build/SPECS/golang-github-clbanning-x2j.spec'], chrootPath='/var/lib/mock/fedora-rawhide-aarch64-1674444972.957959/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=0uid=1001gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11']unshare_net=TrueprintOutput=True) Using nspawn with args ['--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', 'f8b1cf73791049afb903b2dd53a9a9bd', '-D', '/var/lib/mock/fedora-rawhide-aarch64-1674444972.957959/root', '-a', '-u', 'mockbuild', '--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11', '--console=pipe', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=C.UTF-8', '--resolv-conf=off', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target aarch64 --nodeps /builddir/build/SPECS/golang-github-clbanning-x2j.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'SYSTEMD_NSPAWN_TMPFS_TMP': '0', 'SYSTEMD_SECCOMP': '0'} and shell False Building target platforms: aarch64 Building for target aarch64 setting SOURCE_DATE_EPOCH=1674086400 Wrote: /builddir/build/SRPMS/golang-github-clbanning-x2j-1.1-9.fc38.src.rpm Child return code was: 0 ENTER ['do_with_status'](['bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target aarch64 --nodeps /builddir/build/SPECS/golang-github-clbanning-x2j.spec'], chrootPath='/var/lib/mock/fedora-rawhide-aarch64-1674444972.957959/root'env={'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8'}shell=Falselogger=timeout=0uid=1001gid=135user='mockbuild'nspawn_args=['--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11']unshare_net=TrueprintOutput=True) Using nspawn with args ['--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11'] Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', 'df6f29477ad344c8bb862dc6dcbc9659', '-D', '/var/lib/mock/fedora-rawhide-aarch64-1674444972.957959/root', '-a', '-u', 'mockbuild', '--capability=cap_ipc_lock', '--rlimit=RLIMIT_NOFILE=10240', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.ou2nix_g:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11', '--console=pipe', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;\\007"', '--setenv=PS1= \\s-\\v\\$ ', '--setenv=LANG=C.UTF-8', '--resolv-conf=off', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bb --target aarch64 --nodeps /builddir/build/SPECS/golang-github-clbanning-x2j.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;\\007"', 'PS1': ' \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'SYSTEMD_NSPAWN_TMPFS_TMP': '0', 'SYSTEMD_SECCOMP': '0'} and shell False Building target platforms: aarch64 Building for target aarch64 setting SOURCE_DATE_EPOCH=1674086400 Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.e3W0AB + umask 022 + cd /builddir/build/BUILD + cd /builddir/build/BUILD + rm -rf x2j-1.1 + /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/x2j-1.1.tar.gz + STATUS=0 + '[' 0 -ne 0 ']' + cd x2j-1.1 + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . + rm -fr /builddir/build/BUILD/x2j-1.1/vendor + [[ ! -e /builddir/build/BUILD/x2j-1.1/_build/bin ]] + install -m 0755 -vd /builddir/build/BUILD/x2j-1.1/_build/bin install: creating directory '/builddir/build/BUILD/x2j-1.1/_build' install: creating directory '/builddir/build/BUILD/x2j-1.1/_build/bin' + export GOPATH=/builddir/build/BUILD/x2j-1.1/_build:/usr/share/gocode + GOPATH=/builddir/build/BUILD/x2j-1.1/_build:/usr/share/gocode + [[ ! -e /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning/x2j ]] ++ dirname /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning/x2j + install -m 0755 -vd /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning install: creating directory '/builddir/build/BUILD/x2j-1.1/_build/src' install: creating directory '/builddir/build/BUILD/x2j-1.1/_build/src/github.com' install: creating directory '/builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning' + ln -fs /builddir/build/BUILD/x2j-1.1 /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning/x2j + cd /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning/x2j Patch #0 (0001-Remove-redundant-newlines-in-Println-statement.patch): + echo 'Patch #0 (0001-Remove-redundant-newlines-in-Println-statement.patch):' + /usr/bin/patch --no-backup-if-mismatch -f -p1 --fuzz=0 patching file examples/gonuts2.go patching file x2j_test.go patching file x2jpath_test.go + RPM_EC=0 ++ jobs -p + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.OdjDrS + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 '!=' / ']' + rm -rf /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 ++ dirname /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 + cd x2j-1.1 + cd /builddir/build/BUILD/x2j-1.1/_build/src/github.com/clbanning/x2j + IFS= + gosupfiles= + mapfile -t gosupfilesA + go-rpm-integration install -i github.com/clbanning/x2j -b /builddir/build/BUILD/x2j-1.1/_build/bin -s /builddir/build/BUILD/x2j-1.1/_build -o golang-github-clbanning-x2j-devel.file-list -O /builddir/build/BUILD/x2j-1.1 -V 1.1-9.fc38 -T 1.1 -p /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 -g /usr/share/gocode -r '.*example.*' Installing: github.com/clbanning/x2j realpath: go.mod: No such file or directory + IFS= +++ realpath -e --relative-base=. examples README +++ sort -u ++ listfiles_include='README examples' ++ echo 'README examples' + godocs='README examples' + [[ -n README examples ]] + IFS= + read -r f + echo %doc '"README"' + IFS= + read -r f + echo %doc '"examples"' + IFS= + read -r f + IFS= +++ sort -u +++ realpath -e --relative-base=. LICENSE ++ listfiles_include=LICENSE ++ echo LICENSE + golicenses=LICENSE + [[ -n LICENSE ]] + IFS= + read -r f + echo %license '"LICENSE"' + IFS= + read -r f + /usr/lib/rpm/check-buildroot + /usr/lib/rpm/redhat/brp-ldconfig + /usr/lib/rpm/brp-compress + /usr/lib/rpm/brp-strip /usr/bin/strip + /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump + /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip + /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip + /usr/lib/rpm/check-rpaths + /usr/lib/rpm/redhat/brp-mangle-shebangs + /usr/lib/rpm/brp-remove-la-files + env /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0 -j4 + /usr/lib/rpm/redhat/brp-python-hardlink Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.kfXLAb + umask 022 + cd /builddir/build/BUILD + cd x2j-1.1 + LDFLAGS=' -X github.com/clbanning/x2j/version=1.1 -X github.com/clbanning/x2j/version.tag=1.1' + GO_TEST_FLAGS='-buildmode pie -compiler gc' + GO_TEST_EXT_LD_FLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' + go-rpm-integration check -i github.com/clbanning/x2j -b /builddir/build/BUILD/x2j-1.1/_build/bin -s /builddir/build/BUILD/x2j-1.1/_build -V 1.1-9.fc38 -T 1.1 -p /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 -g /usr/share/gocode -r '.*example.*' Testing in: /builddir/build/BUILD/x2j-1.1/_build/src PATH: /builddir/build/BUILD/x2j-1.1/_build/bin:/builddir/.local/bin:/builddir/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin GOPATH: /builddir/build/BUILD/x2j-1.1/_build:/usr/share/gocode GO111MODULE: off command: go test -buildmode pie -compiler gc -ldflags " -X github.com/clbanning/x2j/version=1.1 -X github.com/clbanning/x2j/version.tag=1.1 -extldflags '-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes '" testing: github.com/clbanning/x2j github.com/clbanning/x2j TestGoofy ... MapToDoc: map[byteVal:[116 104 101 32 97 105 100 32 111 102 32 116 104 101 105 114 32 99 111 117 110 116 114 121] goofyVal:0x400000c0d8 nilVal: xml:map[tag:map[-bool:true -one:1 -pi:3.1415962535] tagJR:map[-key:value]]] v: {"byteVal":"dGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5","goofyVal":{"S":"Now is the time for","Sp":"all good men to come to"},"nilVal":null,"xml":{"tag":{"-bool":"true","-one":"1","-pi":"3.1415962535"},"tagJR":{"-key":"value"}}} TestGoofier ... MapToDoc: map[byteVal:[116 104 101 32 97 105 100 32 111 102 32 116 104 101 105 114 32 99 111 117 110 116 114 121] goofierVal:0x4000010a20 goofyVal:0x400000c0d8 nilVal: xml:map[tag:map[-bool:true -one:1 -pi:3.1415962535] tagJR:map[-key:value]]] v: {"byteVal":"dGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5","goofierVal":{"G":{"S":"Now is the time for","Sp":"all good men to come to"},"B":"dGhlIHRyZWUgb2YgZnJlZWRvbSBtdXN0IHBlcmlvZGljYWxseSBiZQ==","N":null},"goofyVal":{"S":"Now is the time for","Sp":"all good men to come to"},"nilVal":null,"xml":{"tag":{"-bool":"true","-one":"1","-pi":"3.1415962535"},"tagJR":{"-key":"value"}}} ToTree - Read doc: barworld entry : vars : foo : bar foo2 : hello : world ToMap - Read doc: barworld entry : vars : foo :[string] bar foo2 : hello :[string] world ToJson - Read doc: barworld json: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ToJsonIndent - Read doc: barworld json: { "entry": { "vars": { "foo": "bar", "foo2": { "hello": "world" } } } } BulkParser (with error) - Read doc: barworldanbarworld phandler m: map[entry:map[vars:map[foo:bar foo2:map[hello:world]]]] ehandler err: XML syntax error on line 1: element closed by phandler m: map[entry:map[vars:map[foo:bar foo2:map[hello:world]]]] BulkParser (with error) - Read doc: barworldanbarworld phandlerj s: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ehandler err: XML syntax error on line 1: element closed by phandlerj s: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ================================ x2j_test.go ... =================== TestX2j ... XML doc: help me! Henry was a renegade Didn't like to play it safe One component at a time There's got to be a better way Oh, people came from miles around Searching for a steady job Welcome to the Motor Town Booming like an atom bomb Oh, Henry was the end of the story Then everything went wrong And we'll return it to its former glory But it just takes so long It's going to take a long time It's going to take it, but we'll make it one day It's going to take a long time It's going to take it, but we'll make it one day DocToTree(): msg : -mtype : alert -mpriority : 1 text : help me! song : -title : A Long Time -author : Mayer Hawthorne verses : verse : -name : verse 1 -no : 1 line : -no : 1 #text : Henry was a renegade line : -no : 2 #text : Didn't like to play it safe line : -no : 3 #text : One component at a time line : -no : 4 #text : There's got to be a better way line : -no : 5 #text : Oh, people came from miles around line : -no : 6 #text : Searching for a steady job line : -no : 7 #text : Welcome to the Motor Town line : -no : 8 #text : Booming like an atom bomb verse : -name : verse 2 -no : 2 line : -no : 1 #text : Oh, Henry was the end of the story line : -no : 2 #text : Then everything went wrong line : -no : 3 #text : And we'll return it to its former glory line : -no : 4 #text : But it just takes so long chorus : line : -no : 1 #text : It's going to take a long time line : -no : 2 #text : It's going to take it, but we'll make it one day line : -no : 3 #text : It's going to take a long time line : -no : 4 #text : It's going to take it, but we'll make it one day treeToMap, recast==false: msg : -mtype :[string] alert -mpriority :[string] 1 text :[string] help me! song : -title :[string] A Long Time -author :[string] Mayer Hawthorne verses : verse :[[]interface{}] [item: 0] -name :[string] verse 1 -no :[string] 1 line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] Henry was a renegade [item: 1] -no :[string] 2 #text :[string] Didn't like to play it safe [item: 2] -no :[string] 3 #text :[string] One component at a time [item: 3] #text :[string] There's got to be a better way -no :[string] 4 [item: 4] -no :[string] 5 #text :[string] Oh, people came from miles around [item: 5] -no :[string] 6 #text :[string] Searching for a steady job [item: 6] -no :[string] 7 #text :[string] Welcome to the Motor Town [item: 7] -no :[string] 8 #text :[string] Booming like an atom bomb [item: 1] -name :[string] verse 2 -no :[string] 2 line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] Oh, Henry was the end of the story [item: 1] -no :[string] 2 #text :[string] Then everything went wrong [item: 2] #text :[string] And we'll return it to its former glory -no :[string] 3 [item: 3] -no :[string] 4 #text :[string] But it just takes so long chorus : line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] It's going to take a long time [item: 1] -no :[string] 2 #text :[string] It's going to take it, but we'll make it one day [item: 2] -no :[string] 3 #text :[string] It's going to take a long time [item: 3] -no :[string] 4 #text :[string] It's going to take it, but we'll make it one day json.MarshalIndent, recast==false: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] }, { "-name": "verse 2", "-no": "2", "line": [ { "#text": "Oh, Henry was the end of the story", "-no": "1" }, { "#text": "Then everything went wrong", "-no": "2" }, { "#text": "And we'll return it to its former glory", "-no": "3" }, { "#text": "But it just takes so long", "-no": "4" } ] } ] } }, "text": "help me!" } } DocToMap(), recast==true: msg : -mtype :[string] alert -mpriority :[float64] 1.00e+00 text :[string] help me! song : -author :[string] Mayer Hawthorne verses : verse :[[]interface{}] [item: 0] -name :[string] verse 1 -no :[float64] 1.00e+00 line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] Henry was a renegade [item: 1] -no :[float64] 2.00e+00 #text :[string] Didn't like to play it safe [item: 2] -no :[float64] 3.00e+00 #text :[string] One component at a time [item: 3] -no :[float64] 4.00e+00 #text :[string] There's got to be a better way [item: 4] -no :[float64] 5.00e+00 #text :[string] Oh, people came from miles around [item: 5] -no :[float64] 6.00e+00 #text :[string] Searching for a steady job [item: 6] -no :[float64] 7.00e+00 #text :[string] Welcome to the Motor Town [item: 7] -no :[float64] 8.00e+00 #text :[string] Booming like an atom bomb [item: 1] -no :[float64] 2.00e+00 line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] Oh, Henry was the end of the story [item: 1] -no :[float64] 2.00e+00 #text :[string] Then everything went wrong [item: 2] -no :[float64] 3.00e+00 #text :[string] And we'll return it to its former glory [item: 3] -no :[float64] 4.00e+00 #text :[string] But it just takes so long -name :[string] verse 2 chorus : line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] It's going to take a long time [item: 1] -no :[float64] 2.00e+00 #text :[string] It's going to take it, but we'll make it one day [item: 2] -no :[float64] 3.00e+00 #text :[string] It's going to take a long time [item: 3] -no :[float64] 4.00e+00 #text :[string] It's going to take it, but we'll make it one day -title :[string] A Long Time DocToJsonIndent, recast==true: { "msg": { "-mpriority": 1, "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": 1 }, { "#text": "It's going to take it, but we'll make it one day", "-no": 2 }, { "#text": "It's going to take a long time", "-no": 3 }, { "#text": "It's going to take it, but we'll make it one day", "-no": 4 } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": 1, "line": [ { "#text": "Henry was a renegade", "-no": 1 }, { "#text": "Didn't like to play it safe", "-no": 2 }, { "#text": "One component at a time", "-no": 3 }, { "#text": "There's got to be a better way", "-no": 4 }, { "#text": "Oh, people came from miles around", "-no": 5 }, { "#text": "Searching for a steady job", "-no": 6 }, { "#text": "Welcome to the Motor Town", "-no": 7 }, { "#text": "Booming like an atom bomb", "-no": 8 } ] }, { "-name": "verse 2", "-no": 2, "line": [ { "#text": "Oh, Henry was the end of the story", "-no": 1 }, { "#text": "Then everything went wrong", "-no": 2 }, { "#text": "And we'll return it to its former glory", "-no": 3 }, { "#text": "But it just takes so long", "-no": 4 } ] } ] } }, "text": "help me!" } } =================== TestGetValue ... Read doc: barworld Looking for value: entry.vars { "foo": "bar", "foo2": { "hello": "world" } } Looking for value: entry.vars.foo2.hello world Looking with error in path: entry.var verr: no key in map: var DocValue() for tag path entry.vars { "foo": "bar", "foo2": { "hello": "world" } } =================== TestGetValueWithAttr ... Read doc: bar world universe Looking for value: entry.vars { "foo": [ { "#text": "bar", "-item": "1" }, { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } ] } MapValue(): Looking for value: entry.vars.foo item=2 { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } MapValue(): Looking for hello item:4 verr: no key in map: hello DocValue(): Looking for entry.vars.foo.hello item:4 verr: no keys beyond: foo DocValue(): Looking for empty nil { "entry": { "vars": { "foo": [ { "#text": "bar", "-item": "1" }, { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } ] } } } testing recast switch... MapValue(): Looking for value: entry.vars.foo item=2 { "-item": 2, "hello": [ { "#text": "world", "-item": 3 }, { "#text": "universe", "-item": 4 } ] } =================== TestStuff_1 ... val2 val2 val3 doc : tag :[[]interface{}] [item: 0] -item :[string] 1 #text :[string] val2 [item: 1] -item :[string] 2 #text :[string] val2 [item: 2] #text :[string] val3 -item :[string] 2 -instance :[string] 2 DocValue(): tag [ { "#text": "val2", "-item": "1" }, { "#text": "val2", "-item": "2" }, { "#text": "val3", "-instance": "2", "-item": "2" } ] DocValue(): item:2 instance:2 "val3" =================== TestStuff_2 ... val2 val2 val3 tag : #text :[string] val2 -item :[string] 1 DocValue(): tag { "#text": "val2", "-item": "1" } DocValue(): item:2 instance:2 verr: no attribute with name: instance =================== TestBulkBuffer ... Bulk Message Processing Tests procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] }, { "-name": "verse 2", "-no": "2", "line": [ { "#text": "Oh, Henry was the end of the story", "-no": "1" }, { "#text": "Then everything went wrong", "-no": "2" }, { "#text": "And we'll return it to its former glory", "-no": "3" }, { "#text": "But it just takes so long", "-no": "4" } ] } ] } }, "text": "help me!" } } procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "verses": { "verse": { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] } } }, "text": "help me!" } } procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] } }, "text": "help me!" } } procError err: XML syntax error on line 1: element closed by procError err: XML syntax error on line 1: unexpected end element =================== TestBulkBuffer ... Test arbitrary XML buffer with no ending rootTag - then read from closed buffer. m: map[doc:map[tag:]] m: map[doc:map[one:map[#text:my test doc -att:1]]] merr: XML syntax error on line 1: unexpected EOF err: Buffer is not active. =================== TestTagAndKey ... TestTagAndKey()
one
two.one two.two
one
two
tag: parts :: len: 2 v: [map[part:[two.one two.two]] map[sections:map[section:[one two]]]] no 'not_a_tag' tag key: section :: len: 2 v: [[one map[parts:map[part:[two.one two.two]]]] [one two]] no 'not_a_key' key ============================ x2jat_test.go =============== TestValuesAtKeyPath ... ValuesAtKeyPath ... doc1#author ss: [doc.books.book.author] vv: [map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]] ValuesAtKeyPath ... doc1#first_name ss: [doc.books.book.author.first_name] vv: [William H. Gaddis Austin Tappan Wright John Hawkes map[first_name:T.E. last_name:Porter]] GetKeyPaths...doc2#book ss: [doc.books.author.book doc.books.author.books.book] vv: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] vv: [map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]]] vv,shortest_path: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] ValuesAtKeyPath ... msg1#pub ss: [msg.pub] vv: [map[pub:test text:This is a long cold winter]] ValuesAtKeyPath ... msg2#pub ss: [msgs.msg.pub] vv: [map[pub:test text:This is a long cold winter] map[pub:test2 text:I hope we have a cool summer, though]] =============== TestValuesAtTagPath ... ValuesAtTagPath ... doc1#author ss: [doc.books.book.author] vv: [map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]] ValuesAtTagPath ... doc1#first_name ss: [doc.books.book.author.first_name] vv: [William H. Gaddis Austin Tappan Wright John Hawkes map[first_name:T.E. last_name:Porter]] ValuesAtTagPath...doc2#book ss: [doc.books.author.book doc.books.author.books.book] vv: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] vv: [map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]]] vv,shortest_path: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] ================================ x2jfindPath_test.go =============== TestPathsForKey ... PathsForKey... doc01#author ss: [doc.books.book.author] PathsForKey... doc01#books ss: [doc.books] PathsForKey...doc02#book ss: [doc.books.author.book doc.books.author.books.book] PathForKeyShortest...doc02#book s: doc.books.author.book =============== TestPathsForTag ... PathsForTag... doc01#author ss: [doc.books.book.author] PathsForTag... doc01#books ss: [doc.books] PathsForTag...doc02#book ss: [doc.books.author.book doc.books.author.books.book] PathForTagShortest...doc02#book s: doc.books.author.book TestValuesFromTagPath() William H. Gaddis The Recognitions One of the great seminal American novels of the 20th century. Austin Tappan Wright Islandia An example of earlier 20th century American utopian fiction. John Hawkes The Beetle Leg A lyrical novel about the construction of Ft. Peck Dam in Montana. T.E. Porter King's Day A magical novella. map: doc : books : book :[[]interface{}] [item: 0] -seq :[string] 1 author :[string] William H. Gaddis title :[string] The Recognitions review :[string] One of the great seminal American novels of the 20th century. [item: 1] -seq :[string] 2 author :[string] Austin Tappan Wright title :[string] Islandia review :[string] An example of earlier 20th century American utopian fiction. [item: 2] -seq :[string] 3 author :[string] John Hawkes title :[string] The Beetle Leg review :[string] A lyrical novel about the construction of Ft. Peck Dam in Montana. [item: 3] author : first_name :[string] T.E. last_name :[string] Porter title :[string] King's Day review :[string] A magical novella. -seq :[string] 4 path == doc.books: len(v): 1 0 : map[book:[map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]]] path == doc.books.*: len(v): 4 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] 1 : map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] 2 : map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] 3 : map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day] path == doc.books.book: len(v): 4 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] 1 : map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] 2 : map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] 3 : map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day] doc == doc2 / path == doc.books.book: len(v): 1 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] path == doc.books.book.*: len(v): 12 0 : William H. Gaddis 1 : The Recognitions 2 : One of the great seminal American novels of the 20th century. 3 : An example of earlier 20th century American utopian fiction. 4 : Austin Tappan Wright 5 : Islandia 6 : John Hawkes 7 : The Beetle Leg 8 : A lyrical novel about the construction of Ft. Peck Dam in Montana. 9 : King's Day 10 : A magical novella. 11 : map[first_name:T.E. last_name:Porter] doc == doc2 / path == doc.books.book.*: len(v): 3 0 : William H. Gaddis 1 : The Recognitions 2 : One of the great seminal American novels of the 20th century. path == doc.books.*.author: len(v): 4 0 : William H. Gaddis 1 : Austin Tappan Wright 2 : John Hawkes 3 : map[first_name:T.E. last_name:Porter] path == doc.*.*.author: len(v): 4 0 : William H. Gaddis 1 : Austin Tappan Wright 2 : John Hawkes 3 : map[first_name:T.E. last_name:Porter] path == doc.*.*.title: len(v): 4 0 : The Recognitions 1 : Islandia 2 : The Beetle Leg 3 : King's Day path == doc.*.*.*: len(v): 12 0 : William H. Gaddis 1 : The Recognitions 2 : One of the great seminal American novels of the 20th century. 3 : An example of earlier 20th century American utopian fiction. 4 : Austin Tappan Wright 5 : Islandia 6 : John Hawkes 7 : The Beetle Leg 8 : A lyrical novel about the construction of Ft. Peck Dam in Montana. 9 : A magical novella. 10 : map[first_name:T.E. last_name:Porter] 11 : King's Day path == doc.*.*.*.*: len(v): 2 0 : Porter 1 : T.E. TestValuesFromTagPath2(), iteration: 0 no default:text default:word map: data : netid : disable :[string] no text1 :[string] default:text word1 :[string] default:word path == data.*: len(v): 1 0 : map[disable:no text1:default:text word1:default:word] disable : no text1 : default:text word1 : default:word path == data.*.*: len(v): 3 0 : default:word 1 : no 2 : default:text TestValuesFromTagPath2(), iteration: 1 yes default:text default:word map: data : idnet : disable :[string] yes text1 :[string] default:text word1 :[string] default:word path == data.*: len(v): 1 0 : map[disable:yes text1:default:text word1:default:word] text1 : default:text word1 : default:word disable : yes path == data.*.*: len(v): 3 0 : yes 1 : default:text 2 : default:word Unmarshal test ... *map[string]interface{}, *string m: map[doc:map[name:Mayer Hawthorne song:map[title:A Long Time verse:map[-no:1 line:[map[#text:Henry was a renegade -no:1] map[#text:Didn't like to play it safe -no:2]]]]]] s: {"doc":{"name":"Mayer Hawthorne","song":{"title":"A Long Time","verse":{"-no":"1","line":[{"#text":"Henry was a renegade","-no":"1"},{"#text":"Didn't like to play it safe","-no":"2"}]}}}} Unmarshal test ... struct: clbanning
unknown
myInfo: {XMLName:{Space: Local:info} Name:clbanning Address:unknown} TestMapValue of doc.song.verse w/ len(attrs) == 0. doc: Mayer Hawthorne A Long Time Henry was a renegade Didn't like to play it safe result: map[-no:1 line:[map[#text:Henry was a renegade -no:1] map[#text:Didn't like to play it safe -no:2]]] PASS ok github.com/clbanning/x2j 0.006s github.com/clbanning/x2j TestGoofy ... MapToDoc: map[byteVal:[116 104 101 32 97 105 100 32 111 102 32 116 104 101 105 114 32 99 111 117 110 116 114 121] goofyVal:0x40000b20c0 nilVal: xml:map[tag:map[-bool:true -one:1 -pi:3.1415962535] tagJR:map[-key:value]]] v: {"byteVal":"dGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5","goofyVal":{"S":"Now is the time for","Sp":"all good men to come to"},"nilVal":null,"xml":{"tag":{"-bool":"true","-one":"1","-pi":"3.1415962535"},"tagJR":{"-key":"value"}}} TestGoofier ... MapToDoc: map[byteVal:[116 104 101 32 97 105 100 32 111 102 32 116 104 101 105 114 32 99 111 117 110 116 114 121] goofierVal:0x40000a29f0 goofyVal:0x40000b20c0 nilVal: xml:map[tag:map[-bool:true -one:1 -pi:3.1415962535] tagJR:map[-key:value]]] v: {"byteVal":"dGhlIGFpZCBvZiB0aGVpciBjb3VudHJ5","goofierVal":{"G":{"S":"Now is the time for","Sp":"all good men to come to"},"B":"dGhlIHRyZWUgb2YgZnJlZWRvbSBtdXN0IHBlcmlvZGljYWxseSBiZQ==","N":null},"goofyVal":{"S":"Now is the time for","Sp":"all good men to come to"},"nilVal":null,"xml":{"tag":{"-bool":"true","-one":"1","-pi":"3.1415962535"},"tagJR":{"-key":"value"}}} ToTree - Read doc: barworld entry : vars : foo : bar foo2 : hello : world ToMap - Read doc: barworld entry : vars : foo :[string] bar foo2 : hello :[string] world ToJson - Read doc: barworld json: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ToJsonIndent - Read doc: barworld json: { "entry": { "vars": { "foo": "bar", "foo2": { "hello": "world" } } } } BulkParser (with error) - Read doc: barworldanbarworld phandler m: map[entry:map[vars:map[foo:bar foo2:map[hello:world]]]] ehandler err: XML syntax error on line 1: element closed by phandler m: map[entry:map[vars:map[foo:bar foo2:map[hello:world]]]] BulkParser (with error) - Read doc: barworldanbarworld phandlerj s: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ehandler err: XML syntax error on line 1: element closed by phandlerj s: {"entry":{"vars":{"foo":"bar","foo2":{"hello":"world"}}}} ================================ x2j_test.go ... =================== TestX2j ... XML doc: help me! Henry was a renegade Didn't like to play it safe One component at a time There's got to be a better way Oh, people came from miles around Searching for a steady job Welcome to the Motor Town Booming like an atom bomb Oh, Henry was the end of the story Then everything went wrong And we'll return it to its former glory But it just takes so long It's going to take a long time It's going to take it, but we'll make it one day It's going to take a long time It's going to take it, but we'll make it one day DocToTree(): msg : -mtype : alert -mpriority : 1 text : help me! song : -title : A Long Time -author : Mayer Hawthorne verses : verse : -name : verse 1 -no : 1 line : -no : 1 #text : Henry was a renegade line : -no : 2 #text : Didn't like to play it safe line : -no : 3 #text : One component at a time line : -no : 4 #text : There's got to be a better way line : -no : 5 #text : Oh, people came from miles around line : -no : 6 #text : Searching for a steady job line : -no : 7 #text : Welcome to the Motor Town line : -no : 8 #text : Booming like an atom bomb verse : -name : verse 2 -no : 2 line : -no : 1 #text : Oh, Henry was the end of the story line : -no : 2 #text : Then everything went wrong line : -no : 3 #text : And we'll return it to its former glory line : -no : 4 #text : But it just takes so long chorus : line : -no : 1 #text : It's going to take a long time line : -no : 2 #text : It's going to take it, but we'll make it one day line : -no : 3 #text : It's going to take a long time line : -no : 4 #text : It's going to take it, but we'll make it one day treeToMap, recast==false: msg : -mpriority :[string] 1 text :[string] help me! song : -title :[string] A Long Time -author :[string] Mayer Hawthorne verses : verse :[[]interface{}] [item: 0] -name :[string] verse 1 -no :[string] 1 line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] Henry was a renegade [item: 1] -no :[string] 2 #text :[string] Didn't like to play it safe [item: 2] -no :[string] 3 #text :[string] One component at a time [item: 3] #text :[string] There's got to be a better way -no :[string] 4 [item: 4] -no :[string] 5 #text :[string] Oh, people came from miles around [item: 5] -no :[string] 6 #text :[string] Searching for a steady job [item: 6] -no :[string] 7 #text :[string] Welcome to the Motor Town [item: 7] -no :[string] 8 #text :[string] Booming like an atom bomb [item: 1] -no :[string] 2 line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] Oh, Henry was the end of the story [item: 1] -no :[string] 2 #text :[string] Then everything went wrong [item: 2] -no :[string] 3 #text :[string] And we'll return it to its former glory [item: 3] #text :[string] But it just takes so long -no :[string] 4 -name :[string] verse 2 chorus : line :[[]interface{}] [item: 0] -no :[string] 1 #text :[string] It's going to take a long time [item: 1] -no :[string] 2 #text :[string] It's going to take it, but we'll make it one day [item: 2] -no :[string] 3 #text :[string] It's going to take a long time [item: 3] #text :[string] It's going to take it, but we'll make it one day -no :[string] 4 -mtype :[string] alert json.MarshalIndent, recast==false: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] }, { "-name": "verse 2", "-no": "2", "line": [ { "#text": "Oh, Henry was the end of the story", "-no": "1" }, { "#text": "Then everything went wrong", "-no": "2" }, { "#text": "And we'll return it to its former glory", "-no": "3" }, { "#text": "But it just takes so long", "-no": "4" } ] } ] } }, "text": "help me!" } } DocToMap(), recast==true: msg : text :[string] help me! song : -author :[string] Mayer Hawthorne verses : verse :[[]interface{}] [item: 0] -name :[string] verse 1 -no :[float64] 1.00e+00 line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] Henry was a renegade [item: 1] -no :[float64] 2.00e+00 #text :[string] Didn't like to play it safe [item: 2] -no :[float64] 3.00e+00 #text :[string] One component at a time [item: 3] -no :[float64] 4.00e+00 #text :[string] There's got to be a better way [item: 4] -no :[float64] 5.00e+00 #text :[string] Oh, people came from miles around [item: 5] #text :[string] Searching for a steady job -no :[float64] 6.00e+00 [item: 6] -no :[float64] 7.00e+00 #text :[string] Welcome to the Motor Town [item: 7] -no :[float64] 8.00e+00 #text :[string] Booming like an atom bomb [item: 1] line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] Oh, Henry was the end of the story [item: 1] -no :[float64] 2.00e+00 #text :[string] Then everything went wrong [item: 2] -no :[float64] 3.00e+00 #text :[string] And we'll return it to its former glory [item: 3] -no :[float64] 4.00e+00 #text :[string] But it just takes so long -name :[string] verse 2 -no :[float64] 2.00e+00 chorus : line :[[]interface{}] [item: 0] -no :[float64] 1.00e+00 #text :[string] It's going to take a long time [item: 1] -no :[float64] 2.00e+00 #text :[string] It's going to take it, but we'll make it one day [item: 2] -no :[float64] 3.00e+00 #text :[string] It's going to take a long time [item: 3] -no :[float64] 4.00e+00 #text :[string] It's going to take it, but we'll make it one day -title :[string] A Long Time -mtype :[string] alert -mpriority :[float64] 1.00e+00 DocToJsonIndent, recast==true: { "msg": { "-mpriority": 1, "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": 1 }, { "#text": "It's going to take it, but we'll make it one day", "-no": 2 }, { "#text": "It's going to take a long time", "-no": 3 }, { "#text": "It's going to take it, but we'll make it one day", "-no": 4 } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": 1, "line": [ { "#text": "Henry was a renegade", "-no": 1 }, { "#text": "Didn't like to play it safe", "-no": 2 }, { "#text": "One component at a time", "-no": 3 }, { "#text": "There's got to be a better way", "-no": 4 }, { "#text": "Oh, people came from miles around", "-no": 5 }, { "#text": "Searching for a steady job", "-no": 6 }, { "#text": "Welcome to the Motor Town", "-no": 7 }, { "#text": "Booming like an atom bomb", "-no": 8 } ] }, { "-name": "verse 2", "-no": 2, "line": [ { "#text": "Oh, Henry was the end of the story", "-no": 1 }, { "#text": "Then everything went wrong", "-no": 2 }, { "#text": "And we'll return it to its former glory", "-no": 3 }, { "#text": "But it just takes so long", "-no": 4 } ] } ] } }, "text": "help me!" } } =================== TestGetValue ... Read doc: barworld Looking for value: entry.vars { "foo": "bar", "foo2": { "hello": "world" } } Looking for value: entry.vars.foo2.hello world Looking with error in path: entry.var verr: no key in map: var DocValue() for tag path entry.vars { "foo": "bar", "foo2": { "hello": "world" } } =================== TestGetValueWithAttr ... Read doc: bar world universe Looking for value: entry.vars { "foo": [ { "#text": "bar", "-item": "1" }, { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } ] } MapValue(): Looking for value: entry.vars.foo item=2 { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } MapValue(): Looking for hello item:4 verr: no key in map: hello DocValue(): Looking for entry.vars.foo.hello item:4 verr: no keys beyond: foo DocValue(): Looking for empty nil { "entry": { "vars": { "foo": [ { "#text": "bar", "-item": "1" }, { "-item": "2", "hello": [ { "#text": "world", "-item": "3" }, { "#text": "universe", "-item": "4" } ] } ] } } } testing recast switch... MapValue(): Looking for value: entry.vars.foo item=2 { "-item": 2, "hello": [ { "#text": "world", "-item": 3 }, { "#text": "universe", "-item": 4 } ] } =================== TestStuff_1 ... val2 val2 val3 doc : tag :[[]interface{}] [item: 0] #text :[string] val2 -item :[string] 1 [item: 1] -item :[string] 2 #text :[string] val2 [item: 2] #text :[string] val3 -item :[string] 2 -instance :[string] 2 DocValue(): tag [ { "#text": "val2", "-item": "1" }, { "#text": "val2", "-item": "2" }, { "#text": "val3", "-instance": "2", "-item": "2" } ] DocValue(): item:2 instance:2 "val3" =================== TestStuff_2 ... val2 val2 val3 tag : -item :[string] 1 #text :[string] val2 DocValue(): tag { "#text": "val2", "-item": "1" } DocValue(): item:2 instance:2 verr: no attribute key:value pair: item:2 =================== TestBulkBuffer ... Bulk Message Processing Tests procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] }, "verses": { "verse": [ { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] }, { "-name": "verse 2", "-no": "2", "line": [ { "#text": "Oh, Henry was the end of the story", "-no": "1" }, { "#text": "Then everything went wrong", "-no": "2" }, { "#text": "And we'll return it to its former glory", "-no": "3" }, { "#text": "But it just takes so long", "-no": "4" } ] } ] } }, "text": "help me!" } } procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "verses": { "verse": { "-name": "verse 1", "-no": "1", "line": [ { "#text": "Henry was a renegade", "-no": "1" }, { "#text": "Didn't like to play it safe", "-no": "2" }, { "#text": "One component at a time", "-no": "3" }, { "#text": "There's got to be a better way", "-no": "4" }, { "#text": "Oh, people came from miles around", "-no": "5" }, { "#text": "Searching for a steady job", "-no": "6" }, { "#text": "Welcome to the Motor Town", "-no": "7" }, { "#text": "Booming like an atom bomb", "-no": "8" } ] } } }, "text": "help me!" } } procMap: { "msg": { "-mpriority": "1", "-mtype": "alert", "song": { "-author": "Mayer Hawthorne", "-title": "A Long Time", "chorus": { "line": [ { "#text": "It's going to take a long time", "-no": "1" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "2" }, { "#text": "It's going to take a long time", "-no": "3" }, { "#text": "It's going to take it, but we'll make it one day", "-no": "4" } ] } }, "text": "help me!" } } procError err: XML syntax error on line 1: element closed by procError err: XML syntax error on line 1: unexpected end element =================== TestBulkBuffer ... Test arbitrary XML buffer with no ending rootTag - then read from closed buffer. m: map[doc:map[tag:]] m: map[doc:map[one:map[#text:my test doc -att:1]]] merr: XML syntax error on line 1: unexpected EOF err: Buffer is not active. =================== TestTagAndKey ... TestTagAndKey()
one
two.one two.two
one
two
tag: parts :: len: 2 v: [map[part:[two.one two.two]] map[sections:map[section:[one two]]]] no 'not_a_tag' tag key: section :: len: 2 v: [[one map[parts:map[part:[two.one two.two]]]] [one two]] no 'not_a_key' key ============================ x2jat_test.go =============== TestValuesAtKeyPath ... ValuesAtKeyPath ... doc1#author ss: [doc.books.book.author] vv: [map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]] ValuesAtKeyPath ... doc1#first_name ss: [doc.books.book.author.first_name] vv: [William H. Gaddis Austin Tappan Wright John Hawkes map[first_name:T.E. last_name:Porter]] GetKeyPaths...doc2#book ss: [doc.books.author.book doc.books.author.books.book] vv: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] vv: [map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]]] vv,shortest_path: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] ValuesAtKeyPath ... msg1#pub ss: [msg.pub] vv: [map[pub:test text:This is a long cold winter]] ValuesAtKeyPath ... msg2#pub ss: [msgs.msg.pub] vv: [map[pub:test text:This is a long cold winter] map[pub:test2 text:I hope we have a cool summer, though]] =============== TestValuesAtTagPath ... ValuesAtTagPath ... doc1#author ss: [doc.books.book.author] vv: [map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]] ValuesAtTagPath ... doc1#first_name ss: [doc.books.book.author.first_name] vv: [William H. Gaddis Austin Tappan Wright John Hawkes map[first_name:T.E. last_name:Porter]] ValuesAtTagPath...doc2#book ss: [doc.books.author.book doc.books.author.books.book] vv: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] vv: [map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]]] vv,shortest_path: [map[book:[map[-seq:1 review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[review:Won the National Book Award title:JR]] name:William H. Gaddis] map[books:map[book:[map[title:The Beetle Leg] map[title:The Blood Oranges]]] name:John Hawkes]] ================================ x2jfindPath_test.go =============== TestPathsForKey ... PathsForKey... doc01#author ss: [doc.books.book.author] PathsForKey... doc01#books ss: [doc.books] PathsForKey...doc02#book ss: [doc.books.author.book doc.books.author.books.book] PathForKeyShortest...doc02#book s: doc.books.author.book =============== TestPathsForTag ... PathsForTag... doc01#author ss: [doc.books.book.author] PathsForTag... doc01#books ss: [doc.books] PathsForTag...doc02#book ss: [doc.books.author.book doc.books.author.books.book] PathForTagShortest...doc02#book s: doc.books.author.book TestValuesFromTagPath() William H. Gaddis The Recognitions One of the great seminal American novels of the 20th century. Austin Tappan Wright Islandia An example of earlier 20th century American utopian fiction. John Hawkes The Beetle Leg A lyrical novel about the construction of Ft. Peck Dam in Montana. T.E. Porter King's Day A magical novella. map: doc : books : book :[[]interface{}] [item: 0] title :[string] The Recognitions review :[string] One of the great seminal American novels of the 20th century. -seq :[string] 1 author :[string] William H. Gaddis [item: 1] -seq :[string] 2 author :[string] Austin Tappan Wright title :[string] Islandia review :[string] An example of earlier 20th century American utopian fiction. [item: 2] -seq :[string] 3 author :[string] John Hawkes title :[string] The Beetle Leg review :[string] A lyrical novel about the construction of Ft. Peck Dam in Montana. [item: 3] -seq :[string] 4 author : last_name :[string] Porter first_name :[string] T.E. title :[string] King's Day review :[string] A magical novella. path == doc.books: len(v): 1 0 : map[book:[map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day]]] path == doc.books.*: len(v): 4 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] 1 : map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] 2 : map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] 3 : map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day] path == doc.books.book: len(v): 4 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] 1 : map[-seq:2 author:Austin Tappan Wright review:An example of earlier 20th century American utopian fiction. title:Islandia] 2 : map[-seq:3 author:John Hawkes review:A lyrical novel about the construction of Ft. Peck Dam in Montana. title:The Beetle Leg] 3 : map[-seq:4 author:map[first_name:T.E. last_name:Porter] review:A magical novella. title:King's Day] doc == doc2 / path == doc.books.book: len(v): 1 0 : map[-seq:1 author:William H. Gaddis review:One of the great seminal American novels of the 20th century. title:The Recognitions] path == doc.books.book.*: len(v): 12 0 : The Recognitions 1 : One of the great seminal American novels of the 20th century. 2 : William H. Gaddis 3 : An example of earlier 20th century American utopian fiction. 4 : Austin Tappan Wright 5 : Islandia 6 : John Hawkes 7 : The Beetle Leg 8 : A lyrical novel about the construction of Ft. Peck Dam in Montana. 9 : A magical novella. 10 : map[first_name:T.E. last_name:Porter] 11 : King's Day doc == doc2 / path == doc.books.book.*: len(v): 3 0 : William H. Gaddis 1 : The Recognitions 2 : One of the great seminal American novels of the 20th century. path == doc.books.*.author: len(v): 4 0 : William H. Gaddis 1 : Austin Tappan Wright 2 : John Hawkes 3 : map[first_name:T.E. last_name:Porter] path == doc.*.*.author: len(v): 4 0 : William H. Gaddis 1 : Austin Tappan Wright 2 : John Hawkes 3 : map[first_name:T.E. last_name:Porter] path == doc.*.*.title: len(v): 4 0 : The Recognitions 1 : Islandia 2 : The Beetle Leg 3 : King's Day path == doc.*.*.*: len(v): 12 0 : William H. Gaddis 1 : The Recognitions 2 : One of the great seminal American novels of the 20th century. 3 : Austin Tappan Wright 4 : Islandia 5 : An example of earlier 20th century American utopian fiction. 6 : A lyrical novel about the construction of Ft. Peck Dam in Montana. 7 : John Hawkes 8 : The Beetle Leg 9 : map[first_name:T.E. last_name:Porter] 10 : King's Day 11 : A magical novella. path == doc.*.*.*.*: len(v): 2 0 : T.E. 1 : Porter TestValuesFromTagPath2(), iteration: 0 no default:text default:word map: data : netid : text1 :[string] default:text word1 :[string] default:word disable :[string] no path == data.*: len(v): 1 0 : map[disable:no text1:default:text word1:default:word] disable : no text1 : default:text word1 : default:word path == data.*.*: len(v): 3 0 : no 1 : default:text 2 : default:word TestValuesFromTagPath2(), iteration: 1 yes default:text default:word map: data : idnet : disable :[string] yes text1 :[string] default:text word1 :[string] default:word path == data.*: len(v): 1 0 : map[disable:yes text1:default:text word1:default:word] disable : yes text1 : default:text word1 : default:word path == data.*.*: len(v): 3 0 : yes 1 : default:text 2 : default:word Unmarshal test ... *map[string]interface{}, *string m: map[doc:map[name:Mayer Hawthorne song:map[title:A Long Time verse:map[-no:1 line:[map[#text:Henry was a renegade -no:1] map[#text:Didn't like to play it safe -no:2]]]]]] s: {"doc":{"name":"Mayer Hawthorne","song":{"title":"A Long Time","verse":{"-no":"1","line":[{"#text":"Henry was a renegade","-no":"1"},{"#text":"Didn't like to play it safe","-no":"2"}]}}}} Unmarshal test ... struct: clbanning
unknown
myInfo: {XMLName:{Space: Local:info} Name:clbanning Address:unknown} TestMapValue of doc.song.verse w/ len(attrs) == 0. doc: Mayer Hawthorne A Long Time Henry was a renegade Didn't like to play it safe result: map[-no:1 line:[map[#text:Henry was a renegade -no:1] map[#text:Didn't like to play it safe -no:2]]] PASS ok github.com/clbanning/x2j 0.006s Processing files: golang-github-clbanning-x2j-devel-1.1-9.fc38.noarch Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.4EdKUm + RPM_EC=0 ++ jobs -p + exit 0 + umask 022 + cd /builddir/build/BUILD + cd x2j-1.1 + DOCDIR=/builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/doc/golang-github-clbanning-x2j-devel + export LC_ALL=C + LC_ALL=C + export DOCDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/doc/golang-github-clbanning-x2j-devel + cp -pr README /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/doc/golang-github-clbanning-x2j-devel + cp -pr examples /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/doc/golang-github-clbanning-x2j-devel + RPM_EC=0 ++ jobs -p + exit 0 Executing(%license): /bin/sh -e /var/tmp/rpm-tmp.3f9TYz + umask 022 + cd /builddir/build/BUILD + cd x2j-1.1 + LICENSEDIR=/builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/licenses/golang-github-clbanning-x2j-devel + export LC_ALL=C + LC_ALL=C + export LICENSEDIR + /usr/bin/mkdir -p /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/licenses/golang-github-clbanning-x2j-devel + cp -pr LICENSE /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64/usr/share/licenses/golang-github-clbanning-x2j-devel + RPM_EC=0 ++ jobs -p + exit 0 grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : grep: warning: stray \ before : Provides: golang(github.com/clbanning/x2j) = 1.1-9.fc38 golang(github.com/clbanning/x2j)(tag=1.1) = 1.1-9.fc38 golang-github-clbanning-x2j-devel = 1.1-9.fc38 golang-ipath(github.com/clbanning/x2j) = 1.1-9.fc38 golang-ipath(github.com/clbanning/x2j)(tag=1.1) = 1.1-9.fc38 Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: go-filesystem Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 Wrote: /builddir/build/RPMS/golang-github-clbanning-x2j-devel-1.1-9.fc38.noarch.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.pQasa9 + umask 022 + cd /builddir/build/BUILD + cd x2j-1.1 + /usr/bin/rm -rf /builddir/build/BUILDROOT/golang-github-clbanning-x2j-1.1-9.fc38.aarch64 + RPM_EC=0 ++ jobs -p + exit 0 Executing(rmbuild): /bin/sh -e /var/tmp/rpm-tmp.ZvzZhR + umask 022 + cd /builddir/build/BUILD + rm -rf x2j-1.1 x2j-1.1.gemspec + RPM_EC=0 ++ jobs -p + exit 0 Child return code was: 0