Visual Basic is an exceedingly important programming language and thus it is worthy of further deliberation and also explanation. Nonetheless to be more exact, Visual Basic by far the most regularly used programming language in the world.
The most obvious reason for this success is due in great part due to the simplicity, you can create simple effects like “Hello Word” in just a few lines of code rather than several thousand, its simple and easy does the job with minimum fuss and complexity.
The latest variation of Visual Basic is Visual Basic 6, a bye product of Microsoft’s Visual Studio. Surprisingly Visual Basic features no native support for XML, a common and popular markup language but nonetheless, Visual Basic is now being regarded by a good number of coders as a good way to work with XML.
Despite the fact VB features absolutely no component or apparatus to read, write or make xml, or even a data engine to assist or even operate with xml, you will find parsers (MSXML parser or Liquid XML Studio) that you can use to work with VB and XML as it exposes the same interfaces in VB as with XML.
XML Parsers just like the Microsoft MSXML parser and Liquid XML Studio, do the job by using the DOM or Document Object Model. The DOM is constructed of 5 various essential pieces, attributes,documents, elements, nodes and nodelists.
Every one of these has got their own unique programmatic interfaces (specifically, DOMDocument, IXMLDOMNode, IXMLDOMNodeList, IXMLDOMElement, and IXMLDOMattribute), each of which reveal a number of methods and properties.
For instance, the DOMDocument interface is made for coping with loading and saving of XML files (through .load, .loadXML--which changes an XML structured string into an internal DOMDocument--and .save), and the IXMLDOMElement interface handles referencing attributes, content text, and element children, and offers a beginning point for generating XPath queries.
Xpath is regarded as the favored choice for XSLT users when trying to pick out nodes with an xmltree. This capability to pull nodes out of an XML DOM is the main reason that parsers are extremely popular, the MSXML parser can carry out Xpath queries which enables it to reference any nodes within an xmltree using rather complex queries.
XML is hierarchical by nature and so whilst it would appear easy enough to populate and represent XML as a tree, this isn't always the case in reality you may not need to accomplish this, by way of example you will prefer to bypass some braches or nodes.
In reality, you might simply want to develop a treeview structure that displays only the most relevant nodes, you might furthermore wish to be able to choose the nodes, causing more in depth information to appear in the right hand pane of your application. This is typical of most Explorer-type applications.
One way where you can achieve this is to code the desired functionality that will expose your XML, directly into your program. Even so this isn’t ideal and may actually cost time and effort because you must recompile your application every time you want to change the display, worst still it means fooling with heaps of unpleasant DOM code. The best option will be to move the layout instructions to an XSLT stylesheet which will subsequently style the xml data into a format well suited for processing.
Conversely you should use any of the preferred xml vb parsers or if you need to generate code from your XML, try Liquid XML Visual Basic to generate your VB code automatically.
No comments:
Post a Comment