How to use XmlNode() as result from webservice in VB.NET?












0














A webservice just returns XmlNode():



Dim nodes() As XmlNode = CType(result.handler, XmlNode())


First of all, how can this result be viewed as plain xml (in visual studio)?



And then, how to use this result and navigate / select concrete items from it?










share|improve this question


















  • 1




    1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
    – Pedro Gaspar
    Dec 28 '18 at 1:01










  • 1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
    – JKB
    Dec 28 '18 at 1:48












  • Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
    – jdweng
    Dec 28 '18 at 11:14


















0














A webservice just returns XmlNode():



Dim nodes() As XmlNode = CType(result.handler, XmlNode())


First of all, how can this result be viewed as plain xml (in visual studio)?



And then, how to use this result and navigate / select concrete items from it?










share|improve this question


















  • 1




    1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
    – Pedro Gaspar
    Dec 28 '18 at 1:01










  • 1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
    – JKB
    Dec 28 '18 at 1:48












  • Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
    – jdweng
    Dec 28 '18 at 11:14
















0












0








0







A webservice just returns XmlNode():



Dim nodes() As XmlNode = CType(result.handler, XmlNode())


First of all, how can this result be viewed as plain xml (in visual studio)?



And then, how to use this result and navigate / select concrete items from it?










share|improve this question













A webservice just returns XmlNode():



Dim nodes() As XmlNode = CType(result.handler, XmlNode())


First of all, how can this result be viewed as plain xml (in visual studio)?



And then, how to use this result and navigate / select concrete items from it?







xml vb.net xmlnode






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 28 '18 at 0:48









JKB

12010




12010








  • 1




    1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
    – Pedro Gaspar
    Dec 28 '18 at 1:01










  • 1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
    – JKB
    Dec 28 '18 at 1:48












  • Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
    – jdweng
    Dec 28 '18 at 11:14
















  • 1




    1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
    – Pedro Gaspar
    Dec 28 '18 at 1:01










  • 1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
    – JKB
    Dec 28 '18 at 1:48












  • Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
    – jdweng
    Dec 28 '18 at 11:14










1




1




1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
– Pedro Gaspar
Dec 28 '18 at 1:01




1. how can this result be viewed as plain xml (in visual studio)?: Do you mean like while debbuging? If you just stop the mouse pointer over the variable, you can view its contents! 2. how to use this result and navigate / select concrete items from it?: Do you have a class that represents the contents of this result? If so, you can deserialize the XmlNode into your object, that's the easiest way, I think, otherwise you can just use the Xml library to navigate through it. Please give more information about what you really want.
– Pedro Gaspar
Dec 28 '18 at 1:01












1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
– JKB
Dec 28 '18 at 1:48






1. I don't mean the debugger in this context. It drives me crazy when viewing the nested objects ;) I would like to view the the whole xml structure like a dom document. Looking for something like $nodesArray->toXmlString() 2. There is no target class at them moment. have to use Xml library, but what to use when not having an XmlDocument but only an XmlNodes()?
– JKB
Dec 28 '18 at 1:48














Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
– jdweng
Dec 28 '18 at 11:14






Since is is an array you have to convert one item in the array at a time. So I usually use something like this string xml = string.Join("n", nodes.Select(x => x.ToString()));
– jdweng
Dec 28 '18 at 11:14














1 Answer
1






active

oldest

votes


















0















First of all, how can this result be viewed as plain xml (in visual studio)?




You can use XmlNode.WriteTo(XmlWriter) method, using a XmlWriter object created for writing to a StringBuilder object (documentation), for example:



Imports System.Text
Imports System.Xml

'[...]
Public Function NodesToString(nodes() As XmlNode) As String

Dim sb As New StringBuilder()

Dim settings As New XmlWriterSettings()
settings.ConformanceLevel = ConformanceLevel.Fragment
settings.Indent = True

Dim writer = XmlWriter.Create(sb, settings)
For Each node In nodes
node.WriteTo(writer)
Next
writer.Close()

Return sb.ToString()

End Function


