I
ink
Hi all,
Is this possable, and how if so?
i have created 3 classes that i have then Serialized to xml and placed in a
textbox. i can then read the text from the textbox and Deserialize it back
into a new object. this to me proves that the classes and the xml are valid.
But when i take that same xml and past it into the App.Config file and use
the
Configuration.GetSection("ImportFormat").SectionInformation.GetRawXml(); to
read it from the config file and then Deserialize it i get the following
error.
- ex {"There is an error in XML document (0, 0)."} System.Exception
{System.InvalidOperationException}
- InnerException {"The type initializer for
'System.Xml.Serialization.XmlSerializationReader' threw an exception."}
System.Exception {System.TypeInitializationException}
- InnerException {"Configuration system failed to initialize"}
System.Exception {System.Configuration.ConfigurationErrorsException}
+ InnerException {"Unrecognized configuration section ImportFormat.
(C:\\Learn\\Csharp\\Desk\\AppConfigTest\\AppConfigTest\\AppConfigTest\\bin\\Debug\\AppConfigTest.vshost.exe.config
line 4)"} System.Exception
{System.Configuration.ConfigurationErrorsException}
Is what i am trying to do not possable?
i have pasted app.config below.
thanks,
ink
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<ImportFormat>
<ImportRecord TableName="GoodsExpected" RowIdentifier="H"
IndexOfInsertion="0" NoOfRowsPerRecord="5">
<FieldData ColumnName="STORAGE PROVIDER" FieldName="CompanyID"
ColumnIndex="1" RowIndex="0" Required="true" />
<FieldData ColumnName="WAREHOUSE" FieldName="WarehouseID" ColumnIndex="2"
RowIndex="1" Required="true" />
<FieldData ColumnName="ASN REFERENCE" FieldName="ReferenceID"
ColumnIndex="2" RowIndex="2" Required="true" />
<FieldData ColumnName="EXPECTED DATE" FieldName="ExpectedDate"
ColumnIndex="2" RowIndex="3" Required="true" />
<FieldData ColumnName="CUSTOMERID" FieldName="SupplierID" ColumnIndex="2"
RowIndex="4" Required="true" />
</ImportRecord>
<ImportRecord TableName="GoodsReceivedBatch" RowIdentifier="D"
IndexOfInsertion="1" NoOfRowsPerRecord="1" HeaderRowIdentifier="H">
<FieldData ColumnName="PALLET ID" FieldName="PalletID" ColumnIndex="1"
RowIndex="0" Required="false" />
<FieldData ColumnName="ITEM CODE" FieldName="ItemID" ColumnIndex="2"
RowIndex="0" Required="true" />
<FieldData ColumnName="QTY" FieldName="Qty" ColumnIndex="3" RowIndex="0"
Required="true" />
<FieldData ColumnName="ITEM DESCRIPTION" FieldName="Description"
ColumnIndex="4" RowIndex="0" Required="false" />
</ImportRecord>
</ImportFormat>
</configuration>
Is this possable, and how if so?
i have created 3 classes that i have then Serialized to xml and placed in a
textbox. i can then read the text from the textbox and Deserialize it back
into a new object. this to me proves that the classes and the xml are valid.
But when i take that same xml and past it into the App.Config file and use
the
Configuration.GetSection("ImportFormat").SectionInformation.GetRawXml(); to
read it from the config file and then Deserialize it i get the following
error.
- ex {"There is an error in XML document (0, 0)."} System.Exception
{System.InvalidOperationException}
- InnerException {"The type initializer for
'System.Xml.Serialization.XmlSerializationReader' threw an exception."}
System.Exception {System.TypeInitializationException}
- InnerException {"Configuration system failed to initialize"}
System.Exception {System.Configuration.ConfigurationErrorsException}
+ InnerException {"Unrecognized configuration section ImportFormat.
(C:\\Learn\\Csharp\\Desk\\AppConfigTest\\AppConfigTest\\AppConfigTest\\bin\\Debug\\AppConfigTest.vshost.exe.config
line 4)"} System.Exception
{System.Configuration.ConfigurationErrorsException}
Is what i am trying to do not possable?
i have pasted app.config below.
thanks,
ink
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<ImportFormat>
<ImportRecord TableName="GoodsExpected" RowIdentifier="H"
IndexOfInsertion="0" NoOfRowsPerRecord="5">
<FieldData ColumnName="STORAGE PROVIDER" FieldName="CompanyID"
ColumnIndex="1" RowIndex="0" Required="true" />
<FieldData ColumnName="WAREHOUSE" FieldName="WarehouseID" ColumnIndex="2"
RowIndex="1" Required="true" />
<FieldData ColumnName="ASN REFERENCE" FieldName="ReferenceID"
ColumnIndex="2" RowIndex="2" Required="true" />
<FieldData ColumnName="EXPECTED DATE" FieldName="ExpectedDate"
ColumnIndex="2" RowIndex="3" Required="true" />
<FieldData ColumnName="CUSTOMERID" FieldName="SupplierID" ColumnIndex="2"
RowIndex="4" Required="true" />
</ImportRecord>
<ImportRecord TableName="GoodsReceivedBatch" RowIdentifier="D"
IndexOfInsertion="1" NoOfRowsPerRecord="1" HeaderRowIdentifier="H">
<FieldData ColumnName="PALLET ID" FieldName="PalletID" ColumnIndex="1"
RowIndex="0" Required="false" />
<FieldData ColumnName="ITEM CODE" FieldName="ItemID" ColumnIndex="2"
RowIndex="0" Required="true" />
<FieldData ColumnName="QTY" FieldName="Qty" ColumnIndex="3" RowIndex="0"
Required="true" />
<FieldData ColumnName="ITEM DESCRIPTION" FieldName="Description"
ColumnIndex="4" RowIndex="0" Required="false" />
</ImportRecord>
</ImportFormat>
</configuration>