Program to read header and footer of a file

I have a text file that has many records. Each record is a xml element. each record is separated by a text - RECORD_BREAK. Ex John123-345-1123 RECORD_BREAK John123-345-1123 RECORD_BREAK John123-345-1123 RECORD_BREAK John123-345-1123 RECORD_BREAK while reading the records, i split the each record by String[] strings = xml.split("RECORD_BREAK"); now i need to add a Header and Footer for the file. This is to identify the file is not corrupted. how to read the header and footer of the file. Header and footer is as simple as John123-345-1123 RECORD_BREAK John123-345-1123 RECORD_BREAK how can i check for the and tag at starting and ending of records before i split the records.
Why do you need a record break marker in an XML file? You already have records separated by tags. Just parse the whole thing with an XML parser (especially easy after wrapping it into a top-level CustomerInfo tag). This also gives you at least the same very modest level of "corruption check" that your header and footer would provide, and would not fail if some customer happens to be named "Little Bobby Tables RECORD_BREAK".

以上就是Program to read header and footer of a file的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