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.

Saturday, 14 February 2015

Presentation of XML Namespaces

An XML Namespace is the tool which can be used to identify and outline xml elements, this makes it much better to perform around various systems by having a global standard such as the “namespace”.

As much as xml is extensible, ie it could be expanded and employed in a wide range of methods, if you don't follow a set standard for the namespace you can not really implement xml without experiencing conflicts.

This is pretty self evident as you can not use various kinds of data using completely different namespaces, the format needs to be consistent in order that it can be understood and viewed through different programs and systems.

XML requirements are supervised by the W3C who usually write and control the xml specifications, additionally they specify a standard for the namespace by means of their namespace recommendations.

These types of guidelines incorporate things such as Name conflicts in XML can easily be prevented with a name prefix. So for example you have an xml file with a variety of tables, you may prevent conflicts issues by having unique prefixes for each and every table, like a a:table or b:table etc.

When making use of prefixes in XML, a so-called namespace for the prefix must be described, the namespace is defined by the xmlns attribute in the start tag of an element. The namespace declaration has the following syntax. xmlns:prefix="URI".

When a namespace is defined for an element, every child elements with the exact same prefix are linked to the same namespace. Namespaces may be declared in the elements where they are utilized or in the XML root element.

As said previously, xml is extensible, there is no semantic meaning and you may produce your own tags, having said that clearly unless you follow a recognized format or process then clashes can arise, and again having a prefix can remedy this.

The prefix unambiguously identifies the type of rating on this document. Nevertheless prefixes by themselves take care of practically nothing simply because anybody can create prefixes. Therefore, different people can create mismatched prefixes and we're back to step one: we've move the risk of conflicts from element names to prefixes. To prevent conflicts in prefixes, the prefixes must be declared.

This assertion usually follows the format of a URI, or Uniform Resource Identifier with a prefix as shown above, this is due to URI are in fact wholly unique whereas names or tags are not.

The prefix moreover, the full URI definition are certainly not interchangeable as URI’s can contain characters that are illegal in an XML namespace. It is also against the law to utilize the 3 letters XML in any event arrangement for a namespace prefix for the reason that are set aside.

Let's hope it's gone someway to provide the very idea of namespaces however I passionately advocate even more reading about this matter, a great deal of info is available on XML for many who wish to find out. For the definitive guide, visit W3.org or the W3C website.

Or for more complex readers, you'll find namespace tutorials with actual namespace examples here, http://www.liquid-technologies.com/Tutorials.aspx

Saturday, 17 January 2015

XML DTDs Compared to XML Schema

XML is great for holding and communicating data between diverse systems along with browsers, it is completely platform independent this also makes it well suited for storing and transporting data across the internet.

By the use of an example concerning how adaptable and extremely versatile XML is, you are able to connect with web services by using say a Microsoft .net framework using a UNIX system written in C. However, in order for it to work you require a blueprint that will explain to both systems, the construction of the xml data or document, typically this is by way of some kind of schema or dtd.

The schema or dtd will probably specify the composition or layout of the xml file so that it can easily be read or parsed with the receiving system, eventually xml is a meta language so can not accomplish this specific function on it's own.

There's two main advantages to this, the first is that this means that your data will make it beyond the parsing phase as the construction has already been agreed and that helps you to get rid of any data that is not supposed to be there. The second thing is, it’s simpler for developers to understand what can be obtained as the protocol standard is documented.


About DTD, Document Type Definition

DTD is short for document type definition and as previously stated, the a means of telling other systems design and makeup of the xml file, in order for the acquiring system knows what to expect and thus it can easily interrogate the acquired xml data to verify that what is received is actually what is expected.

For example, the dtd will specify the elements which are being contained in the document and the attributes of the elements, as well as the ordering and nesting of those elements.

The dtd is called in or bundled by a development expression known as “declared”, the dtd is declared using what known as a DOCTYPE declaration beneath the XML declaration inside the xml document.

The dtd can be included inline or externally, inline as the name signifies is inside the xml document itself, in contrast to an external is outside of the xml document.

You will find advantages and drawbacks to both methods however inline is better should your documents are going to be saved and made use of offline.


About XML Schemas

Xml schemas are an advancement around the dtd method and for that reason widely thought to be a greater and a lot more potent method, in actual fact schemas also are xml files with their own DTD and do the job by referencing the XML Schema Namespace

XML Schemas supply a group of basic types, they include most basic computer programming types such as integer, byte, string and floating point numbers, but they also expand into Internet data types which include ISO country and language codes (en-GB for example).

The author of an XML Schema then uses these core types, along with various operators and modifiers, to create complex types of their own. These complex types are then used to define an element in the XML Document.

Tuesday, 23 December 2014

The features as well as benefits of XHTML

XHTML represents Extensible HyperText Markup Language, and its in fact an evolution based upon normal HTML, it’s purpose was also intended as a path in the direction of inevitable XML migration hence the X component.

For this reason XHTML will be displayed as a hybrid of HTML and XML.

