Skip to content

Commit a3e41dc

Browse files
author
Cédric de Saint Léger
committed
Kohana 3.2 compatibility, fixed a bunch of issues, refactored namespace logic, fixes #2
0 parents  commit a3e41dc

File tree

9 files changed

+1210
-0
lines changed

9 files changed

+1210
-0
lines changed

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2010 Cédric de Saint Léger
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Kohana_XML is a XML modules to generate and read XML documents in Kohana.
2+
It is build for KO3, but there are barely one or two lines that makes it KO3 specific,
3+
so I guess it should work for KO2.x without much trouble.
4+
5+
## Notable Features
6+
7+
* **Extendible, configurable drivers** — You can use the XML class to write simple XML,
8+
or use the Atom driver to generate Atom compliant XML, or write your own driver (extending XML
9+
or another driver) to generate XML compliant to any specs you want. Driver support initial
10+
configuration, which will be used when using native functions, and your own function.
11+
Namespaces and prefix, value filters, default attributes, node name abstraction are all part
12+
of driver configuration and are then used as such by native functions, so they are dealt with
13+
on the fly. But you can also write your own function very easily in your drivers, and writing
14+
an add_author($user_model) function in the Atom driver would take a second.
15+
16+
* **Dealing with objects of the same class whatever function you use** – $xml→add_node(“test”);
17+
generates another XML instance of the same driver you can add nodes to, import array or XML files
18+
to, search in, modify, export, combine… The whole XML document becomes modular, easy to read and
19+
to modify, and to run through with method chaining. Just play Lego with your XML.
20+
21+
* **Magic get and get()** — allows to easily run through the document. For instance
22+
$atom→author→name will return an atom document author’s name, this regardless of your driver
23+
configuration. As another example of node name abstraction, if you’ve decided to abstract “pubDate”
24+
with “updated” in your RSS2 driver configuration and “published” with “updated” in you Atom driver,
25+
then $atom→updated will give you the same result as $rss→updated.
26+
27+
* **Jelly-style driver configuration** — I liked the way Jelly initializes its models, so you can
28+
configure yours just the same way. Driver configuration then goes into a static meta class, which
29+
improves performance.
30+
31+
* You can still use **DOM functions** if you wish and reintegrate in Kohana_XML

classes/xml.php

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php defined('SYSPATH') or die('No direct script access.');
2+
/**
3+
* Document : xml.php
4+
* Created on : 1 mai 2009, 13:03:03
5+
* @author Cedric de Saint Leger <[email protected]>
6+
*
7+
* Description:
8+
* XML class. Use this class to override XML_Core.
9+
* Extend this class to make your own XML based driver (Atom, XRDS, GData, RSS, PodCast RSS, or your own brewed XML format)
10+
*/
11+
12+
class XML extends XML_Core
13+
{}

0 commit comments

Comments
 (0)