Link to home
Start Free TrialLog in
Avatar of Cognize
Cognize

asked on

Help required deserializing (C# / VB) an Xml File to an Object according to Schema - Where is shcema passed in?

Hi,

I have a bug where an xml file is deserializing, but is missing some info from the xml file.

The file validates against a schema. What I want to do is make sure that I'm giving the deserializer the correct schema.

The schema is not referenced in the xml files (given to me by a 3rd party)

Is there a way of pointing the deserializer to a local copy of the schema to see if that helps?

Thanks
Public Sub SaveXMLFile(ByVal fileName As String, ByVal importObject As XMLImportObject)
        Dim xmlLoader As New XmlSerializer(GetType(XMLImportObject))
        Dim writer As New XmlTextWriter(fileName, System.Text.Encoding.UTF8)
        writer.Formatting = Formatting.Indented
        xmlLoader.Serialize(writer, importObject)
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jimbobmcgee
jimbobmcgee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Cognize
Cognize

ASKER

Thanks