ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Programmatic schema mapping, XPath.SetValue question (https://www.excelbanter.com/excel-programming/331602-programmatic-schema-mapping-xpath-setvalue-question.html)

Mike

Programmatic schema mapping, XPath.SetValue question
 
Hi! I need to programmatically map an element in my Excel 2003 xml schema to
my spreadsheet. For example, I have the following element in my schema:

<xsd:element name="TemplateE66" type="xsd:double" minOccurs="0"
nillable="true" form="qualified"/


I need to map it to Cell E66 in my worksheet (also named "Template"). I've
been playing with XPath.SetValue
method but can not figure out the correct way to call it in neither VB nor
C#.
Specifically, I can not get the XPath parameter to SetValue right.

Any idea/sample/url is greatly appreciated.

Thank you in advance,

--Michael


roblo

Programmatic schema mapping, XPath.SetValue question
 

I'm having similar problems, and different ones, but this has worked for
me.

First add the XML datamap .XSD
set objMap = workbook.XmlMaps.Add(AbsolutePath &
"\BOBBY.xsd","PowerShift")

then map the cells individually.
strXPath = "/PowerShift/C1A/Customer_number"
Set xp = worksheet.Range("A1:A2").Offset(1,actColumn).XPath
xp.SetValue workbook.XmlMaps(1), strXPath


The problem with with approach is that it separates the column in such
a way that if you change the data you can not export it back to an XML
file. Your get an error when selecting "Verify map for export".
Error stating. "A mapped element's relationship with other elements
cannot be preserved.

How do I fix this problem?


--
roblo
------------------------------------------------------------------------
roblo's Profile: http://www.excelforum.com/member.php...o&userid=22469
View this thread: http://www.excelforum.com/showthread...hreadid=378595


roblo[_3_]

Programmatic schema mapping, XPath.SetValue question
 

Also, try this link:

http://msdn.microsoft.com/library/de...ML_Toolbox.asp

Using the Excel 2003 Object Model to Add XML Data Integration


--
roblo
------------------------------------------------------------------------
roblo's Profile: http://www.excelforum.com/member.php...o&userid=22469
View this thread: http://www.excelforum.com/showthread...hreadid=378595



All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com