Part of the XML family of mark-up languages XHTML docs are well formed because of the mark-up rules and tag rules and so can also be parsed by XML parsers, which is in contrast to HTML which was at all times part of the Standard Generalized Markup Language (SGML).

Before examining the benefits associated with XHTML, its worth quickly explaining the intention of SGML, HTML and XML.

SGML is a language for describing markup languages, specially those employed in electronic document exchange, document management, and document publishing. HTML is an illustration of a language defined in SGML.

HTML is an SGML (Standard Generalized Markup Language) application conforming to International Standard ISO 8879. HTML is generally regarded as the common publishing vocabulary of the World Wide Web, HTML tags hold semantic meaning and are predefined.

XML is the shorthand name for EXtensible Markup Language. XML is a markup language just like HTML and was meant to identify information. XML tags usually are not predefined. You will need to define your own tags based on your needs.

In terms of syntax, it’s very much like HTML and pretty much all valid HTML elements are also valid in XHTML, however there are numerous particular points to note to ensure your HTML document is absolutely XHTML certified, these points also apply when generating new XHTML documents.

•    You must compose a DOCTYPE declaration at the beginning of the XHTML document.
•    You should generate all XHTML tags and attributes in lower case only.
•    You have to quote every one of the attribute values.
•    Attribute minimization is not allowed.
•    The id attribute swaps with the name attribute.
•    The language attribute of the script tag is deprecated.

So right now let’s explore the characteristics of XHTML before we look at the actual positive aspects.

Firstly, XHTML is an recognized and official W3C standard which means that all internet browsers will be compliant, and has built-in support for XHTML, this can be of serious appeal to web developers.

A valid XHTML document, mainly because it utilises XML syntax and markup, needs to have 1 of 3 DTD’s, this ensures that all the XML data comprised within the XHTML is valid and also conforms to the proper logic and type as outlined in the DTD such as adequately closed and nested xml tags.

Finally, XHTML files may also be backward suitable for non XHTML compliant internet explorer due to stricter syntax rules.

This affords the benefits that follow;

Internet pages are more inclined to render perfectly around a number of browsers such as new and old web browsers.

It's also easier to preserve, edit, convert and format your file as the need comes up, in the future.

As a result of consistent and perfectly structured format of XHTML, your online pages may be parsed and processed effortlessly.

XHTML specifies quality standard to your internet sites and if you go along with that, then your web pages are counted as quality web pages. The W3C confirms those pages using their quality seal of approval.

Sunday, 16 November 2014

XML DTDs Versus XML Schema

XML, short for eXtensible Markup Language, is a markup language that helps you communicate files between diverse systems, web browsers and also software without blunders or compatibility problems.

For instance, XML permits you to manage to send out data between unix along with windows type systems for example web services based upon Microsoft’s .net architecture. But it’s imperative that you stress that XML is a mark-up language rather than a programming language, so XML isn't going to by itself function commands, it's just a meta language which transmits data in a methodized file format.

Additionally the exchange to work the data has to be in a composition that's agreed by both devices ie the sender as well as the recipient, otherwise the exchange won't work as well as the recipient system will return a mistake as a result of invalid data, typically this is regarded as a parsing error.

There are a selection of ways for which you can indicate the structure of your XML data, the 2 main options are an XML Schema or a DTD file.

A DTD, Document Type Definition, is a set of markup declarations that comprise a document type for an SGML-family markup language (SGML, XML, HTML). A Document Type Definition (DTD) describes the legal constructing blocks of an XML document.

It describes the document composition with a listing of legal elements and attributes. DTD is also the original standard, outlined within the W3C's XML standard. The DTD standard is all but obsolete currently, replaced by the W3C's XSD standard.

The DTD is asserted in a DOCTYPE declaration under the XML declaration contained within an XML document:

The actual body of the DTD itself incorporates definitions concerning elements and their attributes.

One other technique is referred to as an XML Schema, that is a more robust approach to determine your xml document framework.

An XML schema definition language is generally an instrument for creating schemas. A schema really is a file suitable for denoting the structure, content and semantics related with an XML document. Many schema definition languages are available for use. The DTD (or Document Type Definition) language appeared to be quite popular with the XML community although has mainly been obsolete by XSD (or XML Schema Definition) language.

XSD is usually recommended and also conserved via the web standards body, W3C. As opposed to DTD, XSD is definitely itself coded in XML (that is why, extensible), contains support for data-types as well as namespaces and is usually far more extensive.

An XML schema describes the elements along with attributes which go into the XML doc, their data-types and default values (if any). It describes which elements are child elements, the order and also the volume of them. Moreover it identifies whether or not an element is empty or could include written text. An XML file isn't required to possess a schema declaration however, when one is supplied it will probably be utilized to validate the XML document against the above requirements.

Saturday, 25 October 2014

XML and the future of technical writing

XML had been originally released to address some of the constraints with HTML in moving and storing data on web pages and also over the web. However as the technology grew to become more widely adopted and used, other ways to use XML emerged, due to the flexibility and versatility.

