Docunext


PHP CSS and XML

March 29th, 2009

I'm experimenting with PHP, CSS, and XML, trying to come up with some sort of css2xml script, while considering the idea of mangling classes and identifiers to prevent collisions when creating mashups.

parseString($mycss);//$arr = $css->toArray();//var_export($arr);

ob_start();$css->display();$converted = ob_get_contents();

ob_end_clean();//echo $converted;//exit;$mycss = preg_replace('/\n#/','id___',$converted);$mycss = preg_replace('/\n\./','class___',$mycss);$css->parseString($mycss);$arr = $css->toArray();//echo $converted;//echo $mycss;//exit;$options = array(  XML_SERIALIZER_OPTION_INDENT        => '    ',  XML_SERIALIZER_OPTION_RETURN_RESULT => true);$serializer = &new XML_Serializer($options);$result = $serializer->serialize($arr);

echo $result;?>

Note, this code is just a sketch, and I don't expect it to function well.

Also, of the post I made recently about css parsers, this one in ruby again caught my attention.

Lastly, I found csstoxml. Its written in java, so I'm a little hesitant to try it out due to my lack of experience with java.

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022