/*======================================================*\
FUNCTION: UserFeatXMLWrite
PURPOSE: Write a feature's element tree to an XML file.
\*===============================================*/
int UserFeatXMLWrite ()
{
ProFeature* feat;
ProElement elemtree;
ProError status;
wchar_t wFilename [PRO_FILE_NAME_SIZE];
ProSelection* sel;
int n_sel;
ProFileName MsgFile;
if (ProSelect("feature",1,NULL,NULL,NULL,NULL,&sel,&n_sel)!=PRO_TK_NO_ERROR||n_sel<1)
{
return (0);
}
ProSelectionModelitemGet(sel[0],(ProModelitem*)feat);
/*--------------------------------------------*\
Prompt for the filename
\*---------------------------------------------*/
ProStringToWstring(MsgFile,"HelpMessage.txt");
ProMessageDisplay (MsgFile, "USER Enter the XML file name:");
if (ProMessageStringRead (PRO_FILE_NAME_SIZE, wFilename) != PRO_TK_NO_ERROR)
return (0);
/*--------------------------------------------*\
Extract the element tree and convert it to XML
\*--------------------------------------------*/
status = ProFeatureElemtreeCreate (feat, &elemtree);
if ( status == PRO_TK_NO_ERROR )
{
status = ProElemtreeWrite (elemtree, PRO_ELEMTREE_XML, wFilename);
ProElementFree (&elemtree);
}
return status;
}