In particular, XML has flourished in publishing and in technical documents and technical writing, this is because XML tags aren't semantic as opposed to HTML tags are, this means you may produce your own tags for whatever objective you like, this really is ideal in technical writing.

So not only is XML increasingly being extensively implemented within technical writing however it looks set for being the future of technical writing as well as documentation online.

There are a variety of essential reasons over the above which are driving this particular future.

The most significant is the demand to publish once without the need to publish many times for many different devices, platforms, formats and the like. This is certainly one of XML’s key strengths since it is not fixed or tied to any platform, browser, device etc, what this means is XML is certain to be readable on nearly anything.

On top of this, you may connect CSS style sheets in your XML data to style up your documents or content any way you like, this offers a lot more flexibility for web publishers along with coders as well, which means you can actually show your content precisely how you desire it to appear across pretty much any viewing configuration ie Mac or PC, tablet or laptop, or mobile phone, or Android or Apple or IE9 or Firefox, this is certainly hugely powerful, and simply no other solution comes anywhere near delivering these kinds of compatibility and versatility.

Another factor to consider, that is tightly connected to the first, as it originates from the benefit of being able to publish just once, is the cost saving related to having the ability to just publish once. For sizeable publishers with dedicated specialists teams for print and web, the financial savings may very well be considerable.

No longer will they need to double up on employees and resources to have one team to write in print and yet another to create online on websites, the same content material can be used for both, attainable due to flexibility of XML.

Your able to use just about any plain text editor including notepad or even a specific XML editor to generate your XML files, to create XML documents for publishing you can use Adobe FrameMaker and have it set to structured mode.

Adobe describe their FrameMaker software as “ a complete solution for authoring, enriching, managing, and publishing technical documentation. Author with best-in-class XML/DITA and DTD support. Manage content using out-of-the-box integration with leading content management systems and Dropbox. Collaborate with PDF-based reviews, even on mobile devices. Easily publish to multiple channels, formats, and screens natively from within FrameMaker 12 at no extra cost, without any plug-ins.”

As superb as Adobe FrameMaker is, a dedicated XML Editor can offer superb adaptability for working with xml with superior editors offering xml schema editors and even validation for your xml and schema, this enables you to produce xml code more quickly along with minimum blunders.

Wednesday, 17 September 2014

Encrypting XML Data

If you utilize xml and have xml data you need to understand that must be quite possible to have xml encrypted, actually the W3C, the body given the task of handling and also developing the xml standard have a standard for xml encryption.

The process involves encrypting an xml as well as child elements and after that swapping out the original content with the subsequent encrypted xml, whilst ensuring that the documents remains to be valid and well formed from an xml perspective.

With regards to the encryption itself, you will have three choices, symmetric encryption, a mixture of asymmetric and symmetric encryption and thirdly, X.509 Certificate encryption.

The 1st way, symmetric encryption is where you operate the same key to encrypt and decrypt the xml, the key should be stored securely and loaded during the time of use as the key is not kept with the file, care is required to be taken that the key is not jeopardized.

Accomplishing this itself involves replacing the xm content (elements) with an encrypted tag i.e. <EncryptedData>, this will likely contain the encrypted elements.

The second option, utilizing a combination symmetric and asymmetric conversion, the symmetric key is employed to encrypt the xml data while an asymmetric key is employed to encrypt the symmetric key itself. The asymmetric key works with a public and private key, a public key to encrypt the key as well as a private key to decrypt the key. Both symmetric and asymmetric keys are held and saved in the xml record itself.

Doing this itself is rather simple assuming you have a basic programming background and includes creating a CspParameters object and indicating the name of the key container then creating a symmetric key making use of the RSACryptoServiceProvider class.

The third method is make use of X.509 certificates through third party vendors for example VeriSign therefore called X.509 Certificate Encryption, the procedure works as follows.

The xml data is encrypting using two keys. A test X.509 certificate is created by using a Certificate creation tool (Makecert.exe) and this created certificate is stashed into a “certificate store”. The certificate will then be programmatically recovered and used to encrypt an XML element making use of the standard Encypt method ie <EncryptedData> element. Internally, the Encrypt method produces a separate session key and makes use of it to encrypt the XML document. This procedure encrypts the session key and saves it in addition to the encrypted XML inside of a new <EncryptedData> element.

Regardless which process you decide on, it’s imperative that you point out that your encrypted data can be held in two different methods, alternative one you are able to switch your entire element with all the encrypted clement <EncryptedData>, or alternative two only the data in the element is substituted with <EncryptedData>.

Even though on face value their may well not seem like a tremendous amount of difference between the two, nothing might be further from the truth, while using the first approach might be a costly blunder if for example you wanted to encrypt data and read the child elements later on, in such a case option 2 would be better as you may still read the attributes for example.

Whenever using xml feel free to use just about any text editor for instance notepad, nonetheless commercial and free xml editors can be found which help you to generate semantically correct xml whilst providing a great many superior benefits for the more regular xml developers. A extensive listing of xml editors can be found at http://www.xml-editor.info