Declaring Multiple Name Spaces In SQL/XML Query

  • Using SQL 2008

    Sample Date:

    <Listing xmlns="http://xx.org/2008-03">

    <Address>

    <commons:preference-order xmlns:commons="http://xx.org/2007-08">1</commons:preference-order>

    <commons:address-preference-order xmlns:commons="http://xx.org/2007-08">1</commons:address-preference-order>

    </Address>

    </Listing>

    -- currently declaring the default name space

    ; with xmlnamespaces (default 'http://rets.org/xsd/Syndication/2008-03')

    Question is, how do I also declare the name space in the <Address> node?

    Thanks for your help.

    GA

  • gadamson (3/11/2011)


    Using SQL 2008

    Sample Date:

    <Listing xmlns="http://xx.org/2008-03">

    <Address>

    <commons:preference-order xmlns:commons="http://xx.org/2007-08">1</commons:preference-order>

    <commons:address-preference-order xmlns:commons="http://xx.org/2007-08">1</commons:address-preference-order>

    </Address>

    </Listing>

    -- currently declaring the default name space

    ; with xmlnamespaces (default 'http://rets.org/xsd/Syndication/2008-03')

    Question is, how do I also declare the name space in the <Address> node?

    Thanks for your help.

    GA

    First, the <Address> node is in the default namespace (http://xx.org/2008-03) since the element tag does not have a prefix.

    ; with xmlnamespaces (default 'http://rets.org/xsd/Syndication/2008-03',

    'http://xx.org/2007-08' as commons

    )

    http://msdn.microsoft.com/en-us/library/ms177400.aspx discusses using the "with xmlnamespaces" statement.

    Russel Loski, MCSE Business Intelligence, Data Platform

  • Russel - thanks again for the invaluable information and also for the link to further research. Very much appreciated. GA

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply