Highlighted
Absent Member.
Absent Member.
347 views

[archive] XML Coding methods

[Migrated content. Thread originally posted on 07 June 2004]

I'm creating an XML file. To do it correctly I need to convert

> to <
& to &
so they are quoted correctly in the xml document.

Assuming I have a large character string (say pic x(5000) for example), what would be the best way to handle this, both for coding and performance?

Brad
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] XML Coding methods

The only way I know of to do this will be to create a new temporary storage area, and copy characters to it (using reference modification) one at a time. When you get to a character that needs translating, you would move the translated sequence to the temp area. Note that a search may allow you to move more than one character at a time, and would help performance significantly.

You might think of searching for these special characters from the end of the data item, and moving the trailing characters past where you need them, and continuing until you get to the beginning. But this is not a valid solution, because it requires moving the variable in a way that moves overlapping data. This is not something which works in a portable way, and should be avoided.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.