www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - arsd dom

reply Amex <Amex gmail.com> writes:
When parsing an xml file I get #text for tagName on basically 
every other element.

I'm trying to recurse through all the elements

using

	void recurse(T)(T parent, int depth = 0)
	{
		foreach(c; parent.children)
		{
			recurse(c, depth + 1);			
			writeln("\t".replicate(depth)~c.tagName);
		}

		//writeln("\t".replicate(depth)~parent.tagName);
	}

	recurse(i);


and I get

#text
requires
#text
         #text
                 #text
         property
         #text
                 #text
         property
         #text
                 #text
         property
         #text
                 #text
         property
         #text
                 #text
         property
         #text
                 #text
                         #text
                                 #text
                         property
                         #text
                                 #text
                         property
                         #text
                                 #text
                         property
                         #text


Any idea what might be going on?
Jun 12 2019
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Wednesday, 12 June 2019 at 10:06:39 UTC, Amex wrote:
 When parsing an xml file I get #text for tagName on basically 
 every other element.
Those are the text nodes representing the whitespace between elements. `<foo>bar</foo> <test />` has: element Foo, text " ", element text.
Jun 12 2019