Excel ListObject XPath error "...syntax is not correct or is not supported by Excel"

  • Thread starter Thread starter jacqueharper
  • Start date Start date
J

jacqueharper

I am having a problem with an Excel ListObject in my C# .NET
application. I am trying to map an XML schema to a ListObject, and
continue to get the error "The XPath is not valid because either the
XPath syntax is incorrect or not supported by Excel." No matter what
crazy things I try, I can not either get it to work, or get a
different, more interesting error message. :-)

I have created my ListObject, and added a schema to my XmlMaps.

The xml which is created by the schema looks something like
--------------------------
<Document xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="H:\CurrentProjects\RPM\WuPM\Untitled4.xsd">
<Row Time="2001-12-17T09:30:47-05:00">
<Id.c72103dc-fba1-4743-a58e-ac53a6181058 Days_On_Stream="3.14159"/>
<Id.bc6c92f0-cc6f-43ea-9d9a-ce94072e4348
Reactor_1_Inlet_Temperature="3.14159"/>
....
</Row>
</Document>
--------------------------
Then I have a statement resembling
ListObject.ListColumns[n].XPath.SetValue(myXmlMap, xpath_string,
null, true)
It seems that no matter what I pass as xpath_string, it is rejected.
I've tried
/Document/Row/Id.c72103dc-fba1-4743-a58e-ac53a6181058
//Id.c72103dc-fba1-4743-a58e-ac53a6181058
/Document//Id.c72103dc-fba1-4743-a58e-ac53a6181058
/Document//@Days_On_Stream
/Document/Row/Id.c72103dc-fba1-4743-a58e-ac53a6181058/@Days_On_Stream
//*@Days_On_Stream
and what feels like an endless combination of others. The only success
I've had is with the Time attribute, where this path
/Document/Row/@time
works.

I'm not having a lot of luck finding resources on the web that help me
identify what I'm doing wrong. Anybody have any advice?!

Thanks
Jacque
 
Back
Top