Results 1 to 2 of 2

Thread: XML parsing

  1. #1
    Wayne King Guest

    XML parsing

    I am trying to process an XML document that contains the attribute 'from_x'. However an openxml query can't seem to find any column with a '_x' suffix. For example if I were to execute the following fragment:

    declare @hDoc int, @Message varchar(200)
    select @Message = &#39;<BACK_FM from_x=&#34;12&#34;></BACK_FM>&#39;
    exec sp_xml_preparedocument @hDoc OUTPUT, @Message
    select from_x from openxml(@hDoc, &#39;BACK_FM&#39;,1) with (from_x int)

    I get back a null value from the openxml query. Attribute names &#39;fromx&#39; and &#39;from_y&#39; work ok but nothing I have tried with a trailing &#39;_x&#39; will work.

    Does anyone know if this is a known SQL Server bug? Is it a bug at all or something about XML that I don&#39;t know about?

    Thanks,
    Wayne King



  2. #2
    Join Date
    Nov 2009
    Posts
    1
    declare @hDoc int, @Message varchar(200)
    select @Message = '<BACK_FM from_x="12"></BACK_FM>'
    exec sp_xml_preparedocument @hDoc OUTPUT, @Message
    select from_x from openxml(@hDoc, 'BACK_FM',1) with (from_x int '@from_x')

Posting Permissions

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