Hi,
I am currently working on research how to improve XML parser in YaST. What we 
have nowadays is libxml2 based c++ parser ( that almost noone use directly ) 
and XML module ( module as a code, not YaST module :). I check usage of XML 
module and main usage is data to XML and back ( with variant xml as string or 
xml as file ). There is just two additional functionality. One is checking xml 
error ( almost noone use it ) and setting metadata for generated xml ( bad API 
as it should be part of that data to XML method ).

So my question is what we would like to have better? One thing for sure that 
hit us often is optional schema validation ( as some XML is prevalidated like 
control files for products of roles, but autoyast is user generated/written ). 
Also some nicer error reporting would be nice because current XMLError method 
is almost never used (and yes, you should read nicer as using exception that 
can/have to be catched otherwise it report popup with internal error and not 
cause some strange error later ). Do you think that it makes sense at all to 
have own module as ruby, perl and also python, for whose we currently have 
bindings, all have own good ( good as better then our ) parser. So does it 
makes sense to have own XML parser beside backward compatibility and for new 
stuff as already seen on some places just use rexml or nokogiri that e.g. 
already have support for relax ng validation[1]? Or do we have some 
functionality that we would like to have on top of standard parsers?

Only thing that current parser have on top of generic xml parsers is 
understanding of type attribute that do automatic type conversion so `<a 
type="boolean>true</a>` is returned as `true` and not `"true"`. But this magic 
is also source of some bugs as e.g. hash does not have this type attribute and 
result is that `<a><key>b</key>c</a>` is returned as `"c"` and not hash, which 
cause many recent failures we get with typos in autoyast profiles. And as bonus 
we do not specify this types in schema, so during validation if you omit type 
it is still valid xml, but it crashes in code as it expect different type.

I would welcome any suggestions or ideas how your ideal xml parser should look 
like.

Thanks
Josef

[1] 
https://stackoverflow.com/questions/913489/how-do-i-validate-xml-via-relax-ng-in-ruby/933482
-- 
To unsubscribe, e-mail: yast-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: yast-devel+ow...@opensuse.org

Reply via email to