More XML Woes

"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.

There are no comments posted to this news item.

Add Comment

Account

Register Account

Forgot Password

More Articles

End of Life for PHP 4

Chris Shiflett...

Migrating to Phrameworks 1.0.1

Nobody can say I don't drink my own Kool Aid.

CSSTitle: Tooltips with Style

A demo of the CSSTitle library is now available.  This library...

Shoot Em Up

Just a quick note to mention that Galactic Front is back...

More XML Woes

"XML is like violence. If it doesn't solve your problem, you're not using enough of it." ...

Smart XML, Part 2: Converting HTML Entities for XML

Yesterday I discovered a bothersome feature in PHP 5's DOM library.  Loading XML data into a...