D
David Elliott
This is what I have produced so far...
<?xml version="1.0" encoding="utf-8"?>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Tables>
<Table>
<NameOfTable>Table</NameOfTable>
<Columns>
<Column Name="Col_1">New_Col_1</Column>
<Column Name="Col_2">New_Col_2</Column>
<Column Name="Col_3">New_Col_3</Column>
<Column Name="Col_4">New_Col_4</Column>
<Column Name="Col_5">New_Col_5</Column>
</Columns>
</Table>
</Tables>
</Database>
I want
<NameOfTable>Table</NameOfTable>
in the form of
<NameOfTable Name="Table">NewTableName</NameOfTable>
and am having difficultly doing so.
I can get the form that I am looking for with the Columns because it is
an ArrayList. The NameOfTable is not. It is just a single Element.
Here is the code that produced the results above. I am attempting to
add in the TableName class to solve this problem but am not having
any luck in getting it to print out. It never hits the getter.
Any help is appreciated.
Dave
[XmlInclude(typeof(TableName))]
public class DatabaseTable
{
private TableName tableName;
private string name;
private string className;
private ArrayList columns = new ArrayList();
[XmlElement]
public string NameOfTable
{
get { return (name); }
set { name = value.Trim(); }
}
[XmlArray(ElementName = "Columns")]
[XmlArrayItem(ElementName = "Column", Type = typeof(DatabaseTableColumn))]
public ArrayList Columns
{
get {return (columns); }
}
[XmlElement(Type = typeof(TableName))]
public TableName MyTableName
{
get {return (tableName); }
}
}
public class TableName
{
private string dbName;
private string newName;
public TableName()
{
}
[XmlAttribute]
public string Name
{
get { return (newName); }
set { newName = value.Trim(); }
}
[XmlText(Type=typeof(string))]
public string NameOfDbColumn
{
get { return (dbName); }
set { dbName = value.Trim(); }
}
}
<?xml version="1.0" encoding="utf-8"?>
<Database xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Tables>
<Table>
<NameOfTable>Table</NameOfTable>
<Columns>
<Column Name="Col_1">New_Col_1</Column>
<Column Name="Col_2">New_Col_2</Column>
<Column Name="Col_3">New_Col_3</Column>
<Column Name="Col_4">New_Col_4</Column>
<Column Name="Col_5">New_Col_5</Column>
</Columns>
</Table>
</Tables>
</Database>
I want
<NameOfTable>Table</NameOfTable>
in the form of
<NameOfTable Name="Table">NewTableName</NameOfTable>
and am having difficultly doing so.
I can get the form that I am looking for with the Columns because it is
an ArrayList. The NameOfTable is not. It is just a single Element.
Here is the code that produced the results above. I am attempting to
add in the TableName class to solve this problem but am not having
any luck in getting it to print out. It never hits the getter.
Any help is appreciated.
Dave
[XmlInclude(typeof(TableName))]
public class DatabaseTable
{
private TableName tableName;
private string name;
private string className;
private ArrayList columns = new ArrayList();
[XmlElement]
public string NameOfTable
{
get { return (name); }
set { name = value.Trim(); }
}
[XmlArray(ElementName = "Columns")]
[XmlArrayItem(ElementName = "Column", Type = typeof(DatabaseTableColumn))]
public ArrayList Columns
{
get {return (columns); }
}
[XmlElement(Type = typeof(TableName))]
public TableName MyTableName
{
get {return (tableName); }
}
}
public class TableName
{
private string dbName;
private string newName;
public TableName()
{
}
[XmlAttribute]
public string Name
{
get { return (newName); }
set { newName = value.Trim(); }
}
[XmlText(Type=typeof(string))]
public string NameOfDbColumn
{
get { return (dbName); }
set { dbName = value.Trim(); }
}
}