Alexander
Alexander

Reputation: 20234

Error in XML document (2,13)

This is the ASCII data of an XML document returned by an EWS call and formatted using (new ASCIIEncoding()).GetString(XmlData):

<?xml version="1.0"?>
<categories default="Alltag" lastSavedSession="3" lastSavedTime="2013-11-21T13:15:18.2751355Z" xmlns="CategoryList.xsd">
    <category name="Lila Kategorie" color="8" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-04T16:54:56.824Z" lastSessionUsed="0" guid="{56d27797-6a5f-4e0a-9e68-54e386b68e3a}" renameOnFirstUse="1" />
    <category name="Gelbe Kategorie" color="3" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-04T16:54:56.824Z" lastSessionUsed="0" guid="{19008ab2-00a6-4149-a531-fd58edb3fc8c}" renameOnFirstUse="1" />
    <category name="Blaue Kategorie" color="7" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-11-04T16:58:58.111Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-04T16:58:58.111Z" lastSessionUsed="1" guid="{94281f1d-827d-43f5-a4f6-3840e9378932}" renameOnFirstUse="0" />
    <category name="Grüne Kategorie" color="4" keyboardShortcut="0" usageCount="2" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-04T16:54:56.824Z" lastSessionUsed="0" guid="{00ce8d45-4555-47a2-b8b1-2f55d6ff6ccc}" renameOnFirstUse="1" />
    <category name="Orange Kategorie" color="1" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-11-04T16:59:01.511Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-04T16:59:01.511Z" lastSessionUsed="1" guid="{0b4c0f71-b0cc-4c4e-afd1-99ba9af28ff9}" renameOnFirstUse="0" />
    <category name="SChulung" color="2" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-11-12T16:11:01.011Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-12T16:11:01.011Z" lastSessionUsed="2" guid="{c5c0a53e-a556-4011-8530-0e8e7ddefc90}" renameOnFirstUse="0" />
    <category name="Alltag" color="0" keyboardShortcut="0" usageCount="5" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="1601-01-01T00:00:00Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-19T13:45:32.627Z" lastSessionUsed="2" guid="{d1d2d16e-10f3-4304-9f94-141016b95ccf}" renameOnFirstUse="0" />
    <category name="Feiertag" color="5" keyboardShortcut="0" usageCount="6" lastTimeUsedNotes="1601-01-01T00:00:00Z" lastTimeUsedJournal="1601-01-01T00:00:00Z" lastTimeUsedContacts="1601-01-01T00:00:00Z" lastTimeUsedTasks="1601-01-01T00:00:00Z" lastTimeUsedCalendar="2013-11-19T13:52:12.467Z" lastTimeUsedMail="1601-01-01T00:00:00Z" lastTimeUsed="2013-11-19T13:52:12.467Z" lastSessionUsed="3" guid="{6e812025-ab62-4092-b599-55df683eef20}" renameOnFirstUse="0" />
</categories>    

My first question: What does ??? mean at that point? Is this caused by me using ASCII instead of UTF or whatever encoding MS uses?

My program, trying to decode aforementioned document, throws an "Error in XML document (2,13)" in the second line of the following:

UserConfiguration UsrConfig = UserConfiguration.Bind(ews, "CategoryList", WellKnownFolderName.Calendar, UserConfigurationProperties.All);
System.IO.MemoryStream stream = new System.IO.MemoryStream(UsrConfig.XmlData);

My second question: What does the (2,13) mean?

To clarify, I asked the program to return the BaseException, it is

System.FormatException: GUID muss 32 Ziffern mit 4 Bindestrichen enthalten (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
bei System.Guid.GuidResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object failureMessageFormatArgument, String failureArgumentName, Exception innerException)
bei System.Guid.TryParseGuidWithNoStyle(String guidString, GuidResult& result)
bei System.Guid.TryParseGuid(String g, GuidStyles flags, GuidResult& result)
bei System.Guid..ctor(String g)
bei System.Xml.XmlConvert.ToGuid(String s)
bei Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMasterCategoryList.Read5_MasterCategoryList(Boolean isNullable, Boolean checkType)
bei Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderMasterCategoryList.Read6_categories()

Problem: I don't see any Guid that does not meet these requirements; and even if I did, the XMLs origin is Microsoft - I don't see why I should have to change anything there.

The XML deserialization is done according to a model I found on the net, which contains

[XmlAttribute("guid")]
public Guid Id
{
    get { return _IdField; }
    set {
        _IdField = value;
        RaisePropertyChanged("Id");
    }
}

My third question: What other possibilities, than changing the Guid data type to string, will I have to solve my problem? (By the way, I only need name and color of the categories...)

Upvotes: 0

Views: 444

Answers (1)

Related Questions