Visual Basic is an remarkably essential programming language and so it is truly worth deeper discussion and also explanation. Then again to be more accurate, Visual Basic just about the most widely used programming language in the world.
The most obvious basis for this success is because of in great part because of its simplicity, you can make basic effects like “Hello Word” in just a few lines of code instead of several thousand, its easy and does the job with minimum fuss as well as complexity.
The newest version of Visual Basic is Visual Basic 6, a bye product of Microsoft’s Visual Studio. Oddly enough Visual Basic offers no native support for XML, a really common and well known markup language but nevertheless, Visual Basic is now being regarded by a lot of developers as an effective option to work with XML.
Though VB gives you not any component or mechanism to read, write or generate xml, or even a data engine to help with or even operate with xml, you can find parsers (MSXML parser or Liquid XML Studio) that can be used to work with VB and XML given it exposes precisely the same interfaces in VB as in XML.
XML Parsers just like the Microsoft MSXML parser and Liquid XML Studio, do the job utilizing the DOM or Document Object Model. The DOM is constructed of five fundamental parts, attributes, documents, elements, nodes and nodelists.
Each of these contains their own unique programmatic interfaces (specifically, DOMDocument, IXMLDOMNode, IXMLDOMNodeList, IXMLDOMElement, and IXMLDOMattribute), each of which reveal a number of methods and properties.
As an example, the DOMDocument interface is for working with loading and saving of XML files (through . load, . loadXML-which transforms an XML structured string into an internal DOMDocument-and . save), and the IXMLDOMElement interface handles referencing attributes, content text, and element children, and supplies a starting point for generating XPath queries.
Xpath is the most preferred choice for XSLT users when attempting to select nodes with an xmltree. This ability to pull nodes out of an XML DOM is the primary reason that parsers are really popular, the MSXML parser can carry out Xpath queries which enables it to reference any nodes inside of an xmltree applying fairly complex queries.
XML is hierarchical by nature and so whilst it would seem simple enough to populate and represent XML as a tree, this is simply not always true in practice as you may not need to accomplish this, one example is you could want to bypass some braches or nodes.
In actual fact, you might simply want to generate a treeview structure that reveals exactly the most relevant nodes, you might also wish to be able to pick the nodes, causing more in-depth information to appear in the right hand pane of your application. This is usual for most Explorer-type applications.
One of the ways where you can accomplish that is to try to code the necessary performance that will expose your XML, straight into your program. Even so this isn’t ideal and may actually cost time and effort as you have to recompile your application any time you want to affect the display, worst still it means playing with heaps of ugly DOM code. Your best option would be to move the layout instructions to an XSLT stylesheet that may afterward style the xml data into a format ideal for processing.
As an alternative you may use any of the preferred xml vb parsers or if you’ll want to generate code from your XML, try Liquid XML Visual Basic to generate your VB code automatically.
Article Source: http://www.articleslash.net