1

我正在使用以下代码将 XML 数据转换为数据集:

Public Function ReadXML(ByVal xmlData As String) As DataSet
        Dim stream As StringReader = Nothing
        Dim reader As XmlTextReader = Nothing
        Try
            Dim xmlDS As New DataSet()
            stream = New StringReader(xmlData)
            ' Load the XmlTextReader from the stream
            reader = New XmlTextReader(stream)
            xmlDS.ReadXml(reader)
            Return xmlDS
        Catch
            Return Nothing
        Finally
            If reader IsNot Nothing Then
                reader.Close()
            End If
        End Try
    End Function

xmlData 是函数的参数,它给出了 xml 文件的路径。

当代码上线时:

xmlDS.ReadXml(reader) 它向我抛出错误:

XMLException was caught: Data at the root level is invalid. Line 1, position 1.

我无法理解为什么会这样。

请帮助我,用c#回答也可以帮助我。

C# 等效函数:

 public DataSet ConvertXMLToDataSet(string xmlData)
  {
   StringReader stream = null;
   XmlTextReader reader = null;
   try
   {
    DataSet xmlDS = new DataSet() ;
    stream = new StringReader(xmlData);
    // Load the XmlTextReader from the stream
    reader = new XmlTextReader(stream);
    xmlDS.ReadXml(reader);
    return xmlDS;
   }
   catch
   {
    return null;
   }
   finally
   {
    if(reader != null) reader.Close();
   }
  }// Use this function to get XML string from a dataset

请帮我。

XML:

