I am using the following code to generate a sample XML file:-

iXMLDocument = CMDXMLDocument::NewL();
CMDXMLElement* myElement = iXMLDocument->DocumentElement();
_LIT(KDeviceInfo, "Device Information");
TPtrC ptr(KDeviceInfo);
_LIT(KDeviceInfo1, "Device Information for E61");
TPtrC ptr1(KDeviceInfo1);

CMDXMLElement* nextElement = CMDXMLElement::NewL(ETrue, iXMLDocument, ptr);
TInt err1 = nextElement->SetAttributeL(ptr, ptr1);
err1 = myElement->AppendChild(nextElement);

// Code which when removed works..//
_LIT(KDeviceInfo2, "IMEI Number");
TPtrC ptr2(KDeviceInfo2);
_LIT(KDeviceInfo3, "01234567890");
TPtrC ptr3(KDeviceInfo3);
CMDXMLElement* nextElement1 = CMDXMLElement::NewL(EFalse, iXMLDocument, ptr2);
TInt err2 = nextElement->SetAttributeL(ptr2, ptr3);
err2 = myElement->AppendChild(nextElement);

CMDXMLComposer* myComposer = CMDXMLComposer::NewL(this);
_LIT(KFileName, "c:\\Logs\\UCA\\myXML.xml");
TBuf<100> fileName;

RFs fileSession;
myComposer->ComposeFile(fileSession, fileName, iXMLDocument, EUtf8);
TInt err = myComposer->Error();

I dont get any errors...and i get a callback in ComposeFileCompleteL as well..but the thing is my XML file doesnt have any content in it.

When i remove the code where is says "code when removed works"..i get the output like this..:-

<?xml version="1.0" ?>
<!DOCTYPE smil SYSTEM "mms_smil.dtd">
<Device Information Device Information="Device Information for E61"/>

Which is far from how a XML file should look like...

Can someone please correct me where I am going wrong..?

Also the other doubt i have is that it appends mms in the xml header..and also the classes i am using seems to be coming from "Using Messaging XML support (GMXML)"...so i am wondering if these are not the classes that i should be using to generate an xml file..please guide me to the correct classes if thats the case.

i am targetting Series60 3rd Edition..based on Symbian 9.1