[yast-devel] Changeset 39159 adds XML representation to YCP
As part of hackweek project http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator I just committed changeset #39159 to yast-core on svn trunk. This changeset adds toXml() methods to all YCP and YCode classes, giving all ycp code and data structures a representation as XML. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Klaus Kaempf wrote:
As part of hackweek project http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator I just committed changeset #39159 to yast-core on svn trunk.
This changeset adds toXml() methods to all YCP and YCode classes, giving all ycp code and data structures a representation as XML.
Klaus, does it also support toYCP :)? See the attached file. During the HackWeek I met with Benji and we've decided to use his XML format for 'some other' Installation/Repository handling. It would be nice to have both toXml and toYCP. Lukas -- Lukas Ocilka, YaST Developer (xn--luk-gla45d) ----------------------------------------------------------------- SUSE LINUX, s. r. o., Lihovarska 1060/12, Praha 9, Czech Republic
* Lukas Ocilka <lukas.ocilka@suse.cz> [Jul 04. 2007 11:59]:
Klaus Kaempf wrote:
As part of hackweek project http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator I just committed changeset #39159 to yast-core on svn trunk.
This changeset adds toXml() methods to all YCP and YCode classes, giving all ycp code and data structures a representation as XML.
Klaus, does it also support toYCP :)? See the attached file.
During the HackWeek I met with Benji and we've decided to use his XML format for 'some other' Installation/Repository handling. It would be nice to have both toXml and toYCP.
I fail to see the relation between a metapackage/repository description and YCP. The toXml() code 'just' converts, i.e. { integer i = 0; repeat { i = i + 1; if( i < 5 ) continue; break; } until( i > 10 ); return i == 5; } to <?xml version="1.0" encoding="UTF-8"?> <ycp> <block kind="file"> <symbols> <entry global category="filename" type="<unspec>">../../../libycp/testsuite/tests/statements/Repeat-Until-Continue.ycp</entry> <entry category="variable" type="integer">i</entry> </symbols> <point>000</point> <statements> <assign><entry>i</entry><expr><const><int>0</int></const></expr></assign> <repeat> <do> <block kind="unspec"> <point>000</point> <statements> <assign><entry>i</entry><expr><yebinary><static name="+"><type kind="integer (integer, integer)"/></static><entry>i</entry><const><int>1</int></const></yebinary></expr></assign> <if><compare op="<"><entry>i</entry><const><int>5</int></const></compare><then><continue/></then></if> <break/> </statements> </block> </do> <until><compare op=">"><entry>i</entry><const><int>10</int></const></compare></until> </repeat> <return><compare op="=="><entry>i</entry><const><int>5</int></const></compare></return> </statements> </block> </ycp> Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Klaus Kaempf wrote:
I fail to see the relation between a metapackage/repository description and YCP.
The toXml() code 'just' converts, i.e. { integer i = 0; ... return i == 5; }
to
<?xml version="1.0" encoding="UTF-8"?> <ycp> <block kind="file"> <symbols> <entry global category="filename" type="<unspec>">../../../libycp/testsuite/tests/statements/Repeat-Until-Continue.ycp</entry> <entry category="variable" type="integer">i</entry> </symbols> <point>000</point> <statements> ... </block> </ycp>
I see, so it converts YCP code to XML. ...and can it convert XML to YCP? Does it need a special XML format then? Anyway, I misunderstood the message. I saw Benji's comment at that project's page and I thought it was somehow related to another work done by Benji: His own XMLtoYCP module. L.
* Lukas Ocilka <lukas.ocilka@suse.cz> [Jul 04. 2007 13:42]:
I see, so it converts YCP code to XML.
Right.
...and can it convert XML to YCP? No, there is currently no need for this.
Does it need a special XML format then?
Well, it spits out a far(!) from perfect xml structure which hopefully will be at a state one day where it can be used to convert YCP -> XML -> <insert-language-of-choice> Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On 04/07/07, Klaus Kaempf <kkaempf@suse.de> wrote:
As part of hackweek project http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator I just committed changeset #39159 to yast-core on svn trunk.
This changeset adds toXml() methods to all YCP and YCode classes, giving all ycp code and data structures a representation as XML.
Nice, Could you post an example of how to consume this? i.e. How can one take some YCP and convert it to XML. _ Benjamin Weber -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Benji Weber <b.weber@warwick.ac.uk> [Jul 04. 2007 20:51]:
On 04/07/07, Klaus Kaempf <kkaempf@suse.de> wrote:
As part of hackweek project http://idea.opensuse.org/content/ideas/ycp-to-ruby-translator I just committed changeset #39159 to yast-core on svn trunk.
This changeset adds toXml() methods to all YCP and YCode classes, giving all ycp code and data structures a representation as XML.
Nice,
Could you post an example of how to consume this? i.e. How can one take some YCP and convert it to XML.
Just run ycpc -x -c filename.ycp and it will create filename.xml in the same directory. I'll write more on my blog. Klaus -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Benji Weber
-
Klaus Kaempf
-
Lukas Ocilka