Namespace Declaration

Discussion in 'ASP .Net Web Services' started by Dave T, Aug 20, 2007.

  1. Dave T

    Dave T Guest

    I have a typed dataset that I'm returning from a webservice which has the
    xmlns="SomeURI" attribute defined

    My CLASSIC ASP front end developer can't get her xsl to work with that
    namespace declaration so I'm trying to get rid of it. The closest I can get
    is xmlns="" and I can do that a hundered different ways.

    Does anyone know how to get rid of it all together?

    =======================

    if it helps, here are the various things I've tried

    Private Function GetXMLFromDataset() As System.Xml.XmlDocument
    Dim _xml As New System.Xml.XmlDocument
    _xml.LoadXml(_DALSearchData.GetXml)

    '_xml.DocumentElement.Attributes.RemoveNamedItem("xmlns")

    '_xml.DocumentElement.RemoveAttribute("xmlns")

    '_xml.Attributes.RemoveNamedItem("xmlns")

    'Dim _XMLAttributes As System.Xml.XmlAttributeCollection
    '_XMLAttributes = _xml.XmlAttributeCollection
    '_XMLAttributes.RemoveNamedItem("xmlns")

    'Dim _DocElement As System.Xml.XmlElement = _xml.DocumentElement
    'Dim _Attributes As System.Xml.XmlAttributeCollection =
    _DocElement.Attributes
    '_Attributes(0).RemoveAll()

    'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    ' _xml.DocumentElement.Attributes.ItemOf(0).RemoveAll()
    'End If

    'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    ' _xml.DocumentElement.SetAttribute("xmlns", Nothing)
    'End If

    Return _xml
    End Function
    Dave T, Aug 20, 2007
    #1
    1. Advertising

  2. Dave T

    Adrian Moore Guest

    Hi

    Have you considered this...

    Dim XmlWithoutNS as String =
    _DALSearchData.GetXml.Replace("xmlns=""""",String.Empty)

    Hope this helps
    Ad.

    "Dave T" <> wrote in message
    news:...
    >I have a typed dataset that I'm returning from a webservice which has the
    > xmlns="SomeURI" attribute defined
    >
    > My CLASSIC ASP front end developer can't get her xsl to work with that
    > namespace declaration so I'm trying to get rid of it. The closest I can
    > get
    > is xmlns="" and I can do that a hundered different ways.
    >
    > Does anyone know how to get rid of it all together?
    >
    > =======================
    >
    > if it helps, here are the various things I've tried
    >
    > Private Function GetXMLFromDataset() As System.Xml.XmlDocument
    > Dim _xml As New System.Xml.XmlDocument
    > _xml.LoadXml(_DALSearchData.GetXml)
    >
    > '_xml.DocumentElement.Attributes.RemoveNamedItem("xmlns")
    >
    > '_xml.DocumentElement.RemoveAttribute("xmlns")
    >
    > '_xml.Attributes.RemoveNamedItem("xmlns")
    >
    > 'Dim _XMLAttributes As System.Xml.XmlAttributeCollection
    > '_XMLAttributes = _xml.XmlAttributeCollection
    > '_XMLAttributes.RemoveNamedItem("xmlns")
    >
    > 'Dim _DocElement As System.Xml.XmlElement = _xml.DocumentElement
    > 'Dim _Attributes As System.Xml.XmlAttributeCollection =
    > _DocElement.Attributes
    > '_Attributes(0).RemoveAll()
    >
    > 'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    > ' _xml.DocumentElement.Attributes.ItemOf(0).RemoveAll()
    > 'End If
    >
    > 'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    > ' _xml.DocumentElement.SetAttribute("xmlns", Nothing)
    > 'End If
    >
    > Return _xml
    > End Function
    >
    >
    Adrian Moore, Aug 21, 2007
    #2
    1. Advertising

  3. Dave T

    Dave T Guest

    That does it. I sure am curious though why I couldn't get it done with my
    other calls. Thanks

    "Adrian Moore" wrote:

    > Hi
    >
    > Have you considered this...
    >
    > Dim XmlWithoutNS as String =
    > _DALSearchData.GetXml.Replace("xmlns=""""",String.Empty)
    >
    > Hope this helps
    > Ad.
    >
    > "Dave T" <> wrote in message
    > news:...
    > >I have a typed dataset that I'm returning from a webservice which has the
    > > xmlns="SomeURI" attribute defined
    > >
    > > My CLASSIC ASP front end developer can't get her xsl to work with that
    > > namespace declaration so I'm trying to get rid of it. The closest I can
    > > get
    > > is xmlns="" and I can do that a hundered different ways.
    > >
    > > Does anyone know how to get rid of it all together?
    > >
    > > =======================
    > >
    > > if it helps, here are the various things I've tried
    > >
    > > Private Function GetXMLFromDataset() As System.Xml.XmlDocument
    > > Dim _xml As New System.Xml.XmlDocument
    > > _xml.LoadXml(_DALSearchData.GetXml)
    > >
    > > '_xml.DocumentElement.Attributes.RemoveNamedItem("xmlns")
    > >
    > > '_xml.DocumentElement.RemoveAttribute("xmlns")
    > >
    > > '_xml.Attributes.RemoveNamedItem("xmlns")
    > >
    > > 'Dim _XMLAttributes As System.Xml.XmlAttributeCollection
    > > '_XMLAttributes = _xml.XmlAttributeCollection
    > > '_XMLAttributes.RemoveNamedItem("xmlns")
    > >
    > > 'Dim _DocElement As System.Xml.XmlElement = _xml.DocumentElement
    > > 'Dim _Attributes As System.Xml.XmlAttributeCollection =
    > > _DocElement.Attributes
    > > '_Attributes(0).RemoveAll()
    > >
    > > 'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    > > ' _xml.DocumentElement.Attributes.ItemOf(0).RemoveAll()
    > > 'End If
    > >
    > > 'If _xml.DocumentElement.NamespaceURI.Length > 0 Then
    > > ' _xml.DocumentElement.SetAttribute("xmlns", Nothing)
    > > 'End If
    > >
    > > Return _xml
    > > End Function
    > >
    > >

    >
    >
    >
    Dave T, Aug 21, 2007
    #3
  4. Dave T

    Adrian Moore Guest

    Dave,

    Sometimes the simplest approach works best.

    Ad.

    > That does it. I sure am curious though why I couldn't get it done with my
    > other calls. Thanks
    Adrian Moore, Aug 23, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Noah
    Replies:
    5
    Views:
    947
  2. Alex Vinokur
    Replies:
    4
    Views:
    573
    Jonathan Turkanis
    Apr 5, 2004
  3. Ovidesvideo
    Replies:
    4
    Views:
    482
    Andrey Tarasevich
    Dec 10, 2004
  4. kelvSYC
    Replies:
    6
    Views:
    7,213
    Richard Herring
    May 17, 2005
  5. Replies:
    4
    Views:
    1,051
    Richard Tobin
    Dec 12, 2006
Loading...

Share This Page