Monday, July 19, 2010

XML

XML
extensible Markup Language designed to transport & store data. XML document contains plain text wrapped in tags. It is like a plane text file with .xml extension.HTML & XML are totally differnt html is designed how to display data & xml how to stor data. XML seperates data from HTML.I most liked xml defination is "It is software & hardware independenet tool for carring information". Xml's advantages are it greatly simplifies data sharing, data transport, increases data availablity. Dont confuse xml with database. xml comes in the picture when data is not so complex, not large but plain text file are not enough to handle then you can go for xml.

Syntax Rules
-All XML elements must be closed.
-All xml elements must ne properly nested.
-Attribute values must be quoted.
-XML elements are case sensitive.

XML Parser
To manipulate xml document we need xml parser.xml parser reads xml document & covert it into the XML DOM object that can easily accessed with javascript. Most of the browsers have built-in xml parser.There are two types of xml parser tree-based & event-based. Event-based parser is faster than tree-based.

How to load xml document
- First get xmlHTTPReqest object
- open request
- send request to the server
- get respose from server

<script type="text/javascrit">
if(window.XMLHttpRequest)
{
xhtttp = new XMLHttpRequest; // mozilla
}
else
{
xhttp = new ActiveXObject("Microsoft.XMLHTTP"); // IE
}
xhttp.open("get","filename.xml",false);
xhttp.send("");
xmldoc = xhttp.resposnseXML;

document.getElementById("result").innerHTML = xmlDoc.getElementsByTagName("nameof tag in xmlfile")[0].childNodes[0].nodeValue;
<script>

XML DOM
Document Object Model defines a standard way for accessing & manipulating xml document. It provied all functions to create, delete, update xml elements.


PHP XML Parser
To manipulate xml document in php there are three ways to Expat Parser, SimpleXML Parser & XML DOM.
Expat is event-based parser & faster because it focus on the content of the document not its structure.

SimpleXML Parser is easy way to read change delete xml elements but when you want to deal advance xml then you have to decide other parser.
e.g.
$xml = simplexml_load_file("Filename.xml");
echo $xml->asXML;
OR
$xmldom = new domDocument;
$xmldom->load("Filename.xml");
$xmldom->saveXML();

Monday, July 5, 2010

Regular Expression


Solves a big problem in javascript specially because in javascript there are no built-in functions
for form validation. Then Regular Expression comes to help you. Main theme is when you want to check
a certain type of pattern say finding only digits or valid email address, then you have to write a
pattern in which all that condition must satisfy. you can check any pattern like validating email ID,
phone nos, credit cards nos, text, numbers. I thing regular expression used in many languages like java,
php, ruby, perl & more.
For more details "& example go to http://www.regular-expressions.info/

Thursday, July 1, 2010

TabIndex

It is used to set the focus on the HTML object when user uses tab key. When user pressed tab key then by default it starts from the top, but we want when user press tab key then focus must be given to particular text, buttton, link etc. Then use tabindex property.
&lt; input type="text" id="user" tabindex="1" />

Tuesday, June 29, 2010

Cascading Style Sheet Cascade

If you want to make sure a particual property must be fixed to a html tag, you nees add the !important property to the declaration.
 for e.g. P tag with color red is declared & dont want to change this color property at ant way. Then go for !imprtant
p
{
color : red !important
}
By this way prevent properties from changing value
p
{
color : blue;
}
&lt;p style="color : red">
Both above declaration cannot affect red color of the p tag


 


Monday, June 28, 2010

Posting blog via email

I am trying to post this blog by email. Lets see what happens

Wow This is posted.
Google tussi great ho
Amol.....
9595991644

Auto Refreshing Web Page

I want to see cricket match score on yahoo, i just logged on cricket page. I get what i want, but one thing i notice the page is refreshed after certain seconds. I was just thinking that how it has done. Finally i got my answer which is very simple.

<META http-equiv="REFRESH" content="5";>

Just including this tag in head section of html page, page will auto redirected after every 5 seconds.

<meta http-equiv="REFRESH" content="0;URL='filename.mp3'" >
By this way u can run background music. Instead of that i suggest use embed tag. Using embed tag we can run video files also.

Saturday, June 26, 2010

Drupal - Best Content Management System

I think drupal is better CMS than other like joomla. Drupal is very user friendly cms, it has many contributed modules(daily). With the help of this we can make a pwoerful website in a day. With adding new modules we can add more functionality to our site. & for this its not necessary to have good programming knowledge. Its open source free ware & what u expect yaar every thing is free...