Debugging topology map XML
By user9148476 on Jul 22, 2008
# /usr/lib/fm/fmd/fmtopo /usr/lib/fm/fmd/fmtopo: failed to walk hc topology: empty topologyKnowing that libtopo (as well as enumerators) often have some debug tracing functions, I did a search on OpenSolaris for topo debug environment variables. Two jumped out that looked useful for debugging XML issues, TOPOXML_VALIDATE and TOPOXML_PERROR. Turns out for my problem, the latter is what I wanted. Once set, and using the -d option for fmtopo:
# /usr/lib/fm/fmd/fmtopo //usr/platform/SUNW,FOO/lib/fm/topo/maps/FOO-hc-topology.xml:1821: parser error : Opening and ending tag mismatch: propgroup line 1682 and node </node> \^ //usr/platform/SUNW,FOO/lib/fm/topo/maps/FOO-hc-topology.xml:1822: parser error : Opening and ending tag mismatch: node line 1681 and range </range> \^ //usr/platform/SUNW,FOO/lib/fm/topo/maps/FOO-hc-topology.xml:1823: parser error : Opening and ending tag mismatch: range line 1680 and dependents </dependents> \^ ...The first error was with a propgroup at line 1682. Looking at that area of the map:
1678 <!-- memory-controller 2 --> 1679 <dependents grouping='children'> 1680 <range name='memory-controller' min='0' max='3'> 1681 <node instance='2'> 1682 <propgroup name='protocol' version='1' 1683 name-stability='Private' data-stability='Private' > 1684 <propval name='FRU' type='fmri' 1685 value='hc:///motherboard=0/cpuboard=2' /> 1686 <propval name='label' type='string' value='MB/CPU2' /> 1687 1688 <!-- memory-controller 2's buffers --> 1689 <dependents grouping='children'> 1690 <range name='memory-buffer' min='4' max='5'>
Sure enough, I'd missed the the </proprgroup> after line 1686.
While it was very handy to have the XML debugging in libtopo, it got me wondering what XML editors are out there that would do this kind of syntactical checking while I'm adding in nodes. Afraid I'm a bit of an old dog using vi. Any favorites out there?