Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Use XML to Build Services Cheaply Using PHP and MySQL : Page 4

Using the open source technologies of PHP and MySQL you can create server-side applications that abstract databases and return XML. Get all the flexibility of XML without laying out cash, and show your boss a cheap alternative to J2EE or .NET Web services in a runtime environment.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Step 3. XML Document Structure
Now that the blocks have been downloaded and installed, it is time to build the PHP application. But first I need to describe the taxonomy of the data that this application is built to return, as it is optimized for size.

Any recordset is based upon a table or number of tables, and contains a number of indices that are used to uniquely identify the data points. To represent this in XML, it is most efficient to use a structure as below:

<record index1=something index2=something index3=something> </record>

This way, the index values aren't replicated in the record items, and, they are also separated from the record items for easier reading.

The record items can then be children of the <record> tag as follows:

<record index1=something index2=something index3=something> <column1>column1_value</column1> <column2>column2_value</column2> . . <column>columnN_value</column> </record>

The only problem is that if you have a large number of records, or a large number of columns, your XML document will grow very large, affecting the speed of the server to generate it; the speed of the network to transport it, and the speed of the client to render it.

Therefore, we can design the document to be more efficient for all three by changing its structure. The code below optimizes the XML record structure.

<record index1='something' index2='something'> <item column1='column1_value' column2='column2_value' />>

This change in XML structure means that large recordsets will be a fraction of the size they would be in the traditional way, as above.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date