Delphi Can
xmldocument veri okuma - Baskı Önizleme

+- Delphi Can (https://www.delphican.com)
+-- Forum: Delphi (https://www.delphican.com/forumdisplay.php?fid=3)
+--- Forum: Mobil Platform - FireMonkey (FMX) (https://www.delphican.com/forumdisplay.php?fid=7)
+--- Konu Başlığı: xmldocument veri okuma (/showthread.php?tid=2141)

Sayfalar: 1 2


xmldocument veri okuma - ramazanayer - 12-04-2018

Arkadaşlar hata nerede bulamadım XMLDocument true yaptığımda XML içinde verileri görüyorum.Fakat android de butona bastığım anda 
Cannot open file "/http:/ajansmanisa.com/cache/manset.xml".Not a directory.
hatasını alıyorum

procedure TForm1.Button2Click(Sender: TObject);
var
StartItemNode, ANode : IXMLNode;
begin
  try
  XMLDocument1.FileName:='http://ajansmanisa.com/cache/manset.xml';
  XMLDocument1.Active:=True;
  StartItemNode:=XMLDocument1.DocumentElement.ChildNodes.First.ChildNodes.FindNode('linkx');
  ANode := StartItemNode;
    repeat
      Application.ProcessMessages;
      Memo1.Lines.Add(ANode.ChildNodes['adi'].Text);
      Memo1.Lines.Add(ANode.ChildNodes['ids'].Text);
      Memo1.Lines.Add(ANode.ChildNodes['res'].Text);
      Memo1.Lines.Add('');
      ANode  := ANode.NextSibling;
    until
    ANode=Nil;
  finally
  ShowMessage('xml Okundu');
  end;
end;



xmldocument veri okuma - SimaWB - 12-04-2018

TXMLDocument'in yardım dokümanında söyle birşey yazıyor:

Tip: To use TXMLDocument in OS X or Mobile applications, in the Object Inspector, set the DOMVendor property to ADOM XML v4 right after dropping this component onto the Form Designer. Otherwise, the TXMLDocument component is no longer usable for iOS/Android/OSX applications.

Siz bu değişikliği yaptınız mı? Belki sorun bundan kaynaklıdır.


xmldocument veri okuma - meko - 12-04-2018

 XMLDocument1.FileName:='http://ajansmanisa.com/cache/manset.xml';
yerine
 XMLDocument1.FileName:='http:///ajansmanisa.com/cache/manset.xml';
ile denermisiniz


Cvp: xmldocument veri okuma - ramazanayer - 12-04-2018

(12-04-2018, Saat: 12:02)SimaWB Adlı Kullanıcıdan Alıntı: TXMLDocument'in yardım dokümanında söyle birşey yazıyor:

Tip: To use TXMLDocument in OS X or Mobile applications, in the Object Inspector, set the DOMVendor property to ADOM XML v4 right after dropping this component onto the Form Designer. Otherwise, the TXMLDocument component is no longer usable for iOS/Android/OSX applications.

Siz bu değişikliği yaptınız mı? Belki sorun bundan kaynaklıdır.

Hocam 
loadfromurl not enable for non-windows platforms currently
hatası verdi o ayarı yapınca

(12-04-2018, Saat: 12:02)meko Adlı Kullanıcıdan Alıntı:
 XMLDocument1.FileName:='http://ajansmanisa.com/cache/manset.xml';
yerine
 XMLDocument1.FileName:='http:///ajansmanisa.com/cache/manset.xml';
ile denermisiniz

Farketmiyor yinede teke düşürüyor


xmldocument veri okuma - SimaWB - 12-04-2018

Önce dosyayı çalışma ortamına indirmeniz gerekiyor. Yada TMemoryStream içerisine almanız gerekiyor.


xmldocument veri okuma - ozcanm - 12-04-2018

Konuyu bir inceleyin, faydası olacaktır.


Cvp: xmldocument veri okuma - ramazanayer - 12-04-2018

(12-04-2018, Saat: 13:35)Cyber Adlı Kullanıcıdan Alıntı: Konuyu bir inceleyin, faydası olacaktır.

Konuyu inceledim.
kendime uyarladım
yine aynı hatayı verdi cannot open file ..... not a directory


procedure TForm1.MansetOku;
var
  XMLDocument1: TXMLDocument;
  XMLNode: IXMLNode;
begin

  XMLDocument1 := TXMLDocument.Create(Application);
  try

      XMLDocument1.Active := false;
      XMLDocument1.FileName := 'http://ajansmanisa.com/cache/manset.xml';
      XMLDocument1.Active := true;



    XMLNode := XMLDocument1.DocumentElement.ChildNodes.FindNode('linkx');
    repeat
      Memo1.Lines.Add(XMLNode.ChildNodes['adi'].Text);
      Memo1.Lines.Add(XMLNode.ChildNodes['ids'].Text);
      Memo1.Lines.Add(XMLNode.ChildNodes['res'].Text);
      Memo1.Lines.Add('');
      XMLNode := XMLNode.NextSibling;
    until XMLNode = nil;


  finally
    XMLDocument1.Free;
  end;
end;



xmldocument veri okuma - barisatalay - 12-04-2018

Merhabalar,

XE7 den sonra delphi mobile kullanmadım fakat ozamanlardan aklımda kalan; windows platformu hariç TXMLDocument componentinin diğer platformlara desteğinin olmaması.


Cvp: xmldocument veri okuma - ramazanayer - 12-04-2018

(12-04-2018, Saat: 15:31)barisatalay Adlı Kullanıcıdan Alıntı: Merhabalar,

XE7 den sonra delphi mobile kullanmadım fakat ozamanlardan aklımda kalan; windows platformu hariç TXMLDocument componentinin diğer platformlara desteğinin olmaması.

peki ne tavsiye edersiniz json txt vb.?


Cvp: xmldocument veri okuma - SimaWB - 12-04-2018

(12-04-2018, Saat: 15:31)barisatalay Adlı Kullanıcıdan Alıntı: Merhabalar,

XE7 den sonra delphi mobile kullanmadım fakat ozamanlardan aklımda kalan; windows platformu hariç TXMLDocument componentinin diğer platformlara desteğinin olmaması.

Aslında yukarıda yazdım, Object Inspector'dan DOMVendor özelliği değiştirilerek kullanılabiliyormuş. Fakat bu sefer de ramazanayer'ın yazdığı gibi "loadfromurl not enable for non-windows platforms currently" imiş.
Aslında hata mesajı çok açık. O yüzden önce dosyayı lokale indirmek gerektiğini yazdım ama nedense ramazanayer bu mesajımı dikkate almadı sanırım Smile

TIdHttp kullanarak dosyayı istediğiniz bir yere indirebileceğiniz gibi bir Stream içine de atabilirsiniz.  
Ondan sonra XML işlemlerine kaldığınız yerden devam etmelisiniz.

Deneme yapmadan şöyle bir kod paylaşmak istiyorum; belki yol gösterir:
var
 ms: TMemoryStream;
 Http: TIdHttp;
 Url: string;
begin
 Url := 'http://ajansmanisa.com/cache/manset.xml';
 ms := TMemoryStream.Create;
 Http := := TIdHttp.Create(Nil);
 try
   Http.Request.Accept := 'text/xml, text/html, application/octet-stream'; 
   Http.Request.ContentType := 'text/xml';
   Http.Request.URL := Url;  
   Http.Request.Connection :=  Url;
   Http.Get(Url, ms);

   XML.LoadFromStream(ms);
 finally
   Http.Free;
   ms.Free;
 end;
end;