xml - 如何设置代码页以导出 xml 文件离子进度 4gl
问题描述
在生成xml的情况下,我想在命令中生成文件时定义utf-16代码页:
hDoc: SAVE ("file", "c: \ tmp \ lantek.xml"). (export to utf-16)
解决方案
您将需要使用已修复其代码页的中间 longchar 变量。
def var hxdoc as handle.
def var hxn as handle.
def var hxnt as handle.
def var lcc as longchar.
create x-document hxdoc.
create x-noderef hxn.
create x-noderef hxnt.
hxdoc:create-node( hxn, 'root', 'element' ).
hxdoc:append-child( hxn ).
hxdoc:create-node( hxnt, '', 'text' ).
hxn:append-child( hxnt ).
hxnt:node-value = 'røøt'.
fix-codepage( lcc ) = 'utf-16'. // remove to see difference
hxdoc:save( 'longchar', lcc ).
message
length( lcc, 'raw' ) skip
string( lcc )
.
copy-lob from lcc to file 'foobar.xml'. // you may need no-convert
fix-codepage
不使用时,longchar 的长度为 42。当 codepage 设置为 utf-16 时,longchar 的长度为 84 。
abldojo.progress.com上的示例。
推荐阅读
- python - 使用 Firefox WebDriver 单击与同名标签耦合的单选按钮
- android - 当应用不在屏幕顶部时保持活动
- dart - Dart:无法推断函数文字的类型,因为文字有一个块作为其主体
- html - 如何使具有下拉菜单的导航栏居中
- android - 使用低 SDK 构建工具版本编译
- python - 如何检查它是否有一个类正在运行?
- java - Orika 运行时的可选转换/映射
- javascript - 从外部文件在邮递员中加载 json 模式
- laravel - 模型中的函数不存在 BadMethodCallException ',但方法存在
- for-loop - 如何从 Go 中的 For 循环返回数据?