我想解析XML文件并读取所有InnerText并将其保存在DB中 [英] I wanted to parse through an XML file and read all the InnerText and save it in DB

查看:76
本文介绍了我想解析XML文件并读取所有InnerText并将其保存在DB中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<?xml version="1.0" encoding="utf-8"?>
<Event>
  <System xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <Provider Name="User32" Guid="{b0aa8734-56f7-41cc-b2f4-de228e98b946}" EventSourceName="User32" />
    <EventID Qualifiers="32768">1074</EventID>
    <Version>0</Version>
    <Level>4</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8080000000000000</Keywords>
    <TimeCreated SystemTime="2014-01-23T06:53:03.860676800Z" />
    <EventRecordID>2555</EventRecordID>
    <Correlation />
    <Execution ProcessID="544" ThreadID="596" />
    <Channel>System</Channel>
    <Computer>Rupesh</Computer>
    <Security UserID="S-1-5-21-4087883770-4115454469-2954625715-1001" />
  </System>
  <EventData xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <Data Name="param1">C:\Windows\System32\shutdown.exe (RUPESH)</Data>
    <Data Name="param2">RUPESH</Data>
    <Data Name="param3">No title for this reason could be found</Data>
    <Data Name="param4">0x800000ff</Data>
    <Data Name="param5">restart</Data>
    <Data Name="param6">To make the changes effective, restarting in 10 secs.Please save your work!!</Data>
    <Data Name="param7">RUPESH\PIV</Data>
  </EventData>
  <System xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <Provider Name="User32" Guid="{b0aa8734-56f7-41cc-b2f4-de228e98b946}" EventSourceName="User32" />
    <EventID Qualifiers="32768">1074</EventID>
    <Version>0</Version>
    <Level>4</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8080000000000000</Keywords>
    <TimeCreated SystemTime="2014-01-25T08:00:14.475637000Z" />
    <EventRecordID>2944</EventRecordID>
    <Correlation />
    <Execution ProcessID="532" ThreadID="624" />
    <Channel>System</Channel>
    <Computer>Rupesh</Computer>
    <Security UserID="S-1-5-21-4087883770-4115454469-2954625715-1001" />
  </System>
  <EventData xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <Data Name="param1">C:\Windows\System32\shutdown.exe (RUPESH)</Data>
    <Data Name="param2">RUPESH</Data>
    <Data Name="param3">No title for this reason could be found</Data>
    <Data Name="param4">0x800000ff</Data>
    <Data Name="param5">restart</Data>
    <Data Name="param6">To make the changes effective, restarting in 10 secs.Please save your work!!</Data>
    <Data Name="param7">RUPESH\PIV</Data>
  </EventData>
</Event>

推荐答案

如果您的主要目标是将XML数据保存到数据库,那么您可以直接将XML文件保存到DB。

check belo links 。



http://weblogs.asp.net/jgalloway/archive/2007/02/16/passing-lists-to-sql-server-2005-with-xml-parameters .aspx



http://blogs.msdn.com/b/mrorke/archive/2005/07/21/441554.aspx [ ^ ]
If your primary goal to save XML data to database,then you can directly save the XML file to DB.
check belo links.

http://weblogs.asp.net/jgalloway/archive/2007/02/16/passing-lists-to-sql-server-2005-with-xml-parameters.aspx

http://blogs.msdn.com/b/mrorke/archive/2005/07/21/441554.aspx[^]


这篇关于我想解析XML文件并读取所有InnerText并将其保存在DB中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