PHP Classes

What is the best PHP array to xml class?: Generate XML from the multi dimensional

Recommend this page to a friend!
  All requests RSS feed  >  What is the best PHP array to xml class?  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

What is the best PHP array to xml class?

Edit

Picture of zeeshan by zeeshan - 9 years ago (2015-04-16)

Generate XML from the multi dimensional

This request is clear and relevant.
This request is not clear or is not relevant.

+3

I am looking for a class to generate XML from the multi dimensional array.

Ask clarification

1 Recommendation

QXML: XML <> Array (preserve attrib.), JSON, etc.

This class can be used to generate XML documents from arrays and also parse XML documents to build arrays.

It can work with an XML's textNodes and attributes, stores them into an array and generates an XML document.

This class can also do the opposite, i.e. take an XML document file or string and parse it, and then build an array.

It is quite simple in handling. Just look at the sample files.

Feature List:
- Array to XML Conversion while preserving attributes
- XML to Array Conversion
- XML to SimpleXMLElement Object
- SimpleXMLElement Object to XML
- XML to JSON
- Array to JSON

Other Scripts
- Schema Transformation for usage with Propel or Doctrine ORM
- Google Routes to GPX
- PHP Classes Reflection to XML

to be rewritten and provided later this year:
- QQuery (originally written as a set of classes for usage within symfony framework )

If you have suggestions for making it better then let me know.
This recommendation solves the problem.
This recommendation does not solve the problem.

+3

Picture of Manuel Lemos by Manuel Lemos Reputation 26695 - 9 years ago (2015-08-16) Comment

There are so many classes for that purpose that it is hard to recommend one.

This one seems to provide a very extensive set of features that you may not need but may be useful in other contexts.

  • 2 Comments
  • 1. Picture of Martin Barker by Martin Barker - 9 years ago (2015-08-21) Reply

    The problem with this Request is the distinction i think QXML is a good one for it but if you pass an array and want it converting to XML are the values to be an attribute of the tag or another tag inside the tag

    E.G (array("test" = > array("attr" = 1, "value" = 2));

    Could be <test><attr>1</attr><value>2</value></test> or <test attr="1"><value>2</value></test> or <test attr=1 value="2"/>

  • 2. Picture of Manuel Lemos by Manuel Lemos - 9 years ago (2015-08-21) in reply to comment 1 by Martin Barker Reply

    Yes, the array must have a specific structure if you want to generate both children tags and attributes.


Recommend package
: 
: