Results 1 to 2 of 2

Thread: How to get the Namespace string i.e. first element attribute value

  1. #1
    Addicted Member
    Join Date
    Nov 10
    Posts
    152

    How to get the Namespace string i.e. first element attribute value

    I have a namespace declaration/FirstElement like:

    <Code>.<FirstElementName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xmlns=urn:filename-schema" </Code>

    Which namespace is the attribute for this element? If I wanted to pick up only the last namespace I.e. (xmlns=urn:filename-schema"), how do I do that? I have tried:

    <Code>.

    Dim root As XmlNode = myDoc.FirstChild. 'First node
    Dim firstElement As XmlNode = root.FirstChild. 'First element

    Dim firstElementValue As string = firstElement.Value

    </Code>

    I get the exception: Object reference not set to an instance of an object. I have tried the: XmlAttribute and XmlNode, instances in place of 'String' with no success. Confused now. Please help. Thanks

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 12
    Posts
    5,465

    Re: How to get the Namespace string i.e. first element attribute value

    Confused now.
    Not the only one, I'm afraid! What are you actually trying to do?

Posting Permissions

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