Last post Jun 25, 2013 02:52 AM by Amy Peng - MSFT
None
0 Points
4 Posts
Jun 14, 2013 11:06 AM|jambagigirish|LINK
I have a xml file with following structure.
<?xml version="1.0" encoding="UTF-8"?> -<Log_details>
-<Logs>
<LogNo>85364</LogNo>
<CDI>78294</CDI>
<Time>2013-03-01.13:35:42.507</Time>
<PID>0d2264</PID>
<Source>CAP</Source>
<Destination>ConsoleSiteComm</Destination>
<Feature>MCDI_CONV_CALL_CONTROL_REQ_MSG</Feature>
<MessageType>MumdConventionalCallControlRequest</MessageType>
<MessageID>801A</MessageID>
<Payload>0100.0000.3900.0008.0000.0000.000A.0000.0001.0000.0005.0027.0602.0006.161C.22C2.804A.2382.8044.0000.0000.0000.0000.6300.0102.FFFF.0000.2000.0000.0100.0100.01</Payload>
</Logs>
</Log_details>
I want upadte this file with following structure adding one more element raw data which is samw as payload but new payload shoulb be like this.
<Payload>
<Message Name>DigitalConvPttRequest </Message Name>
<ConsoleURID>(0X22C2804A)</ConsoleURID>
<ConvChannelUrid> (0X23828044)</ConvChannelUrid>
<ConvTalkgroupId> (0X0000)</ConvTalkgroupId>
<SourceConvUnitId> (0X000000)</SourceConvUnitId>
<TargetConvUnitId> (0X000000) </TargetConvUnitId
<ConsoleTransmitPriority>(0X63) </ConsoleTransmitPriority>
<Frequency>(0X0001)</Frequency>
<MsgInfoByte> (0X02)</MsgInfoByte>
<PlCode>(0XFFFF)</PlCode>
<CCGWInfoByte> (0X00)</CCGWInfoByte>
<NumberOfStationCntrlCmds>0x00</NumberOfStationCntrlCmds>
</Payload>
<Rawdata>0100.0000.3900.0008.0000.0000.000A.0000.0001.0000.0005.0027.0602.0006.161C.22C2.804A.2382.8044.0000.0000.0000.0000.6300.0102.FFFF.0000.2000.0000.0100.0100.01</Rawdata>
</Logs></Log_details>
the problem is that this new payload child tags change according to messag etype. ie tag varies...fro perticulat message id.
Please help me out doing this for my log processing tool
Star
14544 Points
1481 Posts
Jun 25, 2013 02:52 AM|Amy Peng - MSFT|LINK
Hi,
Please try to check the following articles to find your cause:
# How to read update and write xml in C#:
http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx .
http://www.mindstick.com/Articles/04e767b6-dbb9-4823-bb74-22aa6554b620/ .
http://forum.codecall.net/topic/58239-c-tutorial-reading-and-writing-xml-files/ .
Hope it can help you.
Best Regards, Amy Peng
None
0 Points
4 Posts
Read update and write XML file in C#
Jun 14, 2013 11:06 AM|jambagigirish|LINK
I have a xml file with following structure.
<?xml version="1.0" encoding="UTF-8"?>
-<Log_details>
-<Logs>
<LogNo>85364</LogNo>
<CDI>78294</CDI>
<Time>2013-03-01.13:35:42.507</Time>
<PID>0d2264</PID>
<Source>CAP</Source>
<Destination>ConsoleSiteComm</Destination>
<Feature>MCDI_CONV_CALL_CONTROL_REQ_MSG</Feature>
<MessageType>MumdConventionalCallControlRequest</MessageType>
<MessageID>801A</MessageID>
<Payload>0100.0000.3900.0008.0000.0000.000A.0000.0001.0000.0005.0027.0602.0006.161C.22C2.804A.2382.8044.0000.0000.0000.0000.6300.0102.FFFF.0000.2000.0000.0100.0100.01</Payload>
</Logs>
</Log_details>
I want upadte this file with following structure adding one more element raw data which is samw as payload but new payload shoulb be like this.
<?xml version="1.0" encoding="UTF-8"?>
-<Log_details>
-<Logs>
<LogNo>85364</LogNo>
<CDI>78294</CDI>
<Time>2013-03-01.13:35:42.507</Time>
<PID>0d2264</PID>
<Source>CAP</Source>
<Destination>ConsoleSiteComm</Destination>
<Feature>MCDI_CONV_CALL_CONTROL_REQ_MSG</Feature>
<MessageType>MumdConventionalCallControlRequest</MessageType>
<MessageID>801A</MessageID>
<Payload>
<Message Name>DigitalConvPttRequest </Message Name>
<ConsoleURID>(0X22C2804A)</ConsoleURID>
<ConvChannelUrid> (0X23828044)</ConvChannelUrid>
<ConvTalkgroupId> (0X0000)</ConvTalkgroupId>
<SourceConvUnitId> (0X000000)</SourceConvUnitId>
<TargetConvUnitId> (0X000000) </TargetConvUnitId
<ConsoleTransmitPriority>(0X63) </ConsoleTransmitPriority>
<Frequency>(0X0001)</Frequency>
<MsgInfoByte> (0X02)</MsgInfoByte>
<PlCode>(0XFFFF)</PlCode>
<CCGWInfoByte> (0X00)</CCGWInfoByte>
<NumberOfStationCntrlCmds>0x00</NumberOfStationCntrlCmds>
</Payload>
<Rawdata>0100.0000.3900.0008.0000.0000.000A.0000.0001.0000.0005.0027.0602.0006.161C.22C2.804A.2382.8044.0000.0000.0000.0000.6300.0102.FFFF.0000.2000.0000.0100.0100.01</Rawdata>
</Logs></Log_details>
the problem is that this new payload child tags change according to messag etype. ie tag varies...fro perticulat message id.
Please help me out doing this for my log processing tool
Star
14544 Points
1481 Posts
Re: Read update and write XML file in C#
Jun 25, 2013 02:52 AM|Amy Peng - MSFT|LINK
Hi,
Please try to check the following articles to find your cause:
# How to read update and write xml in C#:
http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx .
http://www.mindstick.com/Articles/04e767b6-dbb9-4823-bb74-22aa6554b620/ .
http://forum.codecall.net/topic/58239-c-tutorial-reading-and-writing-xml-files/ .
Hope it can help you.
Best Regards,
Amy Peng