Modify XML panels with CONTROL

Find and share HowTos to various installations / configurations!
2 posts • Page 1 of 1
buec
Posts:28
Joined: Tue Dec 07, 2010 3:09 pm

Modify XML panels with CONTROL

Post by buec »

I have to modify XML panels with CONTROL. When I save the panels with fputs, the line endings are changed from LF to CR/LF. When I use xmlDocumentToFile, the line endings are preserved as LF but empty XML elements are shortened.

Variant 1:

Code: Select all

fileToString( sPath, sFileData );
// replace icon path in sFileDate
file f = fopen( sPath, "w+" );
fputs( sFileData, f );
fclose( f );
Line endings are changed from LF to CR/LF

Variant 2:

Code: Select all

fileToString( sPath, sFileData );
// replace icon path in sFileDate
int iDocId = xmlDocumentFromString( sFileData, errMsg, errLine, errColumn );
xmlDocumentToFile( iDocId, sPath );
Empty XML elements are shortened. Example:
Gedi: <prop name="Value"></prop>
CTRL: <prop name="Value"/>

Any idea how I can save XML panels in the same formatting as the Gedi does?

WinCC OA 3.16 P015 Windows

Best regards
Christoph

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Modify XML panels with CONTROL

Post by leoknipp »

In the past I have modified XML panels using CTRL scripts using fileToString() to read the file and fputs() to save the file.
The panels were working afterwards and I did not see a problem when editing/opening them again in WinCC OA.

Best Regards
Leopold Knipp
Senior Support Specialist

2 posts • Page 1 of 1