winzip icon

XML Engine (classes and demo)

Email
Submitted on: 1/7/2015 11:36:00 AM
By: James Vincent Carnicelli (from psc cd)  
Level: Intermediate
User Rating: By 9 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages)
Views: 1063
 
     The XML Engine is a set of classes designed to make it easy for your programs to parse and construct XML.

The parser can be used either to automatically construct an easy-to-use data structure (like I.E.'s document object model) or direct your program (through events) to do what it needs to on the fly. This latter mode facilitates work on the data even as the XML is being incrementally received, as from a long file download. This means your program won't have to wait to start work and can avoid memory overruns associated with "passively" parsing huge XML files. This approach could even be used with an endless stream of XML, which would be great for quickly implementing a simple client/server communication protocol (search for my "Socket Controls" package here at PSC).

The XmlElement class, which represents a node in an XML tree, can be used independently of the engine. Your program can easily clone an XML tree, insert new branches anywhere, remove whole branches, and export it to raw XML or plain text (stripped of XML tags). The plain-text export can be given an array telling it what to replace certain tags with, too. An element node can be either a representation of a named tag (e.g., "TABLE") with named attributes or a text block (anything that would appear in-between tags).

A demo program is included with simple demonstrations of a number of basic techniques.

This engine does not deal with every last idiosyncracy of XML and assumes any XML it parses is well-formed. DTD's are not supported (not that they really relevant, here). But the basics of XML are supported. It can even be used as an HTML generator and parser, provided the HTML is XML-formatted (all start tags must have end tags or be single-tag formatted like "<SOMETAG/>").

Unfortunately, there is currently no documentation, but the code is straightforward and easy to read. Further, the demos should provide enough explanation for how to use the engine.

Your comments and votes are welcome.


 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 20 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.