Skip to content

Tag with shortclosing and with greater than in attribute parsing problem #60

@stefanpausch

Description

@stefanpausch

Problem: If an greater than (>) sign (non html entity formatted) exists within at short closing tag attribute the Streamer cannot find the next matching tag and reads until the the end of file, which causes trouble in parsing the returned node with simplexml.

Running xml-string-streamer 0.11.0

Example code:

<?xml version="1.0" encoding="UTF-8"?> <root> <child addressLine3="teststring>"/> <child addressLine3="teststring"/> <child addressLine3="teststring"/> </root>

With the example code the streamer finds the first child and returns ALL xml afterwards (does not find the 2nd/3rd child).

If i configure the StringWalker with expectGT and Short Closing Tag the Parser does not find any nodes at all:

expectGT' => true, 'tagsWithAllowedGT' => array( array("<", "/>"), ),

As i read greater than is a non valid character, but within attributes it is allowed. DOMReader and SimpleXML parse the file without any problems.

SimpleXMLElement Object ( [child] => Array ( [0] => SimpleXMLElement Object ( [@attributes] => Array ( [addressLine3] => teststring> ) ) [1] => SimpleXMLElement Object ( [@attributes] => Array ( [addressLine3] => teststring ) ) [2] => SimpleXMLElement Object ( [@attributes] => Array ( [addressLine3] => teststring ) ) ) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions