diff --git a/source/std/experimental/xml/domimpl.d b/source/std/experimental/xml/domimpl.d index 7186682..013a601 100644 --- a/source/std/experimental/xml/domimpl.d +++ b/source/std/experimental/xml/domimpl.d @@ -29,12 +29,11 @@ import std.experimental.allocator.gc_allocator; // this is needed because compilers up to at least DMD 2.071.1 suffer from issue 16319 private auto multiVersionMake(Type, Allocator, Args...)(ref Allocator allocator, auto ref Args args) { - static if (__traits(compiles, allocator.make!Type(args))) + static if (Args.length == 0 && __traits(compiles, allocator.make!Type(args))) return allocator.make!Type(args); - else static if (Args.length > 0 && __traits(compiles, allocator.make!Type(args[1..$]))) + else static if (Args.length > 0 && __traits(compiles, allocator.make!Type(args[0 .. $]))) { - auto res = allocator.make!Type(args[1..$]); - res.outer = args[0]; + auto res = allocator.make!Type(args[0 .. $]); return res; } else @@ -2390,7 +2389,7 @@ class DOMImplementation(DOMString, Alloc = shared(GCAllocator), ErrorHandler = b else alias MapToConfigName = AliasSeq!(); } - private static immutable string[] arr = [MapToConfigName!(__traits(allMembers, Params))]; + static immutable string[] arr = [MapToConfigName!(__traits(allMembers, Params))]; // specific to DOMStringList override diff --git a/source/std/experimental/xml/package.d b/source/std/experimental/xml/package.d index db6a5a0..2cd6936 100644 --- a/source/std/experimental/xml/package.d +++ b/source/std/experimental/xml/package.d @@ -56,9 +56,14 @@ + + // write it out to "catalogue.xml" + auto file = File("catalogue.xml", "w"); -+ file.lockingTextWriter -+ .writerFor!string // instatiates an xml writer on top of an output range -+ .writeDOM(dom); // write the document with all of its children ++ ++ auto textWriter = file.lockingTextWriter; // instatiates an xml writer on top of an output range ++ textWriter.writerFor!string.writeDOM(dom); // write the document with all of its children ++ ++ // bug: ++ // file.lockingTextWriter ++ // .writerFor!string // instatiates an xml writer on top of an output range ++ // .writeDOM(dom); // write the document with all of its children + ----- + + Also available is a SAX parser, which we will use to find all text nodes containing diff --git a/source/std/experimental/xml/writer.d b/source/std/experimental/xml/writer.d index 8d4455e..bf49451 100644 --- a/source/std/experimental/xml/writer.d +++ b/source/std/experimental/xml/writer.d @@ -577,7 +577,7 @@ void writeDOM(WriterType, NodeType)(auto ref WriterType writer, NodeType node) foreach (attr; elem.attributes) writer.writeAttribute(attr.nodeName, attr.value); foreach (child; elem.childNodes) - writer.writeDOM(elem); + writer.writeDOM(child); writer.closeElement(elem.tagName); break; case text: