More XML Woes
by Castwide on 5-4-2008 Tags: pagemill, php, xml 10 comments"XML is like violence. If it doesn't solve your problem, you're not using enough of it." I don't know who said it first (although I've found plenty of people who thought it beared repeating), but I'd sure like to buy him a beer.
I think I've finally found a viable standard for XML processing in the PHP Pagemill, and ultimately in the Phrameworks kernel, after struggling with it for the past two days. The solution is essentially as follows:
- Any XML document can be a template. If the Pagemill is configured to use a namespace for tags (it uses pm: by default), the namespace should be declared in the root element (e.g., xmlns:pm="http://castwide.com/pagemill").
- A template can also start with the pm:template element, in which case the contents of the root will be returned after processing. This allows for use of document fragments to be included in other documents, and also for output that is not XML, such as comma-separated values.
- If a document fails to parse using the DOM, the Pagemill will attempt to repair it by wrapping it inside a pm:template element.
I hope to have a new version of the Pagemill that follows the above process later this week. If I can't get it to work... I guess I'll throw more XML at it.
Comments
Lizaria - 2011-11-02 03:18:22
davidmiska - 2011-11-03 22:41:28
Grav3d1gger - 2011-11-04 22:25:37
auntfefe - 2011-11-17 21:24:13
elpeorborrego - 2011-11-19 20:31:18
bobringer - 2011-11-21 01:23:10
yeeamahdi - 2011-11-21 20:34:26
sushisuzi - 2011-11-23 20:22:42
bisurquiz - 2011-11-25 12:16:18
how does viagra work - 2012-01-20 14:31:53