Friday 20 March 2015

XPath, XSLT, and other XML Specifications

The wonder in relation to xml is in its ease that means it's usually understood by so many varying systems and programs, through word processing software, printers, to other display devices.

This is done very affectively in xml as it splits the content from the structure typically an xsd or schema document will define the structure of the xml document and the xml document itself will incorporate the content.

The most important factors you need to understand about xml have been in its syntax, this will aid publish basic and affective xml. Essentially each and every xml tag should have a beginning and end tag or opening closing tag. The < means the opening / beginning tag and the /> denotes the end or closing tag.

When you comply with these proper xml rules, known as being well-formed, to be correct and grasped across systems, xml has to be well formed and correct.

The other specs to be aware of is Infoset, this specification sets out more detailed rules and properties for what comprises a well formed xml.

Namespaces are yet another spec to be familiar with for making valid or well formed xml, if you have a document with lots of different xml type vocabularies it can lead to errors in terms of reading or parsing your xml.

Namespaces enable you to specify distinctive element and attribute names via unique URIs which you control. So for instance, you could have a rather common attribute referred to as colour, you could potentially then utilize a namespace prefix like twt, so twt:colour, this might then make it unique from the namespace declaration.

You will also eventually, require the services of some sort of xml api, the main kinds of xml api are event based and tree based.

An event-based API attempts to formalize the XML parsing operation by defining event interfaces that processors may use to serve up the docs information items to the program as these are parsed.

A tree-based API, alternatively, specifies an in-memory object model that provides the XML documents logical structure, that is made available to the software after the document have been parsed and loaded.

You might have also come across SAX, or Simple API for XML, it is a rising in popularity among developers since it allows them to tap or hook directly into the parsing process itself.

The other tree based API is DOM, or Document Object Model, that is really the most generally industry recognized technique.

Moving forward let’s take a glance at XPath, another method of producing xml documents, it gets its identity from its usage of “path” notations to find their way the hierarchy of xml documents. The XPath language will depend on a tree representation of the XML document, and gives the cabability to navigate around the tree, selecting nodes by a variety of conditions. In popular use (though not in the established specification), an XPath expression is frequently described simply as "XPath".

Last but not least, let’s take a quick look at xslt and its usefulness to xml, the XSLT vocabulary is yet another XML language that outlines a declarative, rules-based language for indicating the modification process. XSLT builds upon XPath to specify which parts of the source XML document needs to be altered towards the target document. The subsequent XML code illustrates the framework of a simple XSLT style sheet.

To acquire more information and to see sample code, you may make reference to xml tutorials here.

No comments:

Post a Comment