Dim objDOM As New MSXML2.DOMDocument40
Dim objNode As MSXML2.IXMLDOMNode
Dim objChildNode As MSXML2.IXMLDOMNode
Dim objGrandChildNode As MSXML2.IXMLDOMNode
Dim objAttribute As MSXML2.IXMLDOMAttribute
Dim objElement As MSXML2.IXMLDOMElement
' Create the main xml node
Set objNode = objDOM.createNode(NODE_PROCESSING_INSTRUCTION, "xml", "")
objDOM.appendChild objNode
' Create the an attribute name is "name" and value is "nguyen"
Set objAttribute = objDOM.createAttribute("name")
' Set this attribute "name" to the value of "nguyen"
objAttribute.Text = "Jane Doe"
' Create the Parent Node - "Root"
Set objNode = objDOM.createNode(NODE_ELEMENT, "Root", "")
' Create a child node - "ChildofRoot"
Set objChildNode = objDOM.createNode(NODE_ELEMENT, "ChildofRoot", "")
' Set an IXMLDOMElement to set an attribute
' the "RootChild" node will house the attribute - "name" from above"
Set objElement = objChildNode
objElement.setAttributeNode objAttribute
Set objAttribute = Nothing
' Create a Grand Child Node - "GrandChildofRoot"
Set objGrandChildNode = objDOM.createNode(NODE_ELEMENT, "GrandChildofRoot", "")
' Set this node "GrandChildofRoot" to "TESTVALUE"
objGrandChildNode.Text = "TESTVALUE"
' Append "GrandChildofRoot" to "ChildofRoot"
objChildNode.appendChild objGrandChildNode
Set objGrandChildNode = Nothing
' Append "ChildofRoot" to "Root"
objNode.appendChild objChildNode
Set objChildNode = Nothing
' Append "Root" to the XML Dom Document
objDOM.appendChild objNode
Set objNode = Nothing
MsgBox objDOM.xml
Set objDOM = Nothing
creating a xml dcoument from database thr' code in vb6.0 & validating it against xsd using msxml4.0
everything working fine
the xml file is formed from the code / the data i get during runitme
when i validate it it gives me the validation results but it seems that the entire xml doument is in one line though the xml document tags appears in diferent lines
as when i validate it for multiple error it gives me every time line 1 but change in column no
i made the same file wth same data manually & validated it
in that i get the proper line no & column no
suppose the error is in line 10 i get line no 10 column no 5
but the file that is generated dynamically gives me error but taking the whole document as line 1
how do i recitfy it so that i get the proper line no
though it appears properly in the browser ie all the nodes, subnodes, elements appears propelry as needed
i checked the link but not help me
i hope my probelm is clear
just want to locate the excat error postion after xml validation code using sax parser
the xml creation is done using vb6.0 code in which all the tags appears as a single line when opened in text editor but in browser it appears properly . the nodes in the browser is indented
Apologies if I have misunderstood your question but your problem seems to be that VB6 XML will generate the file with all of the nodes in the second line of the file which is why your parser is always reporting the error on the same line.
If you add the fuctions listed in my previous post and then call the FormatXmlDocument fuction before saving the XML object then the output file will look like this.
With the file in this format the parser should generate the expected line numbers.
I haven't done a great deal of work with XML files but I had this problem a few months ago and the files that VB6 XML was originally generating were an absolute nightmare to edit in Notepad.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.