Einzelnen Beitrag anzeigen

rabirabi

Registriert seit: 7. Aug 2013
4 Beiträge
 
#1

Getting error while parsing xml in XE4

  Alt 18. Apr 2014, 16:35
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
  Mit Zitat antworten Zitat