jmarceli / array2xml Goto Github PK
View Code? Open in Web Editor NEWConvert PHP array to XML with support for attributes and CDATA
License: MIT License
Convert PHP array to XML with support for attributes and CDATA
License: MIT License
It seems that if you add multiple childs with the same name into an element only the last one will be set.
So if you have a list of products and your parent is 'products' then add 4 children with the name 'product' only the last one will be written into the XML.
Thanks a lot, awesome! :) The example on your github on how to use it is even more awesome! Why isn't everyone making their software manuals that easy!
How could I hardcode this to my xml?
We should add license.
For the sake of consistency, wouldn't be better to always use CDATA blocks for the tag content?
In this way, the value supplied can always be used as is, and will never require any escaping (even if performed automatically).
Also, this would get rid of the #
prefix.
Finally, when a tag has both attributes and a value, it should be possible to get rid of both !
and %
prefixes by using the first value with numeric key as the value for the tag, that is, instead of
'photos' => array(
'photo' => array(
0 => array(
'@mainphoto' => '1',
'%' => '1.png',
),
1 => array(
'@mainphoto' => '0',
'%' => '2.png',
),
2 => array(
'@mainphoto' => '0',
'%' => '3.png',
)
)
)
it should be sufficient to write
'photos' => array(
'photo' => array(
0 => array(
'@mainphoto' => '1',
'1.png',
),
1 => array(
'@mainphoto' => '0',
'2.png',
),
2 => array(
'@mainphoto' => '0',
'3.png',
)
)
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.