dknx01/object-xml

A PHP library to generate xml string/documents in an object oriented way including xsd validation and restriction for values

dev-master 2017-08-31 14:04 UTC

This package is auto-updated.

Last update: 2024-04-06 09:04:48 UTC


README

A PHP library to generate xml string/documents in an object oriented way including xsd validation and restriction for values

Changelog

  • 0.7 adding CData element

Creating a new object

#!php

$xmlObj = new Dknx01\ObjectXml\ObjectXml();

Restrictions

Each element can have restrictions which are automatically executed for the given value.

If you want to create your own restriction it must implement the Dknx01\ObjectXml\Restriction\RestrictionInterface.

Element

Each xml element is represented by an own element object. There are some basic element:

Element classdescription
BaseElementThe base element
BooleanElementElement for boolean values
CollectionElementCollection of other element
DateElementElement for date values
DateTimeElementElement for datetime values
FloatElementElement for float values
IntegerElementElement for integer values
StringElementElement for string values
TimeElementElement for time values
  • If you want to create your own element it must implement the Dknx01\ObjectXml\Element\ElementInterface.
  • If you want to use attributes in must implement the Dknx01\ObjectXml\Element\AttributesAwareInterface.
  • If you want to use restrictions it must implement the Dknx01\ObjectXml\Element\RestrictionAwareInterface.

Attributes

Each element object can have one or more attributes. Each attribute can also have restrictions like a xml object. If you have more than one attribute, you can use the attribute collection.

The BaseAttribute is the normal attribute with a name and a value (string) and no restriction.

If you want to create your own attribute it must implement the Dknx01\ObjectXml\Element\AttributeInterface

Help

For help have a look into Dknx01\ObjectXml\Resources\examples