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!

DOM interfaces XML

Status
Not open for further replies.

Sun

Programmer
Aug 13, 1999
37
IN
Help will be appreciated very very much.

What I am doing is retrieving objects and collecting the properties of those objects I am forming an XML String.
The XML Structure looks somewhat like this

<Root>
<Child>
<GrandChild>
<GrandChild>
<GrandChild>
.
.
<Child>
<GrandChild>
<GrandChild>
<GrandChild>
.
.
<Child>
.
.
<Root>

Now the problem comes when there are 1000 <Child> Tags and each child has about 17-25 <GrandChild> Tags.

Forming an XML String of so many Tags Takes a lot of time and also eats Quite a lot of Memory.

This is What I am Doing :

for ( int i=0; i < 2000; i++ )
{
IXMLDOMDocumentPtr domDoc(__uuidof(MSXML::DOMDocument));
domDoc.CreateNode(.., &domNode);
domDoc.appendChild(&domNode ,...)
domNode.QueryInterface(...., &domElement);
domElement.setAttribute(..)
domElement.setAttribute(..)
domElement.setAttribute(..)
domElement.setAttribute(..)
CreateGrandChildren(domDoc, domNode);

CComBSTR bstrXMLString;
domDoc.get_xml(&(bstrXMLString.m_str));
}

CreateGrandChildren(IXMLDOMDocumentPtr& domDoc, IXMLDOMNodePtr& domNode)
{
IXMLDOMNode domGChild;
IXMLDOMElement domGCElem;

for ( int i = 0; i < 20; i++)
{
domDoc.CreateNode(..., domGChild);
domNode.InsertBefore(domGChild, .., ..);
domGChild.QueryInterface(.., &domGCElem);
domGCElem.setAttribute(..);
domGCElem.setAttribute(..);
domGCElem.setAttribute(..);
domGCElem.setAttribute(..);
}
}


Can i speed up things by using some other method.
Please help me in this.

Thanx a lot.

Regards
Sun.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top