Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: unreadable XML proplists from drvctl(8)



On Wed, Jan 18, 2012 at 09:22:56PM +0200, Alan Barrett wrote:
> On Mon, 16 Jan 2012, Paul Goyette wrote:
> >I had included a sample of the new output from 'drvctl -p' (show
> >propery dictionary) which includes the new information.  Here it
> >is again:
> >
> ># drvctl -p atabus0
> >Properties for device `atabus0':
> ><?xml version="1.0" encoding="UTF-8"?>
> ><!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
> >"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
> ><plist version="1.0">
> ><dict>
>  [snip unreadable XML]
> 
> Why do we have a command that outputs XML proplists, without the
> option of a human readable alternative?  When XML proplists were
> introduced some years ago, we were promised that they would not be
> exposed in user interfaces.  This seems to violate that promise.

Is JSON a human-readable alternative?

% drvctl -pn mainbus0
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
        <key>device-driver</key>
        <string>mainbus</string>
        <key>device-unit</key>
        <integer>0x0</integer>
</dict>
</plist>

% drvctl -pn mainbus0 | xmlsed '//{(key/{text()})%((integer|string)/{text()})}' 
-1 '"$2": $3, ' | xmlsed -E '/{plist/dict/{*}}' -1 '{ $2 }'
{ "device-driver": mainbus, "device-unit": 0x0,  }

Dave

-- 
David Young
dyoung%pobox.com@localhost    Urbana, IL    (217) 721-9981


Home | Main Index | Thread Index | Old Index