After that all the contents of your nodes should be on your StringBuilder object, and a simple sb.ToString() would show it all to you.




And then, how to use this result and navigate / select concrete items from it?




XmlNode is the base class for a lot of elements in the System.Xml library, even XmlDocument and XmlElement classes, so a lot of the XML "navigation capability" is there.



As stated by the documentation:




This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document. XmlNode is the base class in the .NET implementation of the DOM. It supports XPath selections and provides editing capabilities. The XmlDocument class extends XmlNode and represents an XML document. You can use XmlDocument to load and save XML data. It also includes methods for node creation. See XML Document Object Model (DOM) for more information.




You can use those properties or methods to navigate through your XML nodes, for example:





  • XmlNode.FirstChild property


  • XmlNode.NextSibling property


  • XmlNode.CreateNavigator() method


  • XmlNode.SelectNodes() method (using XPath expression)


  • XmlNode.SelectSingleNode() method (using XPath expression)






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952482%2fhow-to-use-xmlnode-as-result-from-webservice-in-vb-net%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    First of all, how can this result be viewed as plain xml (in visual studio)?




    You can use XmlNode.WriteTo(XmlWriter) method, using a XmlWriter object created for writing to a StringBuilder object (documentation), for example:



    Imports System.Text
    Imports System.Xml

    '[...]
    Public Function NodesToString(nodes() As XmlNode) As String

    Dim sb As New StringBuilder()

    Dim settings As New XmlWriterSettings()
    settings.ConformanceLevel = ConformanceLevel.Fragment
    settings.Indent = True

    Dim writer = XmlWriter.Create(sb, settings)
    For Each node In nodes
    node.WriteTo(writer)
    Next
    writer.Close()

    Return sb.ToString()

    End Function


    After that all the contents of your nodes should be on your StringBuilder object, and a simple sb.ToString() would show it all to you.




    And then, how to use this result and navigate / select concrete items from it?




    XmlNode is the base class for a lot of elements in the System.Xml library, even XmlDocument and XmlElement classes, so a lot of the XML "navigation capability" is there.



    As stated by the documentation:




    This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document. XmlNode is the base class in the .NET implementation of the DOM. It supports XPath selections and provides editing capabilities. The XmlDocument class extends XmlNode and represents an XML document. You can use XmlDocument to load and save XML data. It also includes methods for node creation. See XML Document Object Model (DOM) for more information.




    You can use those properties or methods to navigate through your XML nodes, for example:





    • XmlNode.FirstChild property


    • XmlNode.NextSibling property


    • XmlNode.CreateNavigator() method


    • XmlNode.SelectNodes() method (using XPath expression)


    • XmlNode.SelectSingleNode() method (using XPath expression)






    share|improve this answer


























      0















      First of all, how can this result be viewed as plain xml (in visual studio)?




      You can use XmlNode.WriteTo(XmlWriter) method, using a XmlWriter object created for writing to a StringBuilder object (documentation), for example:



      Imports System.Text
      Imports System.Xml

      '[...]
      Public Function NodesToString(nodes() As XmlNode) As String

      Dim sb As New StringBuilder()

      Dim settings As New XmlWriterSettings()
      settings.ConformanceLevel = ConformanceLevel.Fragment
      settings.Indent = True

      Dim writer = XmlWriter.Create(sb, settings)
      For Each node In nodes
      node.WriteTo(writer)
      Next
      writer.Close()

      Return sb.ToString()

      End Function


      After that all the contents of your nodes should be on your StringBuilder object, and a simple sb.ToString() would show it all to you.




      And then, how to use this result and navigate / select concrete items from it?




      XmlNode is the base class for a lot of elements in the System.Xml library, even XmlDocument and XmlElement classes, so a lot of the XML "navigation capability" is there.



      As stated by the documentation:




      This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document. XmlNode is the base class in the .NET implementation of the DOM. It supports XPath selections and provides editing capabilities. The XmlDocument class extends XmlNode and represents an XML document. You can use XmlDocument to load and save XML data. It also includes methods for node creation. See XML Document Object Model (DOM) for more information.




      You can use those properties or methods to navigate through your XML nodes, for example:





      • XmlNode.FirstChild property


      • XmlNode.NextSibling property


      • XmlNode.CreateNavigator() method


      • XmlNode.SelectNodes() method (using XPath expression)


      • XmlNode.SelectSingleNode() method (using XPath expression)






      share|improve this answer
























        0












        0








        0







        First of all, how can this result be viewed as plain xml (in visual studio)?




        You can use XmlNode.WriteTo(XmlWriter) method, using a XmlWriter object created for writing to a StringBuilder object (documentation), for example:



        Imports System.Text
        Imports System.Xml

        '[...]
        Public Function NodesToString(nodes() As XmlNode) As String

        Dim sb As New StringBuilder()

        Dim settings As New XmlWriterSettings()
        settings.ConformanceLevel = ConformanceLevel.Fragment
        settings.Indent = True

        Dim writer = XmlWriter.Create(sb, settings)
        For Each node In nodes
        node.WriteTo(writer)
        Next
        writer.Close()

        Return sb.ToString()

        End Function


        After that all the contents of your nodes should be on your StringBuilder object, and a simple sb.ToString() would show it all to you.




        And then, how to use this result and navigate / select concrete items from it?




        XmlNode is the base class for a lot of elements in the System.Xml library, even XmlDocument and XmlElement classes, so a lot of the XML "navigation capability" is there.



        As stated by the documentation:




        This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document. XmlNode is the base class in the .NET implementation of the DOM. It supports XPath selections and provides editing capabilities. The XmlDocument class extends XmlNode and represents an XML document. You can use XmlDocument to load and save XML data. It also includes methods for node creation. See XML Document Object Model (DOM) for more information.




        You can use those properties or methods to navigate through your XML nodes, for example:





        • XmlNode.FirstChild property


        • XmlNode.NextSibling property


        • XmlNode.CreateNavigator() method


        • XmlNode.SelectNodes() method (using XPath expression)


        • XmlNode.SelectSingleNode() method (using XPath expression)






        share|improve this answer













        First of all, how can this result be viewed as plain xml (in visual studio)?




        You can use XmlNode.WriteTo(XmlWriter) method, using a XmlWriter object created for writing to a StringBuilder object (documentation), for example:



        Imports System.Text
        Imports System.Xml

        '[...]
        Public Function NodesToString(nodes() As XmlNode) As String

        Dim sb As New StringBuilder()

        Dim settings As New XmlWriterSettings()
        settings.ConformanceLevel = ConformanceLevel.Fragment
        settings.Indent = True

        Dim writer = XmlWriter.Create(sb, settings)
        For Each node In nodes
        node.WriteTo(writer)
        Next
        writer.Close()

        Return sb.ToString()

        End Function


        After that all the contents of your nodes should be on your StringBuilder object, and a simple sb.ToString() would show it all to you.




        And then, how to use this result and navigate / select concrete items from it?




        XmlNode is the base class for a lot of elements in the System.Xml library, even XmlDocument and XmlElement classes, so a lot of the XML "navigation capability" is there.



        As stated by the documentation:




        This class implements the W3C Document Object Model (DOM) Level 1 Core and the Core DOM Level 2. The DOM is an in-memory (cache) tree representation of an XML document. XmlNode is the base class in the .NET implementation of the DOM. It supports XPath selections and provides editing capabilities. The XmlDocument class extends XmlNode and represents an XML document. You can use XmlDocument to load and save XML data. It also includes methods for node creation. See XML Document Object Model (DOM) for more information.




        You can use those properties or methods to navigate through your XML nodes, for example:





        • XmlNode.FirstChild property


        • XmlNode.NextSibling property


        • XmlNode.CreateNavigator() method


        • XmlNode.SelectNodes() method (using XPath expression)


        • XmlNode.SelectSingleNode() method (using XPath expression)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 28 '18 at 15:25









        Pedro Gaspar

        539321




        539321






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53952482%2fhow-to-use-xmlnode-as-result-from-webservice-in-vb-net%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas