Added by Daniele Orlando, last edited by Wil Sinclair on Apr 05, 2007  (view change)

Labels

 

Zend Framework: Zend_Xml Component Proposal

Proposed Component Name Zend_Xml
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Xml
Proposers Daniele Orlando
Revision 0.1 - 1 August 2006: Initial Release (wiki revision: 8)

Table of Contents

1. Overview

Zend_Xml is a component that allow you to read nodes, create roots, append childs, set attributes, create texts in a XML resource, simply passing an XPath string or an array of strings with few or no parameters.
For instance, recursive operation on different xml node can be done passing an array of xpath strings.
In the same way, passing an xpath string and an array of node name strings, we can add many childs in just one function call.
This is possible combining the simplicity of the XPath syntax with the DOM versatility.
Simply useful.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

Zend_Xml is a low level library for XML Document creation and manipulation.

  • This component will not supports conversion in other markup languages or document types.
  • This component must supports all PHP DOM methods.

4. Dependencies on Other Framework Components

  • Zend_Exception

5. Theory of Operation

Instantiate Zend_Xml with the root name(s) of the xml document and, if required, the external stylesheet.
Now, you are ready to build your XML document quickly and with total control on every operation.

6. Milestones / Tasks

  • Milestone 1: [DONE] Base operations support
  • Milestone 2: Full support for PHP DOM methods
  • Milestone 3: Support for pre-existent DOMDocument and SimpleXML objects
  • Milestone 4: Performance tuning

7. Class Index

  • Zend_Xml - xml creation and manipulation class
  • Zend_Xml_Exception - exception handler

8. Use Cases

UC-01

Creation of a new XML document with an external stylesheet:

UC-02

Basic editing:

UC-03

Recursive operations:

9. Class Skeletons

The complete class is in "Attachments"

it seems useful, keep working on it, i'll try the class. Anyone else is...?

What does this proposed class do that DOMDocument doesn't do already?

There is no need to reinvent functionality that already exists by another name in standard PHP.

Hi, Bill!
I think that DOMDocument is a powerful and complete component, too.
But this is not a valid reason to consider Zend_Xml useless.
Their scope is the same, but the way to achieve it is different.
It's up to the developer to decide how to do it.
So, I can answer that I'm not reinventing functionality, but I'm proposing a simpler and faster way to use them.

Why simpler and faster?

Zend_Xml is not a replacement for DOMDocument, but a wrapper that let the developer to program without the rewriting of repetitive code but just using arrayes and xpath strings.
And wheter you have to use DOMDocument, simply use Zend_Xml->$Dom instance.
Is there anything simpler and faster than this?

Thanks for your time.

p.s.:
I'm using Zend_Xml in a production system and I think it very useful.

Updated...
Now supports namespaces.