• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to work with XML data using System Events?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to work with XML data using System Events?


  • Subject: Re: How to work with XML data using System Events?
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 3 Nov 2005 17:48:00 -0500

On 11/3/05, has <email@hidden> wrote:
Important caveat: scraping XML data with regexes may be a popular approach amongst some folks, but it is a total cowboy hack and such solutions are very brittle and liable to break unless the XML data's structure is fairly simple and totally predictable, and its encoding known in advance. You'll always be far safer using a proper XML parser or a higher-level XML processing tool such as XPath, especially if you're not aware of all the pitfalls involved.

Absolutely.  Regular expressions are so called because they are inherently capable of parsing a set of languages called "regular languages".  XML is not a regular language; it, along with most programming languages, is part of a superset of regular languages called "context-free languages" which require more sophisticated computational models than that provided by regular expressions.

Modern regular _expression_ engines include features that make them more powerful than pure regular expressions, and with appropriate code written around the regexes you can perform some pretty impressive parsing tricks, but for XML it's much cleaner to go with an actual XML parsing engine instead.   Which is why even the XML parsing modules written for Perl usually go that route.

--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: AS, wIP and 10.4.3: nothing's changed...
  • Next by Date: Re: Records
  • Previous by thread: Re: How to work with XML data using System Events?
  • Next by thread: Re: How to work with XML data using System Events?
  • Index(es):
    • Date
    • Thread