首页
\
问答
\
在mule esb中使用DataMapper使用自定义分隔符(空格或制表符)编写CSV文件(Writing CSV file using custom Delimiter (space or tab) using DataMapper in mule esb)
在mule esb中使用DataMapper使用自定义分隔符(空格或制表符)编写CSV文件(Writing CSV file using custom Delimiter (space or tab) using DataMapper in mule esb)
通过使用DataMapper,我将XML格式转换为CSV格式,但问题无法使用空格或制表符作为分隔符。 请告诉我在DataMapper组件中需要完成哪些配置。
XML:
<OredrId>10</OrderId> <CustomerName>John<CustomerName> <OredrId >11</OrderId> <CustomerName>Tom<CustomerName>
预期的CSV格式是:
10 John 11 Tom
请在此建议我。,在此先感谢:)
By using DataMapper I'm converting XML format to CSV format but problem is unable to use space or tab as delimiter. Please let me know what configuration need to be done in DataMapper component.,
XML :
<OredrId>10</OrderId> <CustomerName>John<CustomerName> <OredrId >11</OrderId> <CustomerName>Tom<CustomerName>
Expected CSV format is :
10 John 11 Tom
Please suggest me on this., Thanks in advance:)
原文:https://stackoverflow.com/questions/32345766
更新时间:2022-06-08 17:06
最满意答案
正如他们在评论中所说,您可以使用SDBM_File模块。 例如:
#!/usr/bin/perl use strict; use warnings; use v5.14; use Fcntl; use SDBM_File; my $filename = "dbdb"; my %h; tie %h, 'SDBM_File', $filename, O_RDWR|O_CREAT, 0666 or die "Error: $!\n"; # To run only one time to fill the dbdb file. # Next time you may delete this line and # the output will be the same "16,40". $h{$_} = $_ * 2 . "," . $_ * 5 for 1..100; say $h{8}; untie %h;
产量:16,40
As they said in the comments you may use SDBM_File module. For example:
#!/usr/bin/perl use strict; use warnings; use v5.14; use Fcntl; use SDBM_File; my $filename = "dbdb"; my %h; tie %h, 'SDBM_File', $filename, O_RDWR|O_CREAT, 0666 or die "Error: $!\n"; # To run only one time to fill the dbdb file. # Next time you may delete this line and # the output will be the same "16,40". $h{$_} = $_ * 2 . "," . $_ * 5 for 1..100; say $h{8}; untie %h;
Output: 16,40
相关问答
更多-
PouchDB怎么样? 它适用于离线缓存数据的Web应用程序。 How about PouchDB? It's intended for web apps that cache data offline.
-
如果数据库配置中的数据库调试处于开启状态,脚本执行将通过show_error()停止,以显示数据库错误,从而停止执行else语句。 我建议关闭它(特别是在产品环境中)。 您也可以尝试在插入语句( @ )的前面放置错误抑制符号 - 但这种方法我没有测试过,因为我不认为db驱动程序使用php触发器来发生错误。 If database debugging is on in the database configuration than script execution will halt via a show_e ...
-
正确使用数据库类的方法(Proper way to use a database class)[2023-04-01]
创建一个单独的类来保存给用户: public class TechUser { public string UserName {get; private set;} public string Password{get; private set;} public TechUser(string userName, string password) { UserName = userName; Password = password; } ... -
使用具有记录级别编辑的适当数据库替换平面文件数据库(replacing flat-file db with proper database with record level editing)[2023-09-10]
正如他们在评论中所说,您可以使用SDBM_File模块。 例如: #!/usr/bin/perl use strict; use warnings; use v5.14; use Fcntl; use SDBM_File; my $filename = "dbdb"; my %h; tie %h, 'SDBM_File', $filename, O_RDWR|O_CREAT, 0666 or die "Error: $!\n"; # To run only one time to fil ... -
我不确定这是否是你想要的,但是下面的线程包含了在DataContext上使用反射和扩展方法的代码,以允许您轻松地将一个实体的成员复制到另一个实体的成员中。 重复的LINQ to SQL实体/记录? I am not sure if this is what you want, but the following thread includes code using reflection and an extension method on DataContext to allow you to easily ...
-
从Web数据库中删除记录的JS语法是什么?(What's proper JS syntax for deleting a record from a web database?)[2023-05-30]
正确的语法是DELETE FROM tableName [WHERE expr] (底层实现都使用SQLite,AFAIK。) 但是,有几个相关的问题: 使用的条件是错误的,SQL使用=表示相等。 rowid ,作为字符串内容,是错误的。 这永远不会是ID,因为没有“魔术替代”。 而是使用参数化查询并指定绑定值。 考虑: function deleteRecord(rowid) { var db = getCurrentDatabase(); db.transaction( fu ... -
Rake db:migrate和db:create不使用正确的数据库文件(Rake db:migrate and db:create not operated with proper database files)[2023-02-27]
我相信您可能因为开发定义中的拼写错误而遇到问题。 另外作为建议我会尝试在您的database.yml中定义更多。 我不确定编码是否需要或最小选项是什么,但这是我的PG项目的典型定义 development: adapter: postgresql encoding: unicode database: development pool: 5 username: postgres password: postgres I believe that you may be getting ... -
我建议选项1,你在平面文件架构中有标题,你要么在模式中指定默认值,要么在地图中设置它们将是我认为正确的方法中最好和最简单的。 我唯一一次使用选项2是你有平面文件传入并需要反汇编,实际上需要将记录行分配到单独的消息中,你可以将正文记录定义为1。 I would recommend Option 1 where you have the header in the Flat File schema and you either have default values specified in the schem ...
-
您可以将其保存在会话变量中,如下所示: - f_intTeamID = Val(Request.QueryString("intTeamID")) Session("f_intTeamID") = f_intTeamID 下次回发页面时,从会话中检索它。 You can preserve it in session variable like below:- f_intTeamID = Val(Request.QueryString("intTeamID")) Session("f_intTeamID" ...
-
如何在编辑sqlite数据库后创建正确的-journal文件(how to create correct -journal file after editing sqlite database)[2022-07-23]
-journal文件由数据库自动处理。 你不需要关心它。 它可能会被删除或取决于某些连接设置 ,但这只是一种优化。 The -journal file is automatically handled by the database. You don't need to care about it. It might be deleted or not depending on some connection setting, but that is merely an optimization.