<?xml version="1.0" encoding="UTF-8"?>
-<movieinfo creationdate="8/30/2013 11:32:21 AM"> -<localizedtemplatetexts> <field label="Movie Details" id="ttMovieDetails"/> <field label="Cast" id="ttCast"/> <field label="Crew" id="ttCrew"/> <field label="Disc" id="ttDisc"/> <field label="Edition Details" id="ttProductDetails"/> <field label="Personal Details" id="ttPersonalDetails"/> <field label="Episodes" id="ttEpisodeDetails"/> <field label="Images" id="ttImageLinkDetails"/> <field label="Images" id="ttMCEToggleImages"/> <field label="List" id="ttMCEToggleList"/> <field label="First" id="ttFirst"/> <field label="Previous" id="ttPrev"/> <field label="Up" id="ttUp"/> <field label="Next" id="ttNext"/> <field label="Last" id="ttLast"/> <field label="Buy this movie online" id="ttBuyOnline"/> </localizedtemplatetexts> -<moviemetadata> <field label="Index" id="dfIndex" name="Index"/> <field label="Loaned To" id="dfLoaner" name="Loaned To"/> <field label="Loan Date" id="dfLoanDate" name="Loan Date"/> <field label="Due Date" id="dfDueDate" name="Due Date"/> <field label="Overdue" id="dfIsOverdue" name="Overdue"/> <field label="Return Date" id="dfReturnDate" name="Return Date"/> <field label="Loan Notes" id="dfLoanNotes" name="Loan Notes"/> <field label="Loaner Email" id="dfLoanEmail" name="Loaner Email"/> <field label="Loaner Address" id="dfLoanAddress" name="Loaner Address"/> <field label="Title" id="dfLoanTitle" name="Title"/> <field label="Title" id="dfTitle" name="Title"/> <field label="Title Sort" id="dfTitleSort" name="Title Sort"/> <field label="Title Extension" id="dfTitleExtension" name="Title Extension"/> <field label="Collection Status" id="dfCollectionStatus" name="Collection Status"/> <field label="Plot" id="dfPlot" name="Plot"/> <field label="Running Time" id="dfRunTime" name="Running Time"/> <field label="No. of Disks/Tapes" id="dfNrItems" name="No. of Disks/Tapes"/> <field label="Barcode" id="dfUPC" name="Barcode"/> <field label="Movie Release Date" id="dfReleaseDate" name="Movie Release Date"/> <field label="Release Date" id="dfDVDReleaseDate" name="Release Date"/> <field label="IMDb Number" id="dfIMDBNumber" name="IMDb Number"/> <field label="IMDb Rating" id="dfIMDBRating" name="IMDb Rating"/> <field label="TMDb ID" id="dfMovieDbID" name="TMDb ID"/> <field label="Color" id="dfColor" name="Color"/> <field label="Layers" id="dfLayers" name="Layers"/> <field label="Front Cover" id="dfCoverFront" name="Front Cover"/> <field label="Back Cover" id="dfCoverBack" name="Back Cover"/> <field label="Movie Poster" id="dfMoviePoster" name="Movie Poster"/> <field label="Backdrop" id="dfBackDrop" name="Backdrop"/> <field label="My Rating" id="dfMyRating" name="My Rating"/> <field label="Seen It" id="dfSeenIt" name="Seen It"/> <field label="Viewing Date" id="dfSeenWhen" name="Viewing Date"/> <field label="Viewing Year" id="dfSeenYear" name="Viewing Year"/> <field label="Seen Where" id="dfSeenWhere" name="Seen Where"/> <field label="Purchase Date" id="dfPurchaseDate" name="Purchase Date"/> <field label="Purchase Year" id="dfPurchaseYear" name="Purchase Year"/> <field label="Purchase Price" id="dfPurchasePrice" name="Purchase Price"/> <field label="Location" id="dfLocation" name="Location"/> <field label="Starting Position" id="dfStartPos" name="Starting Position"/> <field label="Tape Speed" id="dfTapeSpeed" name="Tape Speed"/> <field label="Notes" id="dfNotes" name="Notes"/> <field label="Links" id="dfLinks" name="Links"/> <field label="Movie Files" id="dfMovieLinks" name="Movie Files"/> <field label="Image Files" id="dfImageLinks" name="Image Files"/> <field label="Other Files" id="dfOtherLinks" name="Other Files"/> <field label="Trailer URLs" id="dfLinkTrailers" name="Trailer URLs"/> <field label="Trailer Files" id="dfTrailerFiles" name="Trailer Files"/> <field label="Quantity" id="dfQuantity" name="Quantity"/> <field label="Current Value" id="dfCurrentValue" name="Current Value"/> <field label="Storage Device" id="dfStorageDevice" name="Storage Device"/> <field label="Slot" id="dfStorageSlot" name="Slot"/> <field label="Episodes" id="dfEpisodes" name="Episodes"/> <field label="Chapters" id="dfChapters" name="Chapters"/> <field label="Extra Features" id="dfExtraFeatures" name="Extra Features"/> <field label="Actor" id="dfActor" name="Actor"/> <field label="Genre" id="dfGenre" name="Genre"/> <field label="Director" id="dfDirector" name="Director"/> <field label="Edition" id="dfEdition" name="Edition"/> <field label="Movie Release Year" id="dfReleaseYear" name="Movie Release Year"/> <field label="Format" id="dfFormat" name="Format"/> <field label="Region" id="dfRegion" name="Region"/> <field label="Release Year" id="dfDVDReleaseYear" name="Release Year"/> <field label="Series" id="dfSeries" name="Series"/> <field label="Box set" id="dfBoxSet" name="Box set"/> <field label="Audience Rating" id="dfMPAARating" name="Audience Rating"/> <field label="Studio" id="dfStudio" name="Studio"/> <field label="Distributor" id="dfDistributor" name="Distributor"/> <field label="Extras" id="dfExtras" name="Extras"/> <field label="Country" id="dfCountry" name="Country"/> <field label="Language" id="dfLanguage" name="Language"/> <field label="Plot Language" id="dfPlotLanguage" name="Plot Language"/> <field label="Original Title" id="dfOriginalTitle" name="Original Title"/> <field label="Screen Ratio" id="dfRatio" name="Screen Ratio"/> <field label="Packaging" id="dfPackage" name="Packaging"/> <field label="Subtitles" id="dfSubtitles" name="Subtitles"/> <field label="Audio Tracks" id="dfAudio" name="Audio Tracks"/> <field label="Store" id="dfStore" name="Store"/> <field label="Owner" id="dfOwner" name="Owner"/> <field label="Tape Label" id="dfTapeLabel" name="Tape Label"/> <field label="Condition" id="dfCondition" name="Condition"/> <field label="Tags" id="dfTag" name="Tags"/> <field label="Producer" id="dfProducer" name="Producer"/> <field label="Writer" id="dfWriter" name="Writer"/> <field label="Cinematography" id="dfCamera" name="Cinematography"/> <field label="Musician" id="dfMusic" name="Musician"/> <field label="User Credit 1" id="dfUserCredit1" name="User Credit 1"/> <field label="User Credit 2" id="dfUserCredit2" name="User Credit 2"/> <field label="Features" id="dfFeatures" name="Features"/> <field label="Title" id="dfEpisodeTitle" name="Title"/> <field label="Disc No." id="dfEpisodeDiscNr" name="Disc No."/> <field label="Plot" id="dfEpisodePlot" name="Plot"/> <field label="Running Time" id="dfEpisodeRunTime" name="Running Time"/> <field label="First Air Date" id="dfEpisodeFirstAirDate" name="First Air Date"/> <field label="Sequence No" id="dfEpisodeSequenceNr" name="Sequence No"/> <field label="Movie Link" id="dfEpisodeMovieLink" name="Movie Link"/> <field label="Internet Link" id="dfEpisodeLink" name="Internet Link"/> <field label="Image Link" id="dfEpisodeImageLink" name="Image Link"/> <field label="IMDB Number" id="dfEpisodeIMDBNumber" name="IMDB Number"/> <field label="Seen It" id="dfEpisodeSeenIt" name="Seen It"/> <field label="Viewing Date" id="dfEpisodeSeenWhen" name="Viewing Date"/> <field label="Seen Where" id="dfEpisodeSeenWhere" name="Seen Where"/> <field label="Disc No." id="strDiscNr" name="Disc No."/> <field label="Number Of Episodes" id="strNrEpisodes" name="Number Of Episodes"/> <field label="User Lookup 1" id="dfUserLookup1" name="User Lookup 1"/> <field label="User Lookup 2" id="dfUserLookup2" name="User Lookup 2"/> <field label="User Text 1" id="dfUserText1" name="User Text 1"/> <field label="User Text 2" id="dfUserText2" name="User Text 2"/> <field label="In Collection (0/1)" id="dfInCollectionBit" name="In Collection (0/1)"/> <field label="ID" id="dfID" name="ID"/> <field label="Last Modified" id="dfLastModified" name="Last Modified"/> <field label="Thumbnail" id="dfThumbFilePath" name="Thumbnail"/> <field label="Last Submission Date" id="dfSubmissionDate" name="Last Submission Date"/> <field label="Clz Movie ID" id="dfBPMovieID" name="Clz Movie ID"/> <field label="Clz Media ID" id="dfBPMediaID" name="Clz Media ID"/> <field label="BPOnline Movie Last Received Revision" id="dfBPMovieLastReceivedRevision" name="BPOnline Movie Last Received Revision"/> <field label="BPOnline Media Last Received Revision" id="dfBPMediaLastReceivedRevision" name="BPOnline Media Last Received Revision"/> <field label="Title First Letter" id="dfDynTitleLetter" name="Title First Letter"/> <field label="My Rating" id="dfDynRating" name="My Rating"/> </moviemetadata> -<movielist> -<movie> <id>701</id> <index>11</index> <coverfront>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_f.jpg</coverfront> <poster>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_p.jpg</poster> <backdropurl>C:\Users\Administrator\Documents\Movie Collector\Images\Brave2012701_d.jpg</backdropurl> <backgroundbackdrop>CLZBACKDROP</backgroundbackdrop> <imdburl>http://www.imdb.com/title/tt1217209</imdburl> <imdbnum>1217209</imdbnum> <imdbrating>7.3</imdbrating> <imdbvotes>66509</imdbvotes> <tmdbid>62177</tmdbid> <tmdburl>http://themoviedb.org/movie/62177</tmdburl> -<format> <displayname>Blu-ray Disc</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\bluray.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\bluray16x16.bmp</scaledimage> <sortname>Blu-ray Disc</sortname> </format> -<country> <displayname>USA</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\usa.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\usa16.jpg</scaledimage> <sortname>USA</sortname> </country> <collectionstatus listid="3">In Collection</collectionstatus> -<language> <displayname>English</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\uk.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\uk16.jpg</scaledimage> <sortname>English</sortname> </language> -<store> <displayname>Amazon</displayname> <sortname>Amazon</sortname> </store> <purchaseprice>$20.00</purchaseprice> <series/> <boxset/> -<purchasedate> -<year> <displayname>2012</displayname> </year> <month>12</month> <day>10</day> <date>12/10/2012</date> </purchasedate> -<owner> <displayname>John Doe</displayname> <sortname>John Doe</sortname> </owner> <title>Brave</title> <plot>Brave is set in the mystical Scottish Highlands, where Mérida is the princess of a kingdom ruled by King Fergus and Queen Elinor. An unruly daughter and an accomplished archer, Mérida one day defies a sacred custom of the land and inadvertently brings turmoil to the kingdom. In an attempt to set things right, Mérida seeks out an eccentric old Wise Woman and is granted an ill-fated wish. Also figuring into Mérida’s quest — and serving as comic relief — are the kingdom’s three lords: the enormous Lord MacGuffin, the surly Lord Macintosh, and the disagreeable Lord Dingwall.</plot> <myrating>9</myrating> -<myrating> <displayname>9</displayname> <sortname>9</sortname> </myrating> <seenit boolvalue="1">Yes</seenit> -<viewingdate> -<year> <displayname>2012</displayname> </year> <month>12</month> <day>10</day> <date>12/10/2012</date> </viewingdate> -<edition> <displayname>Collector's Edition</displayname> <sortname>Collector's Edition</sortname> </edition> -<condition> <displayname>Excellent</displayname> <sortname>090 Excellent</sortname> <lastname>090 Excellent</lastname> </condition> -<releasedate> -<year> <displayname>2012</displayname> </year> <date>2012</date> </releasedate> -<dvdreleasedate> -<year> <displayname>2012</displayname> </year> <month>11</month> <day>13</day> <date>11/13/2012</date> </dvdreleasedate> -<mpaarating> <displayname>PG (Parental Guidance)</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\pg.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\pg-16x16.jpg</scaledimage> <sortname>PG (Parental Guidance)</sortname> </mpaarating> <seenwhere>Home</seenwhere> <upc>786936828344</upc> <package/> -<location> <displayname>Moviebox 34</displayname> <sortname>Moviebox 34</sortname> </location> <tapelabel/> <runtime>93</runtime> <runtimeminutes>93 mins</runtimeminutes> <layersnum>1</layersnum> <layers listid="1">Single Side, Dual Layer</layers> <chapters>0</chapters> <nritems>5</nritems> <quantity>1</quantity> <color listid="0">Color</color> <tapespeed listid="0">N/A</tapespeed> -<genres> -<genre> <displayname>Action</displayname> <sortname>Action</sortname> </genre> -<genre> <displayname>Adventure</displayname> <sortname>Adventure</sortname> </genre> -<genre> <displayname>Animation</displayname> <sortname>Animation</sortname> </genre> -<genre> <displayname>Comedy</displayname> <sortname>Comedy</sortname> </genre> -<genre> <displayname>Family</displayname> <sortname>Family</sortname> </genre> </genres> -<cast> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Kelly MacDonald</displayname> <sortname>MacDonald, Kelly</sortname> <lastname>MacDonald</lastname> <url>http://www.imdb.com/name/nm0531808/</url> <firstname>Kelly</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/09/09_24708_4_KellyMacDonald.jpg</imageurl> </person> <character>Merida</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Billy Connolly</displayname> <sortname>Connolly, Billy</sortname> <lastname>Connolly</lastname> <url>http://www.imdb.com/name/nm0175262/</url> <firstname>Billy</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/b4/b4_3429_4_BillyConnolly.jpg</imageurl> </person> <character>Fergus</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Emma Thompson</displayname> <sortname>Thompson, Emma</sortname> <lastname>Thompson</lastname> <url>http://www.imdb.com/name/nm0000668/</url> <firstname>Emma</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/13/13_8549_4_EmmaThompson.jpg</imageurl> </person> <character>Elinor</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Julie Walters</displayname> <sortname>Walters, Julie</sortname> <lastname>Walters</lastname> <url>http://www.imdb.com/name/nm0910278/</url> <firstname>Julie</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/20/20_14643_4_JulieWalters.jpg</imageurl> </person> <character>The Witch</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Robbie Coltrane</displayname> <sortname>Coltrane, Robbie</sortname> <lastname>Coltrane</lastname> <url>http://www.imdb.com/name/nm0001059/</url> <firstname>Robbie</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/d0/d0_92_4_RobbieColtrane.jpg</imageurl> </person> <character>Lord Dingwall</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Kevin McKidd</displayname> <sortname>McKidd, Kevin</sortname> <lastname>McKidd</lastname> <url>http://www.imdb.com/name/nm0571727/</url> <firstname>Kevin</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/b8/b8_3557_4_KevinMcKidd.jpg</imageurl> </person> <character>Lord MacGuffin/Young MacGuffin</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Craig Ferguson</displayname> <sortname>Ferguson, Craig</sortname> <lastname>Ferguson</lastname> <url>http://www.imdb.com/name/nm0272401/</url> <firstname>Craig</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/17/17_17423_4_CraigFerguson.jpg</imageurl> </person> <character>Lord Macintosh</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Sally Kinghorn</displayname> <sortname>Kinghorn, Sally</sortname> <lastname>Kinghorn</lastname> <firstname>Sally</firstname> </person> <character>Maudie</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Eilidh Fraser</displayname> <sortname>Fraser, Eilidh</sortname> <lastname>Fraser</lastname> <firstname>Eilidh</firstname> </person> <character>Maudie</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Peigi Barker</displayname> <sortname>Barker, Peigi</sortname> <lastname>Barker</lastname> <firstname>Peigi</firstname> </person> <character>Young Merida</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Steven Cree</displayname> <sortname>Cree, Steven</sortname> <lastname>Cree</lastname> <firstname>Steven</firstname> </person> <character>Young Macintosh</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <firstname>Steve</firstname> </person> <character>The Crow</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Callum O'Neill</displayname> <sortname>O'Neill, Callum</sortname> <lastname>O'Neill</lastname> <firstname>Callum</firstname> </person> <character>Wee Dingwall</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>Patrick Doyle</displayname> <sortname>Doyle, Patrick</sortname> <lastname>Doyle</lastname> <firstname>Patrick</firstname> </person> <character>Martin</character> </star> -<star> <role id="dfActor">Actor</role> <roleid>dfActor</roleid> -<person> <displayname>John Ratzenberger</displayname> <sortname>Ratzenberger, John</sortname> <lastname>Ratzenberger</lastname> <url>http://www.imdb.com/name/nm0001652/</url> <firstname>John</firstname> <imageurl>http://clzimages.com/movie/banners/actors/small/d2/d2_14840_4_JohnRatzenberger.jpg</imageurl> </person> <character>Gordon</character> </star> </cast> -<crew> -<crewmember> <role id="dfDirector">Director</role> <roleid>dfDirector</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <url>http://www.imdb.com/name/nm0700760/</url> <firstname>Steve</firstname> <imageurl>http://clzimages.com/movie/banners/employees/small/0e/0e_3199_4_StevePurcell.jpg</imageurl> </person> </crewmember> -<crewmember> <role id="dfDirector">Director</role> <roleid>dfDirector</roleid> -<person> <displayname>Brenda Chapman</displayname> <sortname>Chapman, Brenda</sortname> <lastname>Chapman</lastname> <url>http://www.imdb.com/name/nm0152312/</url> <firstname>Brenda</firstname> <imageurl>http://clzimages.com/movie/banners/employees/small/32/32_6810_4_BrendaChapman.jpg</imageurl> </person> </crewmember> -<crewmember> <role id="dfWriter">Writer</role> <roleid>dfWriter</roleid> -<person> <displayname>Steve Purcell</displayname> <sortname>Purcell, Steve</sortname> <lastname>Purcell</lastname> <firstname>Steve</firstname> </person> </crewmember> -<crewmember> <role id="dfWriter">Writer</role> <roleid>dfWriter</roleid> -<person> <displayname>Brenda Chapman</displayname> <sortname>Chapman, Brenda</sortname> <lastname>Chapman</lastname> <firstname>Brenda</firstname> </person> </crewmember> -<crewmember> <role id="dfProducer">Producer</role> <roleid>dfProducer</roleid> -<person> <displayname>Andrew Stanton</displayname> <sortname>Stanton, Andrew</sortname> <lastname>Stanton</lastname> <firstname>Andrew</firstname> </person> </crewmember> -<crewmember> <role id="dfProducer">Producer</role> <roleid>dfProducer</roleid> -<person> <displayname>John Lasseter</displayname> <sortname>Lasseter, John</sortname> <lastname>Lasseter</lastname> <firstname>John</firstname> </person> </crewmember> -<crewmember> <role id="dfMusic">Musician</role> <roleid>dfMusic</roleid> -<person> <displayname>Patrick Doyle</displayname> <sortname>Doyle, Patrick</sortname> <lastname>Doyle</lastname> <firstname>Patrick</firstname> </person> </crewmember> </crew> -<regions> -<region> <displayname>Region 1</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-1.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-1-16x16.jpg</scaledimage> <sortname>Region 1</sortname> </region> -<region> <displayname>Region A</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-A.jpg</templateimage> <scaledimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\r-A-16x16.jpg</scaledimage> <sortname>Region A</sortname> </region> </regions> -<ratios> -<ratio> <displayname>Theatrical Widescreen (2.35:1)</displayname> <sortname>Theatrical Widescreen (2.35:1)</sortname> </ratio> </ratios> -<subtitles> -<subtitle> <displayname>English (Closed Captioned)</displayname> <sortname>English (Closed Captioned)</sortname> </subtitle> -<subtitle> <displayname>French</displayname> <sortname>French</sortname> </subtitle> -<subtitle> <displayname>Spanish</displayname> <sortname>Spanish</sortname> </subtitle> </subtitles> <features/> -<audios> -<audio> <displayname>Dolby Digital 5.1 [Spanish]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dolbydigital-51.png</templateimage> <sortname>Dolby Digital 5.1 [Spanish]</sortname> </audio> -<audio> <displayname>DTS [English]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dts.png</templateimage> <sortname>DTS [English]</sortname> </audio> -<audio> <displayname>DTS [French]</displayname> <templateimage>C:\Users\Administrator\Documents\Movie Collector\Images\Listitemimages\dts.png</templateimage> <sortname>DTS [French]</sortname> </audio> </audios> -<studios> -<studio> <displayname>Pixar</displayname> <sortname>Pixar</sortname> </studio> </studios> -<distributor> <displayname>Buena Vista</displayname> <sortname>Buena Vista</sortname> </distributor> <extras/> <tags/> <userlookup1/> <userlookup2/> -<links> -<link> <description>Amazon.com</description> <url>http://www.amazon.com/gp/search?keywords=786936828344+Brave&tag=collectorzapp-20&index=dvd</url> <urltype>URL</urltype> </link> -<link> <description>Movie Collector Connect</description> <url>http://connect.collectorz.com/movies/database/brave-2012</url> <urltype>URL</urltype> </link> -<link> <description>IMDB</description> <url>http://www.imdb.com/title/tt1217209</url> <urltype>URL</urltype> </link> -<link> <description>TheMovieDb.org</description> <url>http://www.themoviedb.org/movie/62177</url> <urltype>URL</urltype> </link> -<link> <description>Trailer</description> <url>http://www.youtube.com/watch?v=tYg0VgPy6Uk</url> <urltype>Trailer URL</urltype> </link> </links> <episodecount>0</episodecount> -<lastmodified> <date>12/10/2012 4:37:03 PM</date> </lastmodified> <thumbfilepath>C:\Users\Administrator\Documents\Movie Collector\Thumbnails\CBF03186E647BB05BC635F286DC84E34.jpg</thumbfilepath> <bpmovieid>140538</bpmovieid> <bpmediaid>496821</bpmediaid> <bpmovielastreceivedrevision>58</bpmovielastreceivedrevision> <bpmedialastreceivedrevision>0</bpmedialastreceivedrevision> <plotlanguage/> <storagedevice/> -<titlefirstletter> <displayname>B</displayname> <sortname>B</sortname> </titlefirstletter> -<discs> -<disc> <title>Disc 01</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 02</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 03</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 04</title> <features/> <storagedevice/> <episodes/> </disc> -<disc> <title>Disc 05</title> <features/> <storagedevice/> <episodes/> </disc> </discs> <submissiondate/> </movie> </movielist> </movieinfo>
4

3 回答 3

2

http://www.amazon.com/gp/search?keywords=786936828344+Bravetag=collectorzapp-20&index=dvd

此 URL 表单 xml 文件给出错误。

记住一件事 XML 不接受“&”

于 2013-08-30T07:10:27.820 回答
1

两件事情:

首先,您的 XML 包含很多-字符(可能是您无意中从 Xml 编辑器或查看器复制了这些字符)。

&其次,您的 XML在 URL中包含一些未转义的 s;这些必须被转义(使用&amp;而不是&)。看看XML 规范

与号字符 (&) 和左尖括号 (<) 仅在用作标记分隔符时,或在注释、处理指令或 CDATA 部分中时,才能以其文字形式出现。如果在其他地方需要它们,则必须分别使用数字字符引用或字符串“&”和“<”对它们进行转义。

于 2013-08-30T07:18:20.670 回答
0

StringReader 读取文字字符串。

请改用 StreamReader。

或者像这样使用它:

http://forums.asp.net/t/1247855.aspx/1给出路径

于 2013-08-30T07:05:20.120 回答