![]() |
Getting error while parsing xml in XE4
Greetings..
I am a student and enjoy learning delphi. I came across a problem while I am trying to extract data from a xml file using XML binding in Delphi XE-4. The problem is the application throws exception every time. Here is my XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<conversioncloud version="1.2"> <status step="finished"/> <id> <![CDATA[T9Nr96Hy]]> </id> <videoid> <![CDATA[92590917]]> </videoid> <server> <![CDATA[server12]]> </server> <file> <![CDATA[my file ofr xmfhf.ext]]> </file> <service> <![CDATA[myservice]]> </service> <mediaurl> <![CDATA[web address here]]> </mediaurl> <downloadurl> <![CDATA[download url here]]> </downloadurl> <downloadserver> <![CDATA[srv55]]> </downloadserver> <downloadhash> <![CDATA[upyxqnJmsKuwbGttn5OcaXCs26SqaG60l5acbmpmm2pka7WEz9bXnaeE14ujqK2tyMg%3D]]> </downloadhash> <filesize> <![CDATA[2.77 MB]]> </filesize> <debuginfo> <![CDATA[T9Nr96Hy|92590917|srv55|1396163808|ListenToYoutube]]> </debuginfo> </conversioncloud> Error I get as Exception: An opening '[' character was expected Line:23 Here is my code:
Code:
procedure TForm1.Button10Click(Sender: TObject);
var Cloud : IXMLConversioncloudType; size : Integer; begin XMLDocument1.XML.Text := Memo1.Text; Cloud := Getconversioncloud(XMLDocument1); // trying to display "file" field from xml document above ShowMessage(Cloud.File_); end; Actually I want to extract the values like mediaurl, fileurl, filesize and so on. PS I don't know whether this is the correct section to post this thread but I use Indy to get this xml data. Thanks in Advance |
AW: Getting error while parsing xml in XE4
By the way I need a simpler solution i.e. using XML Binding wizard or any other methods. Any code example or reference for such problems will be appreciated.
|
AW: Getting error while parsing xml in XE4
How do you store the XML? Don't use a TMemo, it breaks the lines and might produce an invalid XML.
I ![]() |
AW: Getting error while parsing xml in XE4
Hi,
I am using this as only a sample. In the real world I hava xml in string which is something like this:
Code:
where,
IdHttp1.Post('http://MyAPIurl', Params, PostResponseinXML);
Code:
while parsing this XMl I am getting error.
Params is the stringlist containing parameters to send to the server,
PostResponseinXML is the StringStream received successfully after post. |
AW: Getting error while parsing xml in XE4
Zitat:
The XML Schema Binding Wizards works best with an XSD. If you have Delphi Enterprise or higher, you can also use the XML Data Binding Wizard. |
AW: Getting error while parsing xml in XE4
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:22 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz