Skip to content

Magento\Framework\Xml\Parser class issues #681

Closed
@tzyganu

Description

@tzyganu

I've been trying to use the Magento\Framework\Xml\Parser class and I had some issues with it. It does not behave as it should, or at least how I expected it to. But maybe my assumptions are wrong.

  1. The switch statement in the _xmlToArray method does not handle the case XML_CDATA_SECTION_NODE. So for all the nodes that look like this <node_name><![CDATA[Some data here]]></node_name>, when converted to array I just see an empty array() instead of Some data here.
  2. in the same switch and the same method as above, on the case XML_TEXT_NODE there is a check to see if the value is empty. if (trim($node->nodeValue)) {.... The expression is evaluated to false even if the node value is 0. So again when converting a node like <node_name>0</node_name> I end up with an empty array() instead of 0...which brings be to point 3.
  3. Why is the default value for the $content variable an empty array? Shouldn't this be an empty string?

that's all for now. In case I'm using this wrong and the problem is on my side, just let me know and close this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions