Results 1 to 3 of 3

Thread: [RESOLVED] XML Deserialization (Hydration)

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    Resolved [RESOLVED] XML Deserialization (Hydration)

    Hi!
    I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).

    The XML document looks like this:
    xml Code:
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">
    3.   <opensearch:Query role="request" startPage="1" searchTerms="Piano Tribute Players"/>
    4.   <opensearch:totalResults>2</opensearch:totalResults>
    5.   <opensearch:startIndex>0</opensearch:startIndex>
    6.   <opensearch:itemsPerPage>100</opensearch:itemsPerPage>
    7.   <artist href="spotify:artist:4Xx6QMLTWppMwdABkN0Afj">
    8.     <name>Piano Tribute Players</name>
    9.  
    10.     <popularity>0.73531</popularity>
    11.   </artist>
    12.   <artist href="spotify:artist:4oG2lcwDOqbB74BOE4O7o7">
    13.     <name>Piano Players Tribute</name>
    14.     <popularity>0.50211</popularity>
    15.   </artist>
    16. </artists>

    And I need to get all that information into a class but I'm really lost.
    To begin with, I don't know how to create the sub-node (artist) in a class, I've tried with Public Structure and Public Property but I think that it needs to be another class, am I right?

    Here's what I currently have:
    vb.net Code:
    1. <Serializable(), XmlRoot()> _
    2. Public Class artists
    3.     Public totalResults As Integer
    4.     Public startIndex As Integer
    5.     Public itemsPerPage As Integer
    6.     Public Class artist
    7.         Public name As String
    8.         Public popularity As Double
    9.     End Class
    10. End Class

    Another thought that I have is that the artist node isn't only one, so how would I do to create multiple artist classes....

    Please help me!
    //Zeelia
    Last edited by Zeelia; Apr 25th, 2010 at 05:46 PM. Reason: Resolved

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