Monday 15 October 2012

XML Elements And Ways To Develop Them

Elements are also the key building blocks of XML and is also one of several benefits XML provides over other languages. In XML you may create your very own element tags to match your own requirements.

With other languages, like HTML or PHP, you can just use predetermined labels which are particular to that language. In HTML by way of example you are only have body elements within the <body> tag and header elements inside the <head> tag. This is certainly tough and even time intensive and means you need to comprehend the language and syntax as well as where it goes to create web pages.

This is where XML is special, you can make your own personal elements and title these to suit your own purposes, allowing it to be entirely possible for newbie’s to grasp and apply XML.

So what are XML elements? Pretty much elements are names that are assigned to areas of data or information. As an example, let’s say you want to develop a catalogue of all your household items for insurance applications.

You could potentially try to portion items by room after which further sub divide by value etc. In XML the parser will look at the construction compared to names of the elements, in HTML it will be the other way round, the labels will be more significant for the parsing to be successful.

While XML is a lot more focused on structure, versus naming conventions, you'll still have to comply with some fundamental guidelines when creating elements. The first element is considered as the root; the root element consists of all the other elements inside it, similar to a folder contains sub folders and files.

After the root, the following element is called the parent and inside the parent are child elements, not all parent elements have to have child element, it will be at your discretion and is determined by how and just what you want to design your XML for.

The key point to creating a XML file that can be easily parsed is with the organisation, you need to make your elements to make sure they appear sensible from a structural perspective.

For example if you're a constructing a stock list of your products, it might make more sense to have products as your root element and then the categories as the parent and then individual category products as the child elements.

Having a well laid and common sense structure is going to pay off in the long term when you need to handle updates or parsing as all the elements will naturally fit into place.

Along with element structure and naming, its also wise to keep the following easy tips in mind too.

Each and every element tag requires a opening and closing syntax ie <xml> and </xml>, if you forget you will receive an error message whenever you try and validate or parse your xml file.

Be sure you organize your element names intelligently and rationally. Name your tags in a means by which is smart to you.

Root element

Parent element

Child element

Two parent elements for the product stock list could have child tags named ‹product›. In fact, parent names may also be the same.

Product - root element

Item - parent element

Item - parent element

So that’s a rapid and straightforward look at xml and how to write an xml file, to study more advanced material, you can search Google or view this xml tutorial.









Wednesday 3 October 2012

9 Very Important Terminology In XML

In contrast to the popular myth about XML, it's not actually a development language, it is a mark-up language, and as a result, essentially the most least complicated computer language around.

XML is really a non semantic language therefore, you can develop your own element tags and in contrast to other languages there isn't any real complex syntax structures to think about.

Given it isn’t a programming language, XML itself doesn’t really do anything, by design, it’s really a storage container for data and so it only comes up as very simple text on web pages or as a text file.

You can also utilize XML to properly exhibit pages around distinct internet browsers and version types, to do this you have to compose different formatting directions, known as DTD.s or Schemas.

Dealing with XML and building basic files is really rather simple if you can learn the basic principles, below is a glance at 9 of the most well-known XML words that you may run into.



 
1.    XML (Extensible Mark-up Language

As already stated, xml is a markup language that works as a container for the holding of data and allows data and information to be transported and displayed on the online as webpages. Within XML their can also be subsets of languages including XSL which supports in validation and formatting.


2.    Element Tags

You may make as well as name your element tags as you desire as well as suit your own specific requirements. Element tags enable you to build a hierarchical syntax and order to your code.

By way of example, let’s say you wished to have a stock list of your stock items for your ecommerce bike shop website, you can use key tag names like product, and also within the product tag element, you can have child elements like men’s bikes, women’s, child bikes etc.

The beauty and simpleness of XML is in its ability to build your own element tags, just be sure you close them.

<product> - element tag

</product> - closing tag



 

3.    Declaration Statement

The declaration statement ought to be at the beginning of your xml file, the aim of the declaration statement is to specify the language, version as well as designate encoding and declare the standalone status of the file, without it the Internet processor will not be able to determine the code.

<xml version="1.0" encoding="UTF-8" standalone="yes">


4.    Root Element

The root element, like the title indicates is the very first named tag of every XML file and it's a container for all other elements, consequently it is in the root.

<products> - root element


5.    Parent Element

The parent tag retains elements linked to the root, and so within our example of products, the parent would be the associated categories or products.

<products> - parent element

<mens bike> - element tag


6.    Child Element

The child element is so called, given it belongs to the parent element and thus, is situated inside it.

<products> - root/parent element

<mens bike> - parent element

<cube bike> - child element

 
7.    Attributes
An attribute is a name or value that sits within the element tag, in our example an attribute could be frame size of the bike or the colour style.

<cube bike size="20"> - cube bike is the element and size is the attribute


8.    Comments
Comments will be only viewable in the source and are generally mostly for editors and authors who want to update or customize the xml file, comments are not exposed on a webpage

<!--this is a comment -->


 
9.    Data Strings

A data string will be the complete opposite of a comment in that it is viewable on the webpage, a data string in this context is the equivalent of the description field.

<description> - element tag

Extensive range of cube bikes available. - data string viewable on a webpage

</description> - closing tag

So that’s an easy and easy look at xml and the best way to create an xml file, to study more advanced material, you can search Google or check out this xml tutorial.