# HG changeset patch # User Jacob Carlborg # Date 1280057155 -7200 # Node ID 27c5b6c5425f6025a3d3a4570fc5ee80b1745595 # Parent d17ae98330bf776c193d6dc4caca43732ab94b77 Deserialization now works as well using D2. Compiles again with D1 and Tango. Cleaned up orange.util.io a bit. diff -r d17ae98330bf -r 27c5b6c5425f .hgignore --- a/.hgignore Sat Jul 24 19:37:45 2010 +0200 +++ b/.hgignore Sun Jul 25 13:25:55 2010 +0200 @@ -12,5 +12,6 @@ *.dylib main.d main +main.d.deps *.framework kandil \ No newline at end of file diff -r d17ae98330bf -r 27c5b6c5425f orange/serialization/archives/XMLArchive.d --- a/orange/serialization/archives/XMLArchive.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/serialization/archives/XMLArchive.d Sun Jul 25 13:25:55 2010 +0200 @@ -7,11 +7,7 @@ module orange.serialization.archives.XMLArchive; version (Tango) -{ - /*import tango.text.xml.DocPrinter; - import tango.text.xml.Document;*/ import tango.util.Convert : to; -} else import std.conv; @@ -347,7 +343,7 @@ } auto tmp = getElement(Tags.objectTag, key, Attributes.keyAttribute, false); - + if (!tmp.isValid) { lastElement = getElement(Tags.nullTag, key); @@ -488,7 +484,7 @@ } private doc.Node getElement (DataType tag, DataType key, DataType attribute = Attributes.keyAttribute, bool throwOnError = true) - { + { auto set = lastElement.query[tag].attribute((doc.Node node) { if (node.name == attribute && node.value == key) return true; @@ -509,7 +505,7 @@ else throw new ArchiveException(`Could not unarchive the value with the key "` ~ to!(string)(key) ~ `" due to malformed data.`, __FILE__, __LINE__); } - + return doc.Node.invalid; } } diff -r d17ae98330bf -r 27c5b6c5425f orange/util/io.d --- a/orange/util/io.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/util/io.d Sun Jul 25 13:25:55 2010 +0200 @@ -39,8 +39,7 @@ else - foreach(t ; a) - write(t); + write(args); } /** @@ -63,10 +62,5 @@ } else - { - foreach(t ; args) - write(t); - - write("\n"); - } + writeln(args); } \ No newline at end of file diff -r d17ae98330bf -r 27c5b6c5425f orange/xml/PhobosXML.d --- a/orange/xml/PhobosXML.d Sat Jul 24 19:37:45 2010 +0200 +++ b/orange/xml/PhobosXML.d Sun Jul 25 13:25:55 2010 +0200 @@ -127,7 +127,7 @@ version (Phobos): -import std.array; +mixin(`import std.array; import std.string; import std.encoding; @@ -139,11 +139,12 @@ private tstring name_; private tstring value_; - this (tstring name, tstring value) + this (tstring name, tstring value, Element parent) { super(name); name_ = name; value_ = value; + parent_ = parent; } tstring name () @@ -769,7 +770,7 @@ attrs = attrs[0 .. 0]; foreach (k, v ; tag.attr) - attrs ~= new Attribute(k, v); + attrs ~= new Attribute(k, v, this); return attrs; } @@ -3044,5 +3045,5 @@ { throw new XMLException(s); } -} +}`);