1. hoai bao
  2. PowerBuilder
  3. Friday, 5 November 2021 07:18 AM UTC

Dear All

I have an issue that I need help with.
I want to convert a text(xml) to html text. how does it work in powerbuilder?

string example input

<tag_name>  root element<tag_name2 attribute="female"><name><emp_fname>Fran</emp_fname>  text content<emp_lname>Whitney</emp_lname></name><empty_element></empty_element>  empty element<another_empty_element/>  alternative notation</tag_name2></tag_name>

string need output

&lt;tag_name&gt;  root element
&lt;tag_name2 attribute=&quot;female&quot;&gt;
&lt;name&gt;
&lt;emp_fname&gt;Fran&lt;/emp_fname&gt;  text content
&lt;emp_lname&gt;Whitney&lt;/emp_lname&gt;
&lt;/name&gt;
&lt;empty_element&gt;&lt;/empty_element&gt;  empty element
&lt;another_empty_element/&gt;  alternative notation
&lt;/tag_name2&gt;
&lt;/tag_name&gt;

 

Thanks for all

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 5 November 2021 13:15 PM UTC
  2. PowerBuilder
  3. # 1

Hi Hoai;

   I'm not sure what your final goal is for the quality of the HTML is but the way I would attack this problem (from a simple conversation POV) would be to use a DataWindow. I would create an "External" DWO with the data elements you need plus the XML templateschema (if required) in the DW Painter. Then use the ImportFile() command to load the XML data. Then use the SaveAs() command to generate the HTML.

HTH

Regards ... Chris

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.