Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Proposal informations
Zend_Xml (Full Fluent) is the complete refactoring of Zend_Xml that should be deprecated in favor of this new component.

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Xml Component Proposal

Proposed Component Name Zend_Xml
Developer Notes
Proposers My E-mail Address
Revision 0.1 - 30 November 2007: Initial release. (wiki revision: 17)

Table of Contents

1. Overview

Zend_Xml (Full Fluent) is the complete refactoring of Zend_Xml.
Zend_Xml is a component that allow you to work on a Xml document in a fluent, rapid and powerful way.
This is possible combining dom, xpath, arrays and the fluent pattern.
Oh, I was forgetting. Do you need namespace? Well, Zend_Xml is full and easy namespace compliant.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

Zend_Xml is an high level library for XML document creation and manipulation.

  • This component will not supports conversion in other markup languages or document types.
  • This component should supports all PHP5 DOM methods and properties.
  • This component will implements some SimpleXML interaction facilities.

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

Zend_Xml maybe improved to support XQuery, SimpleXML and xml data conversion into a native php data type to integrate it in a more complex component for data manipulation and conversion (Zend_Data ?).

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

7. Class Index

  • Zend_Xml - xml document creation facade
  • Zend_Xml_Exception - exception handler
  • Zend_Xml_Dom_Abstract - shared and abstract methods for dom manipulation
  • Zend_Xml_Dom_Abstract_Exception - exception handler
  • Zend_Xml_Document - domdocument facade
  • Zend_Xml_Document_Exception - exception handler
  • Zend_Xml_Exception - exception handler
  • Zend_Xml_Nodes - implementation of the composite pattern
  • Zend_Xml_Nodes_Exception - exception handler

8. Use Cases


9. Class Skeletons

