none
xmlns=''> was not expected. RRS feed

  • Question

  • I've seen a lot of questions with this same error but none of the responses seem to work for me. My xml file is generated by another program and I can't make any changes to it. my class was generated from the xsd file.  The files are fairly large so I'll just include portions of the files.  Let me know if I you need more.

    VB Code:

    Dim ATSpecialistFn As String = fnout & "\" & "Atspecialist.xml" reader = New XmlSerializer(GetType(ATSpec_Type)) file = New StreamReader(ATSpecialistFn) ATSpecialistData = CType(reader.Deserialize(file), ATSpecialist_Records)

    ' get error message: <ATSpecialist_Records xmlns=''> was not expected.

    Class:

    '------------------------------------------------------------------------------
    ' <auto-generated>
    '     This code was generated by a tool.
    '     Runtime Version:4.0.30319.42000
    '
    '     Changes to this file may cause incorrect behavior and will be lost if
    '     the code is regenerated.
    ' </auto-generated>
    '------------------------------------------------------------------------------
    
    Option Strict Off
    Option Explicit On
    
    Imports System.Xml.Serialization
    
    '
    'This source code was auto-generated by xsd, Version=4.0.30319.1.
    '
    
    '''<remarks/>
    <System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1"), _
     System.SerializableAttribute(), _
     System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.ComponentModel.DesignerCategoryAttribute("code"), _
     System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=True), _
     System.Xml.Serialization.XmlRootAttribute([Namespace]:="", IsNullable:=False)> _
    Partial Public Class ATSpecialist_Records
    
        Private aTSpecField As ATSpec_Type
    
        Private aTSpecPositionsGIDispField() As String
    
        Private aTSpecialistParametersField() As ATSpecialistParameters_Type
    
        Private nOTAMRField As NOTAMR_Type
    
        Private alertsAdaptationField As AlertsAdaptation_Type
    
        Private commandListAdaptField() As CommandListAdapt_Type
    
        '''<remarks/>
        Public Property ATSpec() As ATSpec_Type
            Get
                Return Me.aTSpecField
            End Get
            Set(ByVal value As ATSpec_Type)
                Me.aTSpecField = value
            End Set
        End Property
    
        '''<remarks/>
        <System.Xml.Serialization.XmlArrayItemAttribute("ATSpecialistID", IsNullable:=False)> _
        Public Property ATSpecPositionsGIDisp() As String()
            Get
                Return Me.aTSpecPositionsGIDispField
            End Get
            Set(ByVal value As String())
                Me.aTSpecPositionsGIDispField = value
            End Set
        End Property
    
        '''<remarks/>
        <System.Xml.Serialization.XmlElementAttribute("ATSpecialistParameters")> _
        Public Property ATSpecialistParameters() As ATSpecialistParameters_Type()
            Get
                Return Me.aTSpecialistParametersField
            End Get
            Set(ByVal value As ATSpecialistParameters_Type())
                Me.aTSpecialistParametersField = value
            End Set
        End Property
    

    XML File:

    <?xml version="1.0"?>
    
    -<ATSpecialist_Records xsi:noNamespaceSchemaLocation="ATSpecialist.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    
    <!-- ******************************************************** -->
    
    
    <!-- Local SITE ID : ZOA -->
    
    
    <!-- Local Release Version: o313b913 -->
    
    
    <!-- NASD/NADR Version : zosub913 -->
    
    
    <!-- Date : 09-07-2018 17:18:11 -->
    
    
    <!-- ******************************************************** -->
    
    
    
    -<ATSpec>
    
    <AutomaticPrintGIFlag>true</AutomaticPrintGIFlag>
    
    </ATSpec>
    
    
    -<ATSpecPositionsGIDisp>
    
    <ATSpecialistID>E1</ATSpecialistID>
    
    <ATSpecialistID>E5</ATSpecialistID>
    
    <ATSpecialistID>E9</ATSpecialistID>
    
    <ATSpecialistID>G1</ATSpecialistID>
    
    <ATSpecialistID>G5</ATSpecialistID>
    
    <ATSpecialistID>G8</ATSpecialistID>
    
    <ATSpecialistID>G9</ATSpecialistID>
    
    <ATSpecialistID>S1</ATSpecialistID>
    
    <ATSpecialistID>W1</ATSpecialistID>
    
    <ATSpecialistID>W2</ATSpecialistID>
    
    </ATSpecPositionsGIDisp>
    
    
    -<ATSpecialistParameters>
    
    <ATSpecialistID>E1</ATSpecialistID>
    
    <AlertPresent>true</AlertPresent>
    
    <AsStatusPresent>true</AsStatusPresent>
    
    <BlockedListPresent>true</BlockedListPresent>
    
    <FPCorrectionPresent>false</FPCorrectionPresent>
    
    <HoldPresent>true</HoldPresent>
    
    <LogonQueryPresent>true</LogonQueryPresent>
    
    <NOTAMPresent>false</NOTAMPresent>
    
    <NOTAMRPresent>false</NOTAMRPresent>
    
    <RefMsgPresent>true</RefMsgPresent>
    
    <RestrictionsPresent>true</RestrictionsPresent>
    
    <SearchPresent>true</SearchPresent>
    
    <MetInfoPresent>true</MetInfoPresent>
    
    <TextFileDisplayPresent>true</TextFileDisplayPresent>
    
    <PrinterName>E01P</PrinterName>
    
    <DeleteAuthority>true</DeleteAuthority>
    
    <EditAuthority>true</EditAuthority>
    
    <ExecuteAuthority>true</ExecuteAuthority>
    
    <CreateAuthority>true</CreateAuthority>
    
    </ATSpecialistParameters>
    
    
    -<ATSpecialistParameters>
    
    <ATSpecialistID>E5</ATSpecialistID>
    
    <AlertPresent>true</AlertPresent>
    
    <AsStatusPresent>true</AsStatusPresent>
    
    <BlockedListPresent>true</BlockedListPresent>
    
    <FPCorrectionPresent>true</FPCorrectionPresent>
    
    <HoldPresent>true</HoldPresent>
    
    <LogonQueryPresent>true</LogonQueryPresent>
    
    <NOTAMPresent>true</NOTAMPresent>
    
    <NOTAMRPresent>true</NOTAMRPresent>
    
    <RefMsgPresent>true</RefMsgPresent>
    
    <RestrictionsPresent>true</RestrictionsPresent>
    
    <SearchPresent>true</SearchPresent>
    
    <MetInfoPresent>true</MetInfoPresent>
    
    <TextFileDisplayPresent>true</TextFileDisplayPresent>
    
    <PrinterName>E02P</PrinterName>
    
    <DeleteAuthority>false</DeleteAuthority>
    
    <EditAuthority>true</EditAuthority>
    
    <ExecuteAuthority>true</ExecuteAuthority>
    
    <CreateAuthority>false</CreateAuthority>
    
    </ATSpecialistParameters>
    
    
    -<ATSpecialistParameters>
    
    <ATSpecialistID>E9</ATSpecialistID>

    Friday, September 21, 2018 3:43 PM

Answers

  • Maybe you should write: ‘reader = New XmlSerializer(GetType(ATSpecialist_Records))’?


    • Marked as answer by BGatesFAA Friday, September 21, 2018 4:19 PM
    Friday, September 21, 2018 4:11 PM

All replies