Hi,
I'm having a really hard time with the XML functions, specifically @XMLNODES. My XML looks like this (much simplified here):
I've used the sample code from help file "XML in TCC" and tried to query number of optional nodes, in this case <include />. If I call:
Echo 1-4 work fine and I was expecting Echo 5-8 to generate an error, but also set the var _?. However, the shown error "TCMD: (XML) Line: 0; Char: 0" is an unsuppressable one. No matter what I do, I cannot suppress it: adding "> NUL" to line, putting the line into another batch and call with call or even %@execstr[]. I suspected MSXML parser und upgraded it but it wasn't the cause. The error is simply unkillable. Since this is part of a menu-driven batch, it destroys the layout.
How can I suppress this error?
Thanks in advance!
I'm having a really hard time with the XML functions, specifically @XMLNODES. My XML looks like this (much simplified here):
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<storages>
<storage id="A">
<container id="1"></container>
</storage>
<storage id="B">
<container id="2"></container>
<include storage_id="A" />
</storage>
</storages>
I've used the sample code from help file "XML in TCC" and tried to query number of optional nodes, in this case <include />. If I call:
Code:
@echo off
set _bla=%@XMLOPEN[xmltest.xml]
echo 1. # includes under B: %@XMLNODES[/storages/storage[@id="B"]]
echo 2 Any includes under B? %@XMLXPATH[/storages/storage[@id="B"]/include]
echo 3. # includes under A: %@XMLNODES[/storages/storage[@id="A"]]
echo 4. # of storages: %@XMLNODES[/storages]
:: everything below throws an unsuppressable error
echo 5. Any includes under A? %@XMLXPATH[/storages/storage[@id="A"]/include] > NUL
echo 6. %@XMLXPATH[/storages/storage[@id="A"]/include] || echo code: %_?
echo 7. %@XMLXPATH[/storages/storage[@id="A"]/include] >&> NUL || echo code: %_?
echo 8. # of foobar: %@XMLNODES[/foobar] >&> NUL
set _bla=%@XMLCLOSE[]
Echo 1-4 work fine and I was expecting Echo 5-8 to generate an error, but also set the var _?. However, the shown error "TCMD: (XML) Line: 0; Char: 0" is an unsuppressable one. No matter what I do, I cannot suppress it: adding "> NUL" to line, putting the line into another batch and call with call or even %@execstr[]. I suspected MSXML parser und upgraded it but it wasn't the cause. The error is simply unkillable. Since this is part of a menu-driven batch, it destroys the layout.
How can I suppress this error?
Thanks in advance!