Home > Back-end >  How available to read this format of XML into one line of data to the database?
How available to read this format of XML into one line of data to the database?

Time:09-27

Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31366' version='1' & gt;
Thread 1 always the allocate new log, a sequence of 377


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31366' & gt;
Private strand flush the not complete


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31366' & gt;
Current log# seq# 376 mem# 0:1/home/oracle/app/oracle/oradata/former/redo01 log


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31366' & gt;
Thread 1 advanced to log sequence 377 (LGWR switch)


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31366' & gt;
Current log# 2 seq# 377 mem# 0:/home/oracle/app/oracle/oradata/former/redo02 log


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31491' & gt;
Archived Log entry for the thread with a 340 added 376 ID 0, 1 sequence x5273f832 dest 1:


Client_id='type=' UNKNOWN 'level=' 16 '
Host_id='dataserver12 host_addr=' 172.16.10.12 module='
Pid='31507' & gt;
LNS: Standby redo logfile selected for thread 1 sequence 377 for destination LOG_ARCHIVE_DEST_2



can read the value of the time and the label for & lt; Txt> The content is enough & lt;/txt>
Deposit to tb_alert (occur_time date, message varchar2 (200)),

Or is there any easier way to put the XML data display multiple lines,
A & lt; Msg> For a line, the content of

CodePudding user response:

Delphi using NatiiveXML third visit to the controls, parsing the one small case, search on the net, make one to get to know myself, don't wait for the code, it is better to own to fast,

CodePudding user response:

Note: I use is the XMLDocument1 Delphi controls, first of all, the original poster to text and not standard XML document, so first processed into relatively ready to use it can parse XML,
 
Var
I: Integer;
Clist: TStringList;
The begin
Clist:=TStringList. Create;
Clist. LoadFromFile (' 1. XML);
XMLDocument1. XML. The Clear;
XMLDocument1. XML. Text:='& lt; ? The XML version="1.0" encoding="gb2312"?> '+ clist. Text + & lt;/ROOT> ';
XMLDocument1. Active:=true;
For I:=0 to XMLDocument1. DocumentElement..childnodes. Do the Count - 1
The begin
Memo1. Lines. The Add (
XMLDocument1. DocumentElement..childnodes [I] Attributes [] 'time' + '
+ XMLDocument1. DocumentElement..childnodes [I].childnodes [0]. The Text
);
The end;
Clist. Free;
The end;

CodePudding user response:

Wanted to help you parse the XML is not complete,

Best you provide complete XML standard file,

CodePudding user response:

XML Data Binding + XMLDocument don't know can meet the needs of the building Lord?

CodePudding user response:

Parses XML third-party controls a lot of ah

CodePudding user response:

Simple parsing, the regular expression is more convenient,
 & lt; MSG time="(. *?) '[\ s \ s] *?  (. *) \ r \ n & lt;/txt> \ r \ n 


CodePudding user response:

refer to 6th floor pathletboy response:
simple parsing, the regular expression is more convenient,
 & lt; MSG time="(. *?) '[\ s \ s] *?  (. *) \ r \ n & lt;/txt> \ r \ n 


this looks good,
  • Related