Fog Creek Software
Discussion Board




VB and XML

A program I wrote in Visual Basic a while ago now needs to parse xml files. As I have never ever done anything in xml, I'm not sure what my options are.

This is what I would like: Load document from file into object, navigate with properties / methods returning nodes and stuff.

What are my options? Is there anything that goes so far as to create classes from a dtd (whatever that is) and instantiate a object hierarchy from a xml document  using those classes?

Daren Thomas
Monday, January 27, 2003

yep... microsoft's XML libraries (MSXML).

Joel Spolsky
Monday, January 27, 2003

Hm... busy, Joel?

Daren-  Yes, the MSXML library is what you're looking for.  A few notes on using it:

- MSXML comes free with IE6, so chances are good you've already got it on your PC.  For client distribution, it's available in a few different flavors.

- Specifically, you'll want to look at the DOMDocument* objects, which allow arbitrary navigation of your XML document with nodes, etc.

- XML DOM navigation is inherently slow.  I recently did a project that involved a lot of repeated arbitrary movement around a DOM tree structure.  Replacing the DOM code with a recursively-nested set of my own much lighter classes (created based on the contents of an XML document) doubled performance for my particular app, before I did any other optimization.

- XML technologies are pretty straightforward, with the extremely notable exception of XSL, which is an instant migraine.  O'Reilly has an XML pocket reference that should give you most of the information you need.  It's well worth the USD$13.

Sam Gray
Monday, January 27, 2003

If you will be doing heavy duty XML stuff, I would suggest

XML Spy ++, awesome tool.

http://www.xmlspy.com

Best,

Prakash S
Monday, January 27, 2003

I second XML Spy. I thought I could be a man and do it all in emacs, however my life with XML-schema really sucked until someone turned me onto XML spy. (and no, i'm not associated with the company.)

choppy
Monday, January 27, 2003

Another vote for XML Spy.  A very good tool.

Chad R. Millen
Tuesday, January 28, 2003

Another vote for XML spy. If you're stuck for cash, XML cooktop is pretty good and its free. (Can't remember URL. Use google or something).

http://www.vbxml.com is really good for tutorials.
So is http://www.w3schools.com .

If you get really stuck, post here or mail me.

Justin
Tuesday, January 28, 2003

Yup, XML Spy sucks not, neither does it blow.  If you use a DTD to define your document's structure, it'll fill in the required elements and attributes of tags as you go, in a very intellisense-like way.  VS.NET doesn't do that -- at least, not with DTDs.  Haven't tried it with XSDs.

Sam Gray
Wednesday, January 29, 2003

*  Recent Topics

*  Fog Creek Home