PHP Classes
elePHPant
Icontem

ubNode: Convert objects into XML and vice-versa

Recommend this page to a friend!
  Info   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2008-11-23 (7 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 270 All time: 7,230 This week: 1,113Up
Version License PHP version Categories
convertion_data 1.0Artistic License5.0XML, PHP 5, Data types
Description Author

This class can be used to convert objects into XML documents and vice-versa.

It can take an object and generate a XML document file that contains a representation of the object structure.

The class can also do the opposite, i.e. load a XML document file and create an object from the structured defined in the XML document.

Picture of Reynier Blanco
Name: Reynier Blanco <contact>
Classes: 6 packages by
Country: Cuba Cuba

Details
The objective of this class is to allow both a mapping of an object as an XML, in order to perform various transformations according to the needs of the developer.
The first thing is to read either an object or an XML file using the methods of the class which ubRoot nothing more than a more specialized class.
Example:
     $ root = ubRoot: load_object ($ t_a); => returns an object ubRoot
     $ root = ubRoot: load_xml ( "node.xml"); => returns an object ubRoot

After having already been the object ubRoot can obtain information at any of the formats allowing further that if an XML can be given directly to the address where you want to be saved.

And said the goal is to explain how to work with the class and specify certain characteristics that make it possible to read the object

1. Of the objects will be taken only the result of the methods that start with "get__" then the attribute name, but the prefix can be changed if desired.

2. In the same way to introduce the values of the class is a necessary method for each attribute you want to use that method must be prefixed "set__", which as in the case of get__ can be changed

3. The objective of using a different code to "get" that is because we are used as a general parameters that we are no map or are recorded in an XML, either because they are measurable or because what saved them is an identifier .
The important thing is that it allows great flexibility in developing the data when choosing a class that wants to be map

4. In case of the array is mapped all the information as appropriate. The keys of the settlement are represented as an internal node where the name would be the same key in whether, if the numerical values are taken to a string in the format "_ #" where # is the position in the settlement of this element .

5. Note that in cases where the object is to map out a class you are adding an attribute to this node, "ub_class_name" that represents the name of the class of that object.

6. Where to read an XML is within a node two nodes with the same name as it includes a settlement by that name as a key node and each would become a position of the settlement.

7. Where to read an XML is with several nodes named "_" take it as an arrangement where the name is the node that contains those that have the name "_" and each node of these will turn into a position within of that settlement.

8. Where to read an XML is a node that has an attribute "ub_is_array" will take it as a node at one position
  Files folder image Files  
File Role Description
Accessible without login Plain text file index.php Example ejemplo
Accessible without login Plain text file load.xml Aux. example of xml
Plain text file node.php Class Clase principal
Accessible without login Plain text file readme_en.txt Doc. description in english
Accessible without login Plain text file readme_es.txt Doc. description in spanish
Plain text file see.php Class especial para verificación
Plain text file test_a.php Class clases de ejemplo
Plain text file test_b.php Class clases de ejemplo

 Version Control Unique User Downloads Download Rankings  
 0%
Total:270
This week:0
All time:7,230
This week:1,113Up