XML – Glance

Standard

What is XML?

Some sample for XML data structure.

<?xml version=”1.0″ encoding=”ISO-8859-1″?>

 <moreovernews>

 <article id=”_11052107“>

  <url>http://c.moreover.com/click/here.pl?x11052105</url>

  <headline_text>Heavy rains flood southern Brazil</headline_text>

  <source>MSNBC</source>

  <media_type>text</media_type>

  <cluster>Brazil news</cluster>

  <tagline />

  <document_url>http://www.msnbc.com/news/contents.asp</document_url>

  <harvest_time>Oct 15 2000 2:38AM</harvest_time>

  <access_registration />

  <access_status />

   </article>

 <article id=”_11050007“>

  <url>http://c.moreover.com/click/here.pl?x11050005</url>

  <headline_text>Heavy rains kill six in southern Brazil</headline_text>

  <source>AP via New Jersey Online</source>

  <media_type>text</media_type>

  <cluster>Brazil news</cluster>

  <tagline />

  <document_url>http://www.nj.com/newsflash/index.ssf?/pages/newsflash-international.html</document_url>

  <harvest_time>Oct 14 2000 9:27PM</harvest_time>

  <access_registration />

  <access_status />

   </article>

</moreovernews> 

When I was started my career in Singapore late 1999, the environment was new, there was no much work, lot of leisure time,  So I was spent my time with ANG MO KIO National library  books. Occasionally, I have turned some XML books, I have read some interesting  story behind it.  I saw the phrases ‘computer laboratory, Military organization have used this language’. Suddenly, I have impressed with that books. Also strike in mind XML have good future and feature.

    Recent years, I have used XML with .NET as web.config (System.Configuration namespace give us ConfigurationSettings sealed class to read the values)  , machine.config, dataset schema, read and write XML to the dataset, web service data output (very useful to access disconnected mode DB data) and XML Data as document. [We can see now a days each and every vendors system in the market with own configuration file and simple data in XML file. If you are playing with Media software to hear the media files such as music and vedio. Those are keep and track by the system using XML data files. Data manipulation by the system so easy compare with olden days systems with own plain text files. Not only that avoid unnecessary issue to install the DBMS system in the client machine.] Many database new version implemented with XML functionality such XML data type (It is useful to keep and track data statistics in single column in yearly basis, monthly basis, old audited information… etc ). Also support XML result set from SQL using ‘For XML AUTO’ tag.

    Is XML the file? XML is stands for eXtensible Markup Language. In some other word XML is the markup language just like HTML, But HTML is diluted version of SGML (Standard Generalized Markup Language). XML is the predecessor of HTML.  Last few years only everybody talking about XML. HTML rendered by  browser, similar manner XML parsed by XML parser.

   Because we know HTML very well that’s what I am going to explain the XML compare with HTML. HTML is the tagged  language. Similar manner XML also tagged language. HTML elements are predefined, but it is not having any predefined tag to understand by any specific application like web browser except XML declaration and schema validation, users can use any number of tag and any descriptive word as tag depends upon their need. But we can format the XML file with other technology before display into the browser. XSLT is XML Style Transformation language one of the technologies uses to display the XML contents in the specified format. CSS also uses to format the display of the XML file.

 Purpose of the XML is store and transports the data in the text format. Because of the plain text format, it can be used with any kinds of software and hardware. That means XML is hardware and software independent technology. XML use as a data file, but does not have self-definition or self-validation for the data. But it can be achieved using DTD (Document type definition) or XML schema.

XML data file consists of ‘Element’ and ‘Attribute’. Element can have any number of attribute; similar manner element can have any number of child element. But file should have only one root element. All element tag should close properly with hierarchical order.  (<RootElement> <ParentElement AttributeName1=“Attribute1”  AttributeName2= “Attribute2”> <ChildElement> …..</ChildElement> </ParentElement> </RootElement>). XML tags are not case sensitive but the starting tag and closing tag of the elements should use same word with same case. We cannot use <, >, &, ‘ and “ characters directly with anywhere within the file , because it has been used to identify the XML data file structure. Instead of these we should use &lt; , &gt; , &amp; , &apos;  and &quot; respectively.

Here I have given some common words often used with XML.  This is useful to find more about XML in the Web.  I have gained this knowledge and used this in Viyasaka Technologies Pte Ltd (as freelance programmer) and HP ( Interface with Java web services to generated the XML files output in predifined XML schema using .Net clients)

1. Xml Serialization 2. Xml – Dataset  Relational : It is very useful when your playing with relational databases or like relational database model .  Why I am saying Like relational database? , dataset is the temporary database for the clients we can add, remove more than one tables, columns and records as datatable, datacolumn and datarow respectively. From the data set we can create XML file easiest way using DOT NET Technology. Here, I have given some methods related with dataset.@ ReadXMLSchema

@ ReadXML

@ WriteXMLSchema

@ WriteXml

3. XML Document – XmlNodeReader  (Block – Node –  Node Type  – Element)

This method is very useful when you are using file not like DATA TABLE TYPE, file with single element and attribute, just like configuration file. 

@ Using ‘Load’ method to load entire file into the new XML document.

@ Using SelectNode to read XMLNODELIST

@ Using XMLNODECOUNT find number of child nodes in the selected node

@ HasChild is return Boolean

@ From the XMLNODELIST find element (XMLNODETYPE)

# XmlNodeType.Commet

# XmlNodeType.DocumentType

# XmlNodeType.Element

# XmlNodeType.EndElement

# XmlNodeType.ProcessingInstruction

# XmlNodeType.XmlDeclaration

# XmlNodeType.Entity

# XmlNodeType.Whitespace

# XmlNodeType.Text

@ Read innertext of the NODE.

4. XMLTextReader – XMLTextWriter

 More than that Microsoft release new version XML for Application [every developer got worry now … need to learn this new technology soon. Recruiters will advertise the job requirement like experience with this technology not less than 5 years. No choice need to lie. Ha ha …Usually I will reply to this kind of advertisement simply, I know the technology but I have not used yet.] just insert ‘A’ inside the XML —> XAML.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s