It returns a literal string "System.Xml.XmlElement".
<WebMethod()> _
Public Function myShoesInfo() As String
Dim doc As New System.Xml.XmlDocument
doc.Load(Server.MapPath("~/xml-files/shoes.xml"))
Return doc.DocumentElement.ToString
End Function
It returns a literal string "System.Xml.XmlElement".
<WebMethod()> _
Public Function myShoesInfo() As String
Dim doc As New System.Xml.XmlDocument
doc.Load(Server.MapPath("~/xml-files/shoes.xml"))
Return doc.DocumentElement.ToString
End Function
imperialx
Member
523 Points
1220 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 01:40 PM|LINK
It's on the webservice. Did I correctly return a type of System.Xml.XmlElement or should it be on another type?
devensawant
Contributor
3763 Points
858 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 01:45 PM|LINK
insted of xmlelement return string from there
If my post helps you then please mark as answer
imperialx
Member
523 Points
1220 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 01:56 PM|LINK
It returns a literal string "System.Xml.XmlElement".
<WebMethod()> _ Public Function myShoesInfo() As String Dim doc As New System.Xml.XmlDocument doc.Load(Server.MapPath("~/xml-files/shoes.xml")) Return doc.DocumentElement.ToString End Functiondevensawant
Contributor
3763 Points
858 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:04 PM|LINK
return the text inside shoes.xml, i.e total xml as a string
If my post helps you then please mark as answer
tiagosalgado
Contributor
2410 Points
544 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:11 PM|LINK
Change to return doc.InnerXml;
http://geekswithblogs.com/TiagoSalgado
@TiagoSalgado
imperialx
Member
523 Points
1220 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:23 PM|LINK
sorry, but, how can i return the text from shoes.xml? I get this error 'Invalid at the top level of the document'
devensawant
Contributor
3763 Points
858 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:24 PM|LINK
return doc.InnerXml as suggested by tiagosalgado
If my post helps you then please mark as answer
imperialx
Member
523 Points
1220 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:29 PM|LINK
That part works, thanks!
But if you look at code for the Index page above, no alert dialog box pops-up.
devensawant
Contributor
3763 Points
858 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:32 PM|LINK
Check out the below link for parsing xml using jQuery
http://www.switchonthecode.com/tutorials/xml-parsing-with-jquery
If my post helps you then please mark as answer
imperialx
Member
523 Points
1220 Posts
Re: Only one top level element is allowed in an XML document.
Jun 09, 2011 02:43 PM|LINK
Thank All for the help Guys! Appreciate it!