开发者

Parsing XML or JSON in Delphi Prism

I am trying to parse either XML or JSON (doesn't matter, the API I'm interested in provides both) in Delphi Prism but all Tutorials and Howto开发者_如何学运维s show the Delphi code which is no longer available in Prism.

Could you please help me?

(I'm not trying to compile Prism code from XML, I'm trying to parse XML in Prism ^^)


Pretty easy really. Make sure you have a framework version 3.5 and above version of a new project. Then you have two choices, if you have an XSD you can create classes from xml. You can do this with the XSD.EXE tool (/language:Oxygene). If you want to parse any xml, you can use the XDocument class defined in the System.Xml.Linq namespace:

var lDoc := new XDocument();
lDoc.Load(streamorfile);
var lAllTextValuesInNodeNameNodes := from x in lDoc.Elements where x.Name = 'nodename' select x.Value;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