diff --git a/plist-cil.test/UIDTests.cs b/plist-cil.test/UIDTests.cs
index 1c93430..5371232 100644
--- a/plist-cil.test/UIDTests.cs
+++ b/plist-cil.test/UIDTests.cs
@@ -86,10 +86,11 @@ namespace plistcil.test
string plist = original.ToXmlPropertyList();
- // UIDs don't exist in XML property lists, but they are represented as strings
+ // UIDs don't exist in XML property lists, but they are represented as dictionaries
// for compability purposes
- NSString roundtrip = XmlPropertyListParser.ParseString(plist) as NSString;
- Assert.Equal("abcd", roundtrip.ToObject());
+ var roundtrip = XmlPropertyListParser.ParseString(plist) as NSDictionary;
+ Assert.Single(roundtrip.Keys, "CF$UID");
+ Assert.Single(roundtrip.Values, new NSNumber(0xabcd));
}
}
}
\ No newline at end of file
diff --git a/plist-cil/UID.cs b/plist-cil/UID.cs
index 5405e1f..33d382b 100644
--- a/plist-cil/UID.cs
+++ b/plist-cil/UID.cs
@@ -148,19 +148,28 @@ namespace Claunia.PropertyList
}
///
- /// There is no XML representation specified for UIDs.
- /// In this implementation UIDs are represented as strings in the XML output.
+ /// UIDs are represented as dictionaries in XML property lists,
+ /// where the key is always CF$UID and the value is the integer
+ /// representation of the UID.
///
/// The xml StringBuilder
/// The indentation level
internal override void ToXml(StringBuilder xml, int level)
{
Indent(xml, level);
- xml.Append("");
- Span bytes = stackalloc byte[ByteCount];
- GetBytes(bytes);
- foreach(byte b in bytes) xml.Append(string.Format("{0:x2}", b));
- xml.Append("");
+ xml.Append("");
+ xml.AppendLine();
+
+ Indent(xml, level + 1);
+ xml.Append("CF$UID");
+ xml.AppendLine();
+
+ Indent(xml, level + 1);
+ xml.Append($"{this.value}");
+ xml.AppendLine();
+
+ Indent(xml, level);
+ xml.Append("");
}
internal override void ToBinary(BinaryPropertyListWriter outPlist)