Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. VB.NET | XML Namespace parsing issues

VB.NET | XML Namespace parsing issues

Scheduled Pinned Locked Moved XML / XSL
xmlcsharpasp-netcom
7 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cdnhype
    wrote on last edited by
    #1

    Hello, This is my first delve into XML namespaces and I'm having a VERY difficult time parsing the XML because of the Namespace. If I remove the namespace then I get no problems. It would really be appreciated if anybody out there can cure my headache! Here is my code: Dim xmlDoc As New System.Xml.XmlDocument() Dim resolver as XmlUrlResolver = new XmlUrlResolver() Dim datasource as XmlDataSource = new XmlDataSource() resolver.Credentials = New NetworkCredential("username", "password") xmlDoc.XmlResolver = resolver xmlDoc.Load("http://somedomain.com/webservicename") Dim xsn as XmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable) xsn.AddNamespace("t", "urn:ahw:itemlist") xmlData.Document = xmlDoc xmlData.TransformSource = "test.xsl" Here is the XML: Here is the xsl:

    Display Name

    Name

    Here is my asp.net page (the main part where I want the XML to display):

    Thanks so much for your time! Chris

    D S C 3 Replies Last reply
    0
    • C cdnhype

      Hello, This is my first delve into XML namespaces and I'm having a VERY difficult time parsing the XML because of the Namespace. If I remove the namespace then I get no problems. It would really be appreciated if anybody out there can cure my headache! Here is my code: Dim xmlDoc As New System.Xml.XmlDocument() Dim resolver as XmlUrlResolver = new XmlUrlResolver() Dim datasource as XmlDataSource = new XmlDataSource() resolver.Credentials = New NetworkCredential("username", "password") xmlDoc.XmlResolver = resolver xmlDoc.Load("http://somedomain.com/webservicename") Dim xsn as XmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable) xsn.AddNamespace("t", "urn:ahw:itemlist") xmlData.Document = xmlDoc xmlData.TransformSource = "test.xsl" Here is the XML: Here is the xsl:

      Display Name

      Name

      Here is my asp.net page (the main part where I want the XML to display):

      Thanks so much for your time! Chris

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      Well, first I gotta ask if there's a typo in your input XML. The end tag for the document element doesn't match. The next thing I'd like to know is what is the error you're getting? Do you get the error when you load the document, when you put it in the data document, or when you run the transform?

      C 1 Reply Last reply
      0
      • D Dustin Metzgar

        Well, first I gotta ask if there's a typo in your input XML. The end tag for the document element doesn't match. The next thing I'd like to know is what is the error you're getting? Do you get the error when you load the document, when you put it in the data document, or when you run the transform?

        C Offline
        C Offline
        cdnhype
        wrote on last edited by
        #3

        Sorry. Here is the correct XML: I'm not getting an error. Its just nothing appears on page.

        1 Reply Last reply
        0
        • C cdnhype

          Hello, This is my first delve into XML namespaces and I'm having a VERY difficult time parsing the XML because of the Namespace. If I remove the namespace then I get no problems. It would really be appreciated if anybody out there can cure my headache! Here is my code: Dim xmlDoc As New System.Xml.XmlDocument() Dim resolver as XmlUrlResolver = new XmlUrlResolver() Dim datasource as XmlDataSource = new XmlDataSource() resolver.Credentials = New NetworkCredential("username", "password") xmlDoc.XmlResolver = resolver xmlDoc.Load("http://somedomain.com/webservicename") Dim xsn as XmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable) xsn.AddNamespace("t", "urn:ahw:itemlist") xmlData.Document = xmlDoc xmlData.TransformSource = "test.xsl" Here is the XML: Here is the xsl:

          Display Name

          Name

          Here is my asp.net page (the main part where I want the XML to display):

          Thanks so much for your time! Chris

          S Offline
          S Offline
          Stefan Troschuetz
          wrote on last edited by
          #4

          Try putting two slashes before itemlist: <xsl:template match="//itemlist">


          "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

          www.troschuetz.de

          C 1 Reply Last reply
          0
          • S Stefan Troschuetz

            Try putting two slashes before itemlist: <xsl:template match="//itemlist">


            "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

            www.troschuetz.de

            C Offline
            C Offline
            cdnhype
            wrote on last edited by
            #5

            sorry but that had no impact. Thanks for the quick replies!

            1 Reply Last reply
            0
            • C cdnhype

              Hello, This is my first delve into XML namespaces and I'm having a VERY difficult time parsing the XML because of the Namespace. If I remove the namespace then I get no problems. It would really be appreciated if anybody out there can cure my headache! Here is my code: Dim xmlDoc As New System.Xml.XmlDocument() Dim resolver as XmlUrlResolver = new XmlUrlResolver() Dim datasource as XmlDataSource = new XmlDataSource() resolver.Credentials = New NetworkCredential("username", "password") xmlDoc.XmlResolver = resolver xmlDoc.Load("http://somedomain.com/webservicename") Dim xsn as XmlNamespaceManager = new XmlNamespaceManager(xmlDoc.NameTable) xsn.AddNamespace("t", "urn:ahw:itemlist") xmlData.Document = xmlDoc xmlData.TransformSource = "test.xsl" Here is the XML: Here is the xsl:

              Display Name

              Name

              Here is my asp.net page (the main part where I want the XML to display):

              Thanks so much for your time! Chris

              C Offline
              C Offline
              cdnhype
              wrote on last edited by
              #6

              I got it working now!!! Heres is what I needed to change in the XSL:

              Display Name

              Name

              S 1 Reply Last reply
              0
              • C cdnhype

                I got it working now!!! Heres is what I needed to change in the XSL:

                Display Name

                Name

                S Offline
                S Offline
                Stefan Troschuetz
                wrote on last edited by
                #7

                Ah the namespace. Of course. Should have seen that :sigh:


                "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

                www.troschuetz.de

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups