XMLFile1.xml:spa
XDocument Contacts = XDocument.Load("XMLFile1.xml");
//XElement Contacts = XElement.Parse(xmldata);
var Elist = from t in Contacts.Descendants("HEADER")
select new
{
CREATION_DATE = t.Element("CREATION_DATE").Value.Replace("\n", ""),
ITEM_NUMBER = t.Element("ITEM_NUMBER").Value.Replace("\n", ""),
ITEM_DESC = t.Element("ITEM_DESC").Value.Replace("\n", ""),
ITEM_CATEGORY_CODE = t.Element("ITEM_CATEGORY_CODE").Value.Replace("\n", ""),
PRIMARY_UOM_CODE = t.Element("PRIMARY_UOM_CODE").Value.Replace("\n", "") //注意此處用到 attribute
};xml
XDocument Contacts =XDocument.Load("XMLFile1.xml");ast
//XElement Contacts = XElement.Parse(xmldata);class
var Elist =from t in Contacts.Descendants("HEADER")select
selectnewdi
{ant
CREATION_DATE = t.Element("CREATION_DATE").Value.Replace("\n", ""),co
ITEM_NUMBER = t.Element("ITEM_NUMBER").Value.Replace("\n", ""),background
ITEM_DESC = t.Element("ITEM_DESC").Value.Replace("\n", ""),data
ITEM_CATEGORY_CODE = t.Element("ITEM_CATEGORY_CODE").Value.Replace("\n", ""),
PRIMARY_UOM_CODE = t.Element("PRIMARY_UOM_CODE").Value.Replace("\n", "") //注意此處用到 attribute
};