vj#:
Hi
The following code of VJ# gives System.FormatException on creating a Build
//////////////////////////////////////
// <Snippet1
import System.*
import System.Collections.*
import System.Xml.*
import System.Xml.Serialization.*
import System.IO.*
import System.Xml.Schema.*
public class PurchaseOrde
/** @attribute XmlArrayItem(DataType = "gMonth", ElementName =
"MyMonths", Namespace = "http://www.cohowinery.com"
*
public String Months[]
/** @attribute XmlArrayItem(Item.class
@attribute XmlArrayItem(NewItem.class
*
public Item Items[]
/** @attribute XmlArray(IsNullable = true
*
/** @attribute XmlArrayItem(String.class
@attribute XmlArrayItem(double.class
@attribute XmlArrayItem(NewItem.class
*
public Object Things[]
} //PurchaseOrde
public class Ite
public String ItemID
public Item(
} //Ite
public Item(String id
ItemID = id
} //Ite
} //Ite
public class NewItem extends Ite
public String Category
public NewItem(
} //NewIte
public NewItem(String id, String cat
this.ItemID = id
Category = cat
} //NewIte
} //NewIte
public class Tes
public static void main(String[] args
// Read and write purchase orders
Test t = new Test()
t.SerializeObject("ArrayItemEx.xml")
t.DeserializeObject("ArrayItemEx.xml")
} //mai
private void SerializeObject(String filename
// Create an instance of the XmlSerializer class
// specify the type of object to serialize
XmlSerializer serializer = new XmlSerializer(PurchaseOrder.class
ToType())
TextWriter writer = new StreamWriter(filename)
// Create a PurchaseOrder and set its properties
PurchaseOrder po = new PurchaseOrder()
po.Months = new String[] { "March", "May", "August" }
po.Items = (new Item[] {new Item("a1"), new NewItem("b1", "book")})
po.Things = new Object[] { "String", 2003.31, new NewItem
"Item100", "book") }
// Serialize the purchase order, and close the TextWriter
serializer.Serialize(writer, po)
writer.Close()
} //SerializeObjec
protected void DeserializeObject(String filename
// Create an instance of the XmlSerializer class
// specify the type of object to be deserialized
XmlSerializer serializer = new XmlSerializer
PurchaseOrder.class.ToType())
// A FileStream is needed to read the XML document
FileStream fs = new FileStream(filename, FileMode.Open)
// Declare an object variable of the type to be deserialized
PurchaseOrder po
/* Use the Deserialize method to restore the object's state wit
data from the XML document.
*
po = (PurchaseOrder)serializer.Deserialize(fs)
for (int iCtr = 0; iCtr < po.Months.get_Length(); iCtr++)
String s = po.Months[iCtr]
Console.WriteLine(s)
for (int iCtr = 0; iCtr < po.Items.get_Length(); iCtr++)
Item i = po.Items[iCtr]
Console.WriteLine(i.ItemID)
for (int iCtr = 0; iCtr < po.Things.get_Length(); iCtr++)
Object thing = po.Things[iCtr]
Console.WriteLine(thing)
} //DeserializeObjec
} //Tes
// </Snippet1
/////////////////////////////////////////////////////
Please give me your kind suggestion