views:

379

answers:

1

I'm getting the error:

Illegal characters in path.

when trying to load XML, using XPath, into a gridview's datasource in the PageLoad function in the code-behind of an ASP.NET page I'm building. Does anyone know what this error means?

The XML coming in from the Sharepoint Web Services call is:

<?xml version='1.0' encoding='ISO-8859-1'?>
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns="http://schemas.microsoft.com/sharepoint/soap/"&gt; 
<rs:data ItemCount="2"> 
 <z:row ows_Attachments="0" ows_LinkTitle="testTitle" ows_IncidentID="0" .../> 
 <z:row ows_Attachments="0" ows_LinkTitle="test2" ows_IncidentID="1" ... /> 
</rs:data>

And my code behind is:

newNode = thisL.GetListItems(strID, viewName, query, viewFields, rowLimit, queryOptions, webID)

    mNodeList = newNode.ChildNodes
    Dim ds_me As New Data.DataSet

    xdsIncidents.Data = "<?xml version='1.0' encoding='utf-8'?>" & newNode.OuterXml
    xdsIncidents.XPath = "//z:row"
    GridView1.AutoGenerateColumns = True
    DataDiv.InnerText = xdsIncidents.Data

    ds_me.ReadXml(xdsIncidents.Data)
    Dim dv As New Data.DataView(ds_me.Tables(1))

    GridView1.DataSource = dv
    GridView1.DataBind()

The error message is coming up on the line "ds_me.ReadXML..."

A: 

This is because that overload of ReadXml is expecting a file path to read some xml from, not a string with xml in it.

You'll need to create an XmlReader or TextReader from your string if you want to load the DataSet in this way.

Martin Peck