mtownsend5512 / xml-to-array Goto Github PK
View Code? Open in Web Editor NEWEasily convert valid xml to a php array.
License: MIT License
Easily convert valid xml to a php array.
License: MIT License
Hi
I'm trying to read an invalid XML with your plugin and i'm receiving the error of why its invalid [xmlParseEntityRef: no name in Entity].
Is it possible to turn off this notification and parse it anyway?
Thanks!
[https://sendeyo.com/en/5bf52e9c87]
Please look at this file and when I do this I got null array in return
$user = $xml->parse([
'nmaprun' => ['uses' => 'nmaprun::scanner'],
'element' => ['uses' => 'extraports.state'],
// 'followers' => ['uses' => 'user::followers'],
]);
I've got this error, when value in XML is HTML is not encoded or wrapped into CDATA (info).
Example:
<content>This is <b>bold</b></content>
Is there option how to handle this error and continue parsing XML?
When using parseXml( );
and the XML file has for example two node child's with similar names one of them gets replaced instead of getting grouped together
<?xml version="1.0" encoding="UTF-8"?>
<cbc:ID>1616</cbc:ID>
<OrderResponse>
<cac:OrderLine>
<cac:LineItem>
<cbc:ID>1</cbc:ID>
</cac:LineItem>
<cac:OrderLineReference>
<cbc:LineID>1.00</cbc:LineID>
</cac:OrderLineReference>
</cac:OrderLine>
<cac:OrderLine>
<cac:LineItem>
<cbc:ID>2</cbc:ID>
</cac:LineItem>
<cac:OrderLineReference>
<cbc:LineID>2.00</cbc:LineID>
</cac:OrderLineReference>
</cac:OrderLine>
</OrderResponse>
If we try to parse this
<?xml version="1.0" encoding="utf-8"?>
<CumulativeOperatingHoursMessages >
<Links>
<rel>self</rel>
</Links>
<CumulativeOperatingHours datetime="2019-09-12T05:55:15Z">
<Hour>634.24</Hour>
</CumulativeOperatingHours>
<CumulativeOperatingHours datetime="2019-09-12T05:55:15Z">
<Hour>634.24</Hour>
</CumulativeOperatingHours>
</CumulativeOperatingHoursMessages>
Its parsed like an array of items -> OK
But if we parse this
<?xml version="1.0" encoding="utf-8"?>
<CumulativeOperatingHoursMessages >
<Links>
<rel>self</rel>
</Links>
<CumulativeOperatingHours datetime="2019-09-12T05:55:15Z">
<Hour>634.24</Hour>
</CumulativeOperatingHours>
</CumulativeOperatingHoursMessages>
It's not parsed as an array and also the keys / indexes are duplicated..... -> Issue
T
Hello, thank you for making this.
Can i use this for large dataset? my xml files are from 100mb to 500mbs. does it work perfectly with that? thanks alot
could be an idea to maybe haven an option to strip namespaces?
I had to process some really old xml files that contained namespaces that made no sense at all.
So I have just replaced tagName with localName in your code, but there might be an better way to do it I guess.
If empty xml is given as parameter, empty array can be returned.
XmlToArray.php:32
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.