Did you know? #1 – 3 different ways to parse XML

WikiCommons

How to parse XML in 3 different ways using kbmMW Pro, Enterprise and Community Edition.

This is a post based on a public question on the NLDelphi.com forums.

Having the following XML, how do can it be parsed?

Into a list of TDef objects:

 

Method 1 – Basic XML parsing

We use the standard kbmMW DOM parser.

Method 2 – Using object notation

Notice there are many more dynamic ways to access the data using object notations than just this example.

Method 3 – Using object marshalling

This is by far the easiest way to parse the data, and also makes it very easy to generate XML from the objects again.

Notice that the TDef and TDefs class definitions has been augmented with a couple of attributes.

 9,533 total views,  1 views today

Author: kimbomadsen

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.