[Issue 2979] New: Xml tags with only attributes return as without attributes ElementParser.parse
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 14 05:26:31 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2979
Summary: Xml tags with only attributes return as without
attributes ElementParser.parse
Product: D
Version: 2.030
Platform: All
OS/Version: All
Status: NEW
Keywords: patch
Severity: minor
Priority: P4
Component: Phobos
AssignedTo: bugzilla at digitalmars.com
ReportedBy: y0uf00bar at gmail.com
CC: y0uf00bar at gmail.com
Minor functionality problem in std.xml in Phobos.
This is an easy patch fix.
Consider that XML
<mytag attr1="value1"/>
is the effectively same thing as
<mytag attr1="value1"/></mytag>
The first version reads better, as if that is an xml issue.
The onStartText delagate call back argument ElementParser will have a tag
object with no attributes for the first version, and will have the attributes
for the second. In the first the private Tag constructor parses the attributes
and reports the Tag as TagType.EMPTY, in the sense that there is no content.
Slight fix: In ElementParser.parse()
at line 1945:
else if (tag_.isEmpty)
{
Tag startTag = new Tag(tag_.name);
//++ add these 2 lines
if (tag_.attr.length > 0)
foreach(tn,tv; tag_.attr) startTag.attr[tn]=tv;
//so the returned Tag in the element.
Alternately change the Tag constructor to report the Tag as START if it has
attributes. But this will be a bigger change code flow design and efficiency.
Either way, the onStartTag call returns a Tag with START
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list