xml

Validating XML Files With XML Schema Definitions In PHP

XML is a useful format for configuration, data storage, and transmitting data from one system to another. As a human readable format that can be easily read by machines it quickly gained favor in lots of different systems as a mechanism for data storage.

Many systems transparently make use of XML without the user ever seeing it. The API system SOAP is built around XML data, and it is normally possible to ask API endpoints to respond in either JSON or XML. It is common to see XML files used in configuration of systems as they can be easily edited and parsed when needed.

Some Essential WordPress Plugins

I know what you are thinking, but this isn't just another WordPress plugin blog post. I am asked every few weeks what WordPress plugins I would recommend, and I always end up giving a disjointed list of some from the top of my head. So instead of doing this I thought it would be a good idea to write down the plugins I use quite a bit and would recommend other to use. I will also try to add any alternatives (if they exist) to plugins I use.

Parsing XML with PHP

XML data extraction can be a common task, but to work directly with this data you need to understand how PHP parses XML. There are various different functions involved in parsing XML in PHP, all of which work together to extract data from a XML document. I will go through each of these functions and tie them together at the end.

xml_parser_create()

This function is used to create the parser object that will be used by the rest of the process. This object is used to store data and configuration options and is passed to each of the functions involved.

$xml_parser = xml_parser_create();

xml_set_element_handler()

Next we need to set up the functions that will be used in the parsing of the script. The xml_set_handler() method takes the following parameters:

Populating A TileList On Creation Complete Using XML In Flex

A TileList is part of a group of elements that allow you to add components in a specific order and orientation. The TileList controls the displaying of a number of items set out as tiles and so it best suited to displaying images as thumbnails.

There are many ways to do this, but none of the examples on the Flex site seemed to be very useful, or very well explained. What I wanted to do was to create a TileList that displayed the tiles in a certain way and used an XML file to fill up the list of items with images, each image having a label associated with it.

The first thing to do is to create the TileList element.

<mx:TileList id="imageTileList"
itemRenderer="CustomItemRenderer"
dataProvider="{theImages}"
width="200"
height="400"
columnCount="2"
creationComplete="initList();"/>

This contains three important attributes, which I have described here.