xml-to-array icon indicating copy to clipboard operation
xml-to-array copied to clipboard

Illegal string offset 'xsl:output'

Open SergioFloresG opened this issue 8 years ago • 7 comments

Hi! I want to parse a XML but this tag is generated a Exception

[ErrorException]
Illegal string offset 'xsl:output'

SergioFloresG avatar Nov 14 '17 19:11 SergioFloresG

This is the original file. cadenaoriginal_3_3.zip

In XmlToArray::convertDomElement

  1. I'm temporarily omit comments.
  2. I think the detail is that if a DOMText is detected, the variable $result is replaced by a string and it can no longer be assigned as an array.

SergioFloresG avatar Nov 14 '17 19:11 SergioFloresG

+1 PHP Warning: Illegal string offset 'oemmodelcode' in /var/www/vendor/vyuldashev/xml-to-array/src/XmlToArray.php on line 63

zolotov88 avatar Mar 29 '18 05:03 zolotov88

+1 ErrorException (E_WARNING) Illegal string offset 'hlword'

ALiSHERBE avatar Apr 06 '18 21:04 ALiSHERBE

Hello, this package can transform simple xml files. I might find some time to tweak it. Any help will be appreciated.

vyuldashev avatar Apr 06 '18 23:04 vyuldashev

Also, I think xls will be supported.

@Zolotov88 @ALiSHERBE can you send xml examples?

vyuldashev avatar Apr 06 '18 23:04 vyuldashev

<?xml version="1.0"?>
<root>
  <Good_guy>
    <name>Luke Skywalker</name>
    <weapon>Lightsaber</weapon>
  </Good_guy>
  <Bad_guy>
    <name>Sauron</name>
    <weapon>Evil Eye</weapon>
  </Bad_guy>
</root>

Dies on Luke Skywalker <-- Illegal string offset 'name' --- var_dump($result) =

string(5) "
    "

ellisgl avatar Jul 31 '18 22:07 ellisgl

Formatting messes things up. Pass in the string without whitespaces, new lines and carrigage returns.

<items><good_guy><name>Luke Skywalker</name><weapon>Lightsaber</weapon></good_guy><bad_guy><name>Sauron</name><weapon>Evil Eye</weapon></bad_guy></items>

ondrejsanetrnik avatar Aug 04 '20 12:08 ondrejsanetrnik