2017 © Pedro Peláez
 

library xml

A XML (Un-)Serialization Library, full configureable via annotations.

image

jas/xml

A XML (Un-)Serialization Library, full configureable via annotations.

  • Tuesday, March 24, 2015
  • by possi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

jas XML-Package

A XML (Un-)Serialization Library, full configureable via annotations., (*1)

Installation:

Add this line to your composer.json "require" section:, (*2)

composer.json

    "require": {
       ...
       "jas/xml": "*"

Usage

use jas\xml\Meta as Xml;
/**
 * @Xml\Document(rootNode = "foo")
 */
class MyObject {
    /**
     * @var int
     * @Xml\Attribute(name="bar")
     */
    protected $foo = 4;
    /**
     * @var string
     * @Xml\Element(name="hello")
     */
    protected $bar = "hello world";
}

$xml = jas\xml\Writer::toXML(new MyObject); -> /*

<foo bar="4">
  <hello>world</hello>
</foo>
*/

$myobject = jas\xml\Reader::fromXML('MyObject', $xml);

TODO

  • Outsource Reader/Writer-Logic to "layouts". A Layout should describe, how data is mapped between object and XML. This is especially for Lists which might be mixed up by different types of elements, ... That will be a very complex step.
  • Group Writer an Reader into a "Processor" that can be configuried with default options, or at which XML-Definitions can be set without Annotations (to support php or yaml configurations and so on). (implementation issue: how to manage "static" usage via reader/writer!?)
  • Read attribute/element type from @var-doccomment with namespace parsing
  • Namespace support
  • Dynamic TypeMap to automaticly convert type-name to class name in an php namespace via callback

The Versions

24/03 2015

dev-master

9999999-dev https://github.com/possi/jas_xml

A XML (Un-)Serialization Library, full configureable via annotations.

  Sources   Download

MIT

The Requires

 

xml serialization annotation