Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#7545 closed defect (fixed)

DomParser: empty-element tags not implemented

Reported by: chucky Owned by: Tom Trenka
Priority: high Milestone: 1.2
Component: Dojox Version: 1.1.1
Keywords: xml parser DomParser "self-closing tags" "empty-element tags" Cc: tomas.mikula@…
Blocked By: Blocking:

Description

dojox.xml.DomParser? does not parse document with empty-element tags (e.g. <br/>) correctly. As I looked into the source, it seems not to be implemented at all. However, no error is reported and the result is wrong.

Example:

var xml = '<root><one></one><two></two><three/><four></four><five></five></root>';
var dom = dojox.xml.DomParser.parse(xml);
var children = dom.documentElement.childNodes
var names = "";
for(var i in children){
	names += children[i].nodeName + ' ';
}
alert(xml + ' has ' + children.length + ' nodes in the root element:\n' + names);

shows

<root><one></one><two></two><three/><four></four><five></five></root> has 2 nodes in the root element:
one two 

Change History (5)

comment:1 Changed 11 years ago by Adam Peller

Owner: changed from Adam Peller to Tom Trenka

comment:2 Changed 11 years ago by Tom Trenka

Milestone: tbd1.3
Status: newassigned

Um, it is implemented; line 354 is the test for self-closing tags. If it's not working it might be regression bug introduced with a text node fix made by LiuCougar?.

I'll investigate.

comment:3 Changed 11 years ago by Tom Trenka

OK, it's an expression issue. A space between the self-closing tag works, i.e. :

<three />

but when there is no space, the expression fails, i.e:

<three/>

Will fix for the 1.3 release.

comment:4 Changed 11 years ago by Tom Trenka

Resolution: fixed
Status: assignedclosed

(In [15011]) Fixes #7545. Initial check for closing tags was not testing to ensure that there was actually a tagname with the closing slash. !strict.

comment:5 Changed 11 years ago by Adam Peller

Milestone: 1.31.2
Note: See TracTickets for help on using tickets.