Ciao,
eccoti un esempio:
Dim xmldoc As New XmlDocument()
' galleries
Dim xmlGalleriesElement As XmlElement = xmldoc.CreateElement("galleries")
xmlGalleriesElement.SetAttribute("filename", "gallery1")
xmlGalleriesElement.SetAttribute("thumbnail", "Living 1_small.jpg")
xmlGalleriesElement.SetAttribute("description", "Living1")
xmlGalleriesElement.SetAttribute("numphoto", "6")
' photos
' creazione
Dim xmlPhotoElement As XmlElement = xmldoc.CreateElement("photo")
xmlPhotoElement.SetAttribute("filename", "photo1")
xmlPhotoElement.SetAttribute("thumbnail", "laptop.jpg")
xmlPhotoElement.SetAttribute("description", "Laptop")
' aggiunta
xmlGalleriesElement.AppendChild(xmlPhotoElement)
' creazione
xmlPhotoElement = Nothing
xmlPhotoElement = xmldoc.CreateElement("photo")
xmlPhotoElement.SetAttribute("filename", "photo2")
xmlPhotoElement.SetAttribute("thumbnail", "router.jpg")
xmlPhotoElement.SetAttribute("description", "Router")
' aggiunta
xmlGalleriesElement.AppendChild(xmlPhotoElement)
' creazione
xmlPhotoElement = Nothing
xmlPhotoElement = xmldoc.CreateElement("photo")
xmlPhotoElement.SetAttribute("filename", "photo3")
xmlPhotoElement.SetAttribute("thumbnail", "screen.jpg")
xmlPhotoElement.SetAttribute("description", "Screen")
' aggiunta
xmlGalleriesElement.AppendChild(xmlPhotoElement)
' ...
' aggiunta a nodo principale
xmldoc.AppendChild(xmlGalleriesElement)
xmldoc.Save("C:\a.xml")
--
Alessandro Alpi | SQL Server MVP
MCP|MCITP|MCTS|MCT
http://www.alessandroalpi.net
http://blogs.dotnethell.it/suxstellino
http://mvp.support.microsoft.com/profile/Alessandro.Alpi