Skip to content

Commit

Permalink
Incorrect xml DOM writer and example
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangXuePing authored and BitWorld committed Jan 13, 2018
1 parent e82dc96 commit 3a9c7ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions source/std/experimental/xml/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/std/experimental/xml/writer.d
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3a9c7ba

Please sign in to comment.