onStartTag for root node in std.xml

Heromyth bitworld at qq.com
Thu Dec 22 02:57:46 PST 2011

In the test code, the onStartTag will not be called for the root node "set".

The onEndTag is OK, and the onStartTag is OK for sub nodes.

Is this a bug, or just it is? Can anybody confirm it?

// test.d
module main;

import std.string;
import std.stdio;
import std.xml;

int main(string[] argv)
	string s = r"<?xml version='1.0'?>
		<!-- comment -->

	string tempStr;

	auto xml = new DocumentParser(s);

	xml.onStartTag["set"] = (ElementParser xml)
		tempStr = "start=>" ~  xml.tag.name;

	xml.onEndTag["set"] = (in Element e)
		tempStr = "end=>" ~ e.tag.name;


   return 0;

More information about the Digitalmars-d-learn mailing list