Updating xml using vb6

This excerpt is taken from No Nonsense XML Web Development with PHP, Site Point’s new release, by Thomas Myer, which was designed to help you start using XML to build intelligent ‘Future-Proof’ PHP applications today.The title contains over 350 pages of XML and PHP goodies. NET If you're creating an XML document and want to write code that you'll actually be able to maintain … NET Framework includes multiple tools for generating XML documents, but the tools suffer from one failing: If the XML document is at all complicated then it's difficult to write code that's easy to read, easy to understand, and easy to modify or extend as requirements change.

As requirements change and you need to alter the document, you're often reduced to altering the code and then running it to find out what the resulting document looks like.

There's a tool for creating complex XML documents that does give you readable, easily maintainable code: XML Literals.

' 'but it should be clear how to modify the code 'to create your own documents Private Sub Create_XML() Dim obj Dom As DOMDocument Dim obj Root Elem As IXMLDOMElement Dim obj Member Elem As IXMLDOMElement Dim obj Member Rel As IXMLDOMAttribute Dim obj Member Name As IXMLDOMElement Set obj Dom = New DOMDocument ' Creates root element Set obj Root Elem = obj Dom.create Element("Family") obj Dom.append Child obj Root Elem ' Creates Member element Set obj Member Elem = obj Dom.create Element("Member") obj Root Elem.append Child obj Member Elem ' Creates Attribute to the Member Element Set obj Member Rel = obj Dom.create Attribute("Relationship") obj Member Value = "Father" obj Member Attribute Node obj Member Rel ' Create element under Member element, and ' gives value "some guy" Set obj Member Name = obj Dom.create Element("Name") obj Member Elem.append Child obj Member Name obj Member Name.

In this chapter, we’ll cover the basics of XML – essentially, most of the information you’ll need to know to get a handle on this exciting technology.

Second, as you'll see, there isn't much Visual Basic code required: Most of what goes into your code looks like XML rather than Visual Basic.

Finally, while XML Literals are Visual Basic-specific, the XElement that you'll create in this code is completely interoperable.After we’re done exploring some terminology and examples, we’ll jump right in and start working with XML documents.Then, we’ll spend some time starting the project we’ll develop through the course of this book: building an XML-powered content management system.Then you'll see how other objects, including the Xml Node and Xml Document objects, provide a more structured view of an XML file.I'll work with a very simple XML file named that represents three books a computer bookstore might stock. Add(str Node) End While End If End If Loop ' Clean up xtr.Node Value = "Attrib value" Attribute Node rel 'Save the XML file XDoc.

Tags: , ,