Perl Advent Calendar 2024

submited by
Style Pass
2024-12-09 23:00:15

XML was the preferred communication language used by services in the early 2000s. During that time, governments were establishing their own e-government systems, while companies were developing their SOAP services. Then, BOOM! Services began to adopt JSON because it was a lightweight and efficient alternative to XML. However, even though JSON became the new standard, old services were still in use and being maintained.Rewriting a system from scratch is not easy, and it might not even be necessary. That might be why XML is still in use, or perhaps governments and companies simply adopt the "as far as it goes" mindset. Who knows! Let's parse some XML and beat that services up!

Suppose we provide a service to manage internet access for a hotel’s guests. The hotel's property management system stores its guests in a file using XML. We need to read that file in order to check if the user is a guest of the hotel. In order to gain access to internet a user should type their id and wifi password correctly.

This file is located at hotelpms/guests.xml. To parse file we need to provide this file path to parsefile function, the library also has a function named parse. According to documentation if your job is with file you should use parsefile but if you want to parse a string that contains whole XML document then you could use parse.

Leave a Comment