libxo question

Kristof Provost kristof at sigsegv.be
Sat Dec 29 12:54:42 UTC 2018



On 28 Dec 2018, at 23:12, Mark Saad wrote:

> On Fri, Dec 28, 2018 at 3:40 PM Chris Torek <torek at elf.torek.net> 
> wrote:
>>
>>> Attached is a copy of the xml.   Any guidance would be helpful.
>>
>> Your attachment was stripped before it got here, but the problem
>> is clear enough.  Procstat / libxo is generating invalid XML.
>>
>> Here's a bit of sample "procstat --libxo xml" output, which
>> I generated locally by running
>>
>>     procstat --libxo xml -ta
>>
>> and hand massaging the result:
>>
>>     <procstat version="1">
>>         <threads>
>>             <0>
>>                 <process_id>0</process_id>
>>                 <command>kernel</command>
>>                 <threads>
>>                     <100000>
>>                         <thread_id>100000</thread_id>
>>                         <thread_name>swapper</thread_name>
>>                         <cpu>-1</cpu>
>>      [snip]
>>
>> Valid XML tags must begin with an alphabetic character or an
>> underscore (see https://www.w3schools.com/xml/xml_elements.asp),
>> and neither <0> nor <100000> do so.
>>
>> A quick workaround is to use json instead.  However, libxo
>> probably should "work smarter" with tags.
>>
>> (XML is a terrible data-encoding language because of all of its
>> special rules.  If you think you've found them all, watch out for
>> CDATA!  JSON is better but still has some issues with encoding,
>> requiring that arbitrary binary data be atob or base64 encoded or
>> similar.)
>>
>> Chris
>
> I updated the patch form kb to work on 12
> https://mirrors.nycbug.org/pub/patches/procstat-libxo-12-STABLE.patch
>
> Here is the xml output as well
> https://mirrors.nycbug.org/pub/patches/procstat.xml
>
> This works better then before and  python's xml parser, mozilla and
> edge think its valid xml.
>
> I think this should be fixed what should we do to make it happen ?
>
I’ve posted https://reviews.freebsd.org/D18679 as a more generic way 
of addressing this.
It’s quite possible that there are other users of libxo with the same 
problem, and this will help all of them.

Regards,
Kristof


More information about the freebsd-hackers mailing list