?

Log in

No account? Create an account

Playing around with XMLValue

« previous entry | next entry »
Apr. 13th, 2007 | 11:14 pm

From IM:
"So can anything be done with XML?"

Create a table:

CREATE TABLE `krow` (
`a` varchar(125) NOT NULL DEFAULT '',
`b` text,
PRIMARY KEY (`a`)
) ENGINE=HTTP DEFAULT CHARSET=latin1 CONNECTION='http://krow.livejournal.com/data/'

Now... can I extract anything?

mysql> select EXTRACTVALUE(b, '/rss/channel/title') from krow WHERE a="rss";
+--------------------------------------------------+
| EXTRACTVALUE(b, '/rss/channel/title') |
+--------------------------------------------------+
| Brian "Krow" Aker's Idle Thoughts |
+--------------------------------------------------+
1 row in set (1.29 sec)

Basically I use the new XML methods in 5.1 to extract out realtime data from 5.1.

I publicly committed mod_methods:
http://hg.tangent.org/mod_methods

I would not enable it on a public server. I've never fixed the security for it, and its quite dangerous for that reason. It is handy for testing services like this since it has a plain GET/PUT/HEAD/DELETE method.Error running style: Died in S2::run_code running EntryPage::print(): Can't use string ("") as a subroutine ref while "strict refs" in use at (eval 7575)[/home/lj/src/s2/S2.pm:203] line 1230.