Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML and Visual basic

Status
Not open for further replies.

jcsilva

Programmer
Aug 17, 2002
6
MX
Hi there,
I have a little application in VB 6. Iam trying to create a XML file and assign the DTD to validate this xml file.
My code is this:

Private Sub cmdCreateXMLFile_Click()
Dim xml As MSXML2.DOMDocument
Dim root As IXMLDOMNode
Dim tmpNode As IXMLDOMNode
Dim tmpAttr As IXMLDOMAttribute
Dim tmpProcessingInstruction As IXMLDOMProcessingInstruction


Set xml = New MSXML2.DOMDocument
Set tmpProcessingInstruction = xml.createProcessingInstruction("xml", "version=""1.0"" encoding=""UTF-8""")
Set root = xml.createNode(NODE_ELEMENT, "rootNode", "")
xml.insertBefore tmpProcessingInstruction, xml.childNodes.Item(0)

Set tmpNode = xml.createNode(NODE_ELEMENT, "Node01", "")
tmpNode.appendChild xml.createTextNode("2800101")
root.appendChild tmpNode

............
............

End Sub

Here no problem, but I need to add this line :
<!DOCTYPE rootNode SYSTEM &quot;mydtdfile.dtd&quot;> to the DOM tree. I have been read about this and I found that some properties referent to the Doctype are read only.

I want to create a XML file like this:

Code:
<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>
<!DOCTYPE Replica SYSTEM &quot;mydtdfile.dtd&quot;>
<rootNode>
..
..
..
</rootNode>


This file is created with a VB application, then it will be read by other VB application, so this application will validate the XML file with the mydtdfile.dtd. You must assume that the second application have the DTD file to validate the XML file.

Someone can help me? or have other suggestion?

What about Schemas and VB?

Thanks in advance,

JCarlos Silva
jcarlos@intelimedic.com




________________________________
Juan Carlos Silva
Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top