+ Reply to Thread
Results 1 to 3 of 3

Programmatic schema mapping, XPath.SetValue question

  1. #1
    Mike
    Guest

    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


  2. #2
    Registered User
    Join Date
    04-20-2005
    Posts
    12
    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?

  3. #3
    Registered User
    Join Date
    04-20-2005
    Posts
    12
    Also, try this link:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_xl2003_ta/html/Office_Excel_XML_Toolbox.asp

    Using the Excel 2003 Object Model to Add XML Data Integration

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1