Just to follow up, here is an example of how you can accomplish what you want to do. Again, there might very well be a simple ArcObjects solution here --- howver most of my GIS apps are really data-centric and I do a lot of work implementing ADO.NET stuff into my GIS applications. So that is the way I am going to create any .xml conversion process.First, you should go to the ArcScripts and save a copy of one of my uploads I did there. This is a slick little toolset that converts your IFeatureLayer to an ADO.NET DataTable and can be used for a wide variety of scenarios. I particularly like to use this functionality to display data in DataGridViews and the like.http://resources.arcgis.com/gallery/file/arcobjects-net-api/details?entryID=675318D8-1422-2418-8814-...But, I've pasted the relevent Function below that you'll need out of that script.Private Function ConvertToADONETDataTableFromLayer(ByVal inLayer As IFeatureLayer) As DataTable
Dim tmpDT As New DataTable("tmpDT")
Dim column As DataColumn
Dim pTable As ITable = inLayer.FeatureClass
Dim pFields As IFields = pTable.Fields
Dim pCur As ICursor = pTable.Search(Nothing, False)
For c = 0 To pCur.Fields.FieldCount - 1
column = New DataColumn()
column.ColumnName = (pFields.Field(c).Name)
If pFields.Field(c).Type = esriFieldType.esriFieldTypeString Then
column.DataType = System.Type.GetType("System.String")
ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeInteger Then
column.DataType = System.Type.GetType("System.Int32")
ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDouble Then
column.DataType = System.Type.GetType("System.Double")
ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeDate Then
column.DataType = System.Type.GetType("System.DateTime")
ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeSingle Then
column.DataType = System.Type.GetType("System.Single")
ElseIf pFields.Field(c).Type = esriFieldType.esriFieldTypeBlob Then
column.DataType = System.Type.GetType("System.Byte")
End If
column.ReadOnly = False
tmpDT.Columns.Add(column)
Next
Dim pRow As IRow = pCur.NextRow
Dim newRow As DataRow
Do Until pRow Is Nothing
newRow = tmpDT.NewRow()
newRow.BeginEdit()
For cols = 0 To pCur.Fields.FieldCount - 1
newRow(cols) = pRow.Value(pRow.Fields.FindField(pFields.Field(cols).Name))
Next
newRow.EndEdit()
tmpDT.Rows.Add(newRow)
tmpDT.AcceptChanges()
pRow = pCur.NextRow
Loop
Return tmpDT
End Function
Then use this to build the .xml file:
Dim pDoc As IMxDocument
Dim pMap As IMap
pDoc = m_pApp.Document
pMap = pDoc.FocusMap
Dim pLayer as IFeatureLayer = pMap.Layer(0) 'just get the first layer for simplicity/example
'Create the ADO.NET DataTable
Dim adoDataTable As DataTable = ConvertToADONETDataTableFromLayer(pLayer)
'Setup the ADO.NET Dataset and add the newly created DataTable
Dim ds As New DataSet()
ds.DataSetName = "dsToConvertToXML"
ds.Tables.Add(adoDataTable)
'Now write the DataTable's schema to an .xml file
'remember, this is *really* the schema of the IFeatureLayer because we converted it to an
'ADO.NET DataTable!
Dim filename As String = ds.DataSetName.ToString & ".xml"
ds.WriteXmlSchema(filename)
So from the test that I ran, this adds the .xml file to the directory where your VS.NET project folder is located. There are probably ways to manipulate exactly where to place this .xml file, but you'll have to look into that.Good luck and let me know if this helps!Here's the sample schema that I build from a point layer I had run this on:[HTML]<?xml version="1.0" standalone="yes"?><xs:schema id="dsToConvertToXML" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="dsToConvertToXML" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="tmpDT"> <xs:complexType> <xs:sequence> <xs:element name="Shape" type="xs:string" minOccurs="0" /> <xs:element name="OBJECTID" type="xs:string" minOccurs="0" /> <xs:element name="zone" type="xs:string" minOccurs="0" /> <xs:element name="Location" type="xs:int" minOccurs="0" /> <xs:element name="timestart" type="xs:dateTime" minOccurs="0" /> <xs:element name="FlagType" type="xs:string" minOccurs="0" /> <xs:element name="Latitude" type="xs:double" minOccurs="0" /> <xs:element name="Longitude" type="xs:double" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element></xs:schema>[/HTML]