+ Reply to Thread
Results 1 to 2 of 2

Thread: XML Variable with unknown nodes

  1. #1
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    XML Variable with unknown nodes

    I'm passing the following XML to a stored routine on SQL Server 2005:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Item xmlns:xsi="http://www.w3.org/2005/xpath-functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <ProductID>...</ProductID>
        <Code>...</Code>
        <Name>...</Name>
        <Description>...</Description>
        <onHand>..</onHand>
        <UnitPrice>..</UnitPrice>
        <Keys>
            <col n="1">..</col>
        </Keys>
        <DataSourceID>..</DataSourceID>
    </Item> 
    The problem is that, except for the data in bold, I don't know the Elements being passed in. I need a way to query the XML and extract the Element names and have been banging my head against a wall for two days. SQL Server has limited support for XQuery functions and FWLOR.

    The above XML would be better passed as:
    Code:
    <Item>
      <Column ID="ProductID">...</Column>
      <Column ID="Code">...</Column>
    :
    </Item>
    
    But is the result of doing XMSerialization of a .NET object. I don't believe it is possible to add the ID attribute short of writing a customized Serialization routine (which I may be forced to do).

    I'm not an XML whiz yet, but I'm stumped. Is there way to extract the Elements from the <Item> node above (in SQL no less).
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  2. #2
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    hey w0lff w0lff...do any of the examples listed here do what you need?

    XML Examples

+ Reply to Thread

Similar Threads

  1. global variable
    By guddu in forum .NET Development
    Replies: 3
    Last Post: September 11th, 2009, 09:20 AM
  2. Email message: output buffer or variable
    By bryceowen in forum PHP Development
    Replies: 5
    Last Post: September 3rd, 2009, 03:54 PM
  3. How to insert variable html into php
    By evdv in forum PHP Development
    Replies: 1
    Last Post: January 14th, 2009, 08:54 PM
  4. Session variable not querying??
    By Centurion in forum ASP Development
    Replies: 7
    Last Post: December 3rd, 2008, 11:35 AM
  5. How to retrieve unknown recordset field names in table?
    By BLaaaaaaaaaarche in forum ASP Development
    Replies: 2
    Last Post: August 10th, 2008, 09:33 AM

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

SEO by vBSEO