Results 1 to 4 of 4

Thread: Missing XML Name Information???

Threaded View

  1. #1

    Thread Starter
    pathfinder NotLKH's Avatar
    Join Date
    Apr 2001
    Posts
    2,397

    Missing XML Name Information???

    I've put together the following code that reads an XML file into an XML Document, and iterating thru each node in the document, I'm placeing the node's name and associated value into a treeview:

    VB Code:
    1. Private Sub Button1_Click_1 (ByVal sender As System.Object, ByVal e As System.EventArgs) _[i]edit[/i]
    2. Handles Button1.Click
    3.     Dim MyBoo As Boolean
    4.     Dim MyNode As XmlNode
    5.     Dim FitN As TreeNode
    6.     Dim rootNode As TreeNode
    7.     Dim MyStockXML As New Xml.XmlDocument()
    8.     MyStockXML.Load ("c:\psip_stocklibrary.xml")
    9.     TreeView1.Visible = False
    10.     Application.DoEvents()
    11.     rootNode = TreeView1.Nodes.Add("Media")
    12.     TreeView1.SelectedNode = rootNode
    13.     Call FILLTreeV(MyStockXML, rootNode)
    14.     TreeView1.Visible = True
    15. End Sub
    16. Public Sub FILLTreeV(ByVal mNode As XmlNode, ByVal pNode As TreeNode)
    17.     Dim FitN As TreeNode
    18.     Dim selNode As TreeNode
    19.     Dim MyChildNode As XmlNode
    20.     For Each MyChildNode In mNode '.ChildNodes
    21.         FitN = New TreeNode(MyChildNode.Name & " " & MyChildNode.Value)
    22.         pNode.Nodes.Add (FitN)
    23.         If MyChildNode.HasChildNodes = True Then
    24.             FILLTreeV(MyChildNode, FitN)
    25.         End If
    26.     Next
    27. End Sub

    Now, the XML text in the file "c:\psip_stocklibrary.xml" looks like:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <stockLibrary xmlns="http://www.xerox.com/psip/app/media/StockLibrary" _edit
    xmlns:vudu="vudu" vudu:class="psip.app.media.xml.StockLibraryFormat" _edit
    vudu:serial="-1141390230395564101_0.2.1">
      <nextStockID value="376" />
      <media>
        <name>(p005426_19p5x14p33)</name>
        <predefinedColor>MEDIA_COLOR_WHITE</predefinedColor>
        <weight>280</weight>
        <sidesCoated>0</sidesCoated>
        <coatingType>MEDIA_COATING_TYPE_NONE</coatingType>
        <thickness>334</thickness>
        <finish>MEDIA_FINISH_REGULAR</finish>
        <xeroxDefined>false</xeroxDefined>
        <rmlVersion />
        <comments></comments>
        <hidden>false</hidden>
    yadayadayada...
    And my resulting treeview looks like this:



    So what I don't understand is:

    the first node below the root is named xml version="1.0" encoding="UTF-8" which is seen in the file as:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>

    The next node, seen as stock Library in the picture, has as its text in the file:

    Code:
    <stockLibrary xmlns="http://www.xerox.com/psip/app/media/StockLibrary" _edit
    xmlns:vudu="vudu" vudu:class="psip.app.media.xml.StockLibraryFormat" _edit
    vudu:serial="-1141390230395564101_0.2.1">
    and the third node, seen as nextStockID, has the following text line in the file:

    Code:
    <nextStockID value="376" />
    So:
    [list=a][*]What happened to the bracketing question marks in the first treeview node?[*]Why is the second node only named stockLibrary? What happened to all of that http and vudu info as seen in its file line?[*]Whats up with that value="376" in the file for nextStockID? Why doesn't it show up in the TreeView?[*]The node that is called "name" contains a subnode identified as #text (p005426_19p5x14p33). Isn't that SubNode supposed to be the Value of the name node {minus the #text bit}, since its structure in the file is: <name>(p005426_19p5x14p33)</name> ??? [/list=a]


    -Lou
    Attached Images Attached Images  

Posting Permissions

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



Click Here to Expand Forum to Full Width