The complete component is coded and ready
and will be published only under request of the Zend Framework team
or after a general judgment.



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 30, 2007

    <p>I work with xml documents and I think it very useful.</p>

  2. May 13, 2008

    <p>Daniele, is this proposal read for community review or does it still need some work? If it is ready for review, please re-parent it and announce on the mailing list. Otherwise, please either continue work on it or move it to the Archived section until you can get back to it.</p>

    <p>Thanks.<br />

  3. Jun 13, 2008

    <p>Hi Wil,</p>

    <p>the proposal is coded and ready for the community review, but I have not noticed any interest about it from the community during this period.</p>

    <p>So I would know any opinion about it.</p>

    <p>p.s.: I improved the component especially about namespace handling.</p>

  4. Jun 16, 2008

    <p>Why do all the methods end in "s"?</p>

  5. Aug 21, 2008

    <p>Is it possible to download Zend_Xml somewhere? I'm really interested in this...</p>

  6. Aug 28, 2008

    <p>What is the status on this proposal. It seems to have come to a stop?</p>

    <p>A function that I'd like to see is one to convert an object (instance of stdClass) to XML. If needed, I can provide the code for that.</p>

  7. Dec 17, 2008


  8. May 09, 2009

    <p>Hi, <br />
    it look like Daniele forgot about this perfect extension. For me it will be perfect if I have this extension. About 3 year I working with XML+XSLT and write own XML handler class. But when I was saw this proposal - I decide that it is exactly what I need! <br />
    Daniele, if you here, could you please open your sources. I think community (I and another interested person will finish you child) </p>

  9. May 22, 2010

    <p>interested +1 <ac:emoticon ac:name="smile" /></p>

  10. Jun 05, 2010

    <p>Hello guys,</p>

    <p>the good news is that I'm not dead <ac:emoticon ac:name="wink" />, and the Xml component is not dead too.</p>

    <p>I continued to work on it improving and refactoring every aspect,<br />
    and now it is part of a more comprehensive RAD PHP platform<br />
    (based on some components of the Zend Framework)<br />
    that I think will be released within a year.</p>

    <p>The major new features are:</p>
    <ul class="alternate">
    <li>a faster code;</li>
    <li>a cleaner interface of each method, with some new entries;</li>
    <li>a new, better and simpler namespace usage (no more string concatenation and repetitions)<br />
    with support for multiple namespaces;</li>
    <li>support for CDATA nodes;</li>
    <li>the possibility to inject an xml string in an existing xml document, and to manipulate it;</li>
    <li>creation of before and after siblings;</li>
    <li>deletion of nodes, using XPath or context nodes.</li>

    <p>The entire codebase is implemented using the new features of PHP 5.3.</p>

    <p>Now I'm arriving to the Zend Xml proposal.</p>

    <p>Time permitting, I'll start a new proposal with the new code backported to PHP 5.2 and the Zend framework,<br />
    to permit everyone of you to use it without the need to wait for the official release.</p>

    <p>Sorry for the long wait.</p>

    <p>Here, an <strong>extract</strong> of the php interfaces:</p>

    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    interface Interface
    public function addNamespaces($ns);

    public function useNamespace($nsId);

    public function resetNamespace();

    public function getDom();

    public function getNamespaces();

    public function existsTarget($xpath);

    public function query($xpaths);

    public function appendChild($child, $switchContext = true, $value = null, array $attributes = array());

    public function appendChilds(array $childs, $switchContext = true);

    public function appendElement($element, $switchContext = true);

    public function insertSiblingBefore($sibling, $switchContext = true);

    public function insertSiblingAfter($sibling, $switchContext = true);

    public function removeTarget($xpath);

    public function setAttribute($name, $value);

    public function setAttributes(array $attributes);

    public function appendText($text);

    public function appendCdata($text);

    public function setText($xpath);

    public function asArray();
    <p>Do you like it? <ac:emoticon ac:name="wink" /></p>

    1. Jun 05, 2010

      <p>Don't bother porting it back to php5.2 . The development of ZF2 has begun already, and that will be >=5.3 only.</p>

      1. Jun 11, 2010

        <p>Any news about the stable release of the ZF2?</p>

        <p>It seams to be far in the future.</p>

    2. Jun 06, 2010

      <p>Great proposal!</p>

      <p>Only two additions:</p>
      <p>appendChild($child, $switchContext = true, $value = null, array $attributes = array())</p></blockquote>
      <p>Why the second argument isn't the last as of all other methods?</p>
      <p>public function asArray();</p></blockquote>
      <p>toArray would be the right name like other components.<br class="atl-forced-newline" /></p>

      <p>Greetings </p>

      1. Jun 11, 2010

        <p>These are the rationales:</p>

        <p>> Why the second argument isn't the last as of all other methods?</p>

        <p>The second argument ($switchContext) as of all other methods, has to be the second and not the last argument. In this way each method behaves consistently to each other.</p>

        <p>This is the schema:<br />
        $method($mandatory_parameter, $common_parameter, $[optional_parameters, ...]);</p>

        <p>In this way, if the method has a long list of optional parameters, the common parameter ($switchContext in our case) will be placed always at the second position.</p>

        <p>In addition, there are some other practical reasons:</p>

        <p>One common usage of appendChild is this:</p>
        <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
        ->appendChild('child1', false) // VS ->appendChild('child1', null, array(), false)
        ->appendChild('child2', false, "Text inside") // VS ->appendChild('child2', "Text inside", array(), false)

        <p>> Why the second argument isn't the last as of all other methods?</p>

        <p>>> public function asArray();</p>

        <p>> toArray would be the right name like other components.</p>

        <p>Because asArray() doesn't perform a conversion of the document as you can expect, but returns an iterable array, or rather, a representation of the object <em>as</em> an array.</p>

  11. Jun 06, 2010

    <p>A fromArray() method would also be useful. Of course, maybe I should contribute this (time permitting).</p>

  12. Feb 08, 2011

    <p>Archiving this proposal, feel free to recover it when you want to work on it again. For more details see <a href="">this email</a>.</p>