Differences between revisions 2 and 3
Revision 2 as of 2004-08-16 03:55:55
Size: 1124
Editor: Zoom.Quiet
Comment: 应用 Elements and Element Trees
Revision 3 as of 2004-08-17 03:46:40
Size: 2792
Editor: Zoom.Quiet
Comment: 完成XML 解析模块 OtXML.py
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
== 040817 XML ==
 * 商定代码组织;
 * 完成XML 解析模块 OtXML.py
{{{
] python OtXML.py
['###./@Version###', '0.1']
...
['###./@ProtocolName###', 'uss']
...
['###./@PersistentConnection###', 'false']
...
['###./@OtBaseDir###', 'OtterBaseTemplet']
...
['###./Message/@MessageName###', 'usspmsg']
...
['###./Message/@OtBaseDir###', 'message']
...
['###./Message/@OtBaseFile###', 'bytemsg.py']
...
['###./Message/Commands/Command###', [['generic_noop', '0x00000000L'], ['generic_noop_resp', '0xff000000L'], ['connect', '0x00000001L', [['system_id', '6', 's'], ['auth_source', '16', 's'], ['version', None, 'I'], ['time_stamp', '8', 's']]], ['connect_resp', '0xff000001L', [['status', None, 'I'], ['version', None, 'I']]], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter', '0x00000005L'], ['mail_counter_resp', '0xff000005L']], ('CommandName', 'CommandID'), ('FieldName', 'FieldSize', 'FieldType')]
...
['###./Protocol/@ProtocolName###', 'ussp']
...
['###./Protocol/@ListenPort###', '7890']
...
['###./Protocol/@OtBaseDir###', 'protocols']
...
['###./Protocol/@OtBaseFile###', 'byteprotocol.py']
...
['###./Protocol/ClientProtocol/Command###', [['generic_noop_resp', '0xff000000L'], ['connect_resp', '0xff000001L'], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter_resp', '0xff000005L']], ('CommandName', 'CommandID')]
...
['###./Protocol/ServerProtocol/Command###', [['generic_noop', '0x00000000L'], ['connect', '0x00000001L'], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter', '0x00000005L']], ('CommandName', 'CommandID')]
...
}}}

Otter 核心开发日志

-- Zoom.Quiet [DateTime(2004-08-16T00:15:40Z)] TableOfContents

开发节点

简述各个时期的开发重心

040817 XML

  • 商定代码组织;
  • 完成XML 解析模块 OtXML.py

] python OtXML.py
['###./@Version###', '0.1']
...
['###./@ProtocolName###', 'uss']
...
['###./@PersistentConnection###', 'false']
...
['###./@OtBaseDir###', 'OtterBaseTemplet']
...
['###./Message/@MessageName###', 'usspmsg']
...
['###./Message/@OtBaseDir###', 'message']
...
['###./Message/@OtBaseFile###', 'bytemsg.py']
...
['###./Message/Commands/Command###', [['generic_noop', '0x00000000L'], ['generic_noop_resp', '0xff000000L'], ['connect', '0x00000001L', [['system_id', '6', 's'], ['auth_source', '16', 's'], ['version', None, 'I'], ['time_stamp', '8', 's']]], ['connect_resp', '0xff000001L', [['status', None, 'I'], ['version', None, 'I']]], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter', '0x00000005L'], ['mail_counter_resp', '0xff000005L']], ('CommandName', 'CommandID'), ('FieldName', 'FieldSize', 'FieldType')]
...
['###./Protocol/@ProtocolName###', 'ussp']
...
['###./Protocol/@ListenPort###', '7890']
...
['###./Protocol/@OtBaseDir###', 'protocols']
...
['###./Protocol/@OtBaseFile###', 'byteprotocol.py']
...
['###./Protocol/ClientProtocol/Command###', [['generic_noop_resp', '0xff000000L'], ['connect_resp', '0xff000001L'], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter_resp', '0xff000005L']], ('CommandName', 'CommandID')]
...
['###./Protocol/ServerProtocol/Command###', [['generic_noop', '0x00000000L'], ['connect', '0x00000001L'], ['terminate', '0x00000002L'], ['terminate_resp', '0xff000002L'], ['mail_counter', '0x00000005L']], ('CommandName', 'CommandID')]
...

040816 XSD

  • XML schema 确认,
  • 个人开始寻找,XML 解析,代码模板解析方式
    • 040816 19:50 尝试

   1 # -*- coding: utf-8 -*-
   2 # file OtterTools.py
   3 #
   4 """Otter Tools main script
   5 
   6 @version: 0.1a
   7 @author: U{Zoom.Quiet<mailto:[email protected]>}
   8 @see: http://wiki.woodpecker.org.cn/moin.cgi/Otter_2fOtterTool
   9 """
  10 import sys,string
  11 from elementtree import ElementTree
  12 if __name__ == '__main__':      # this way the module can be
  13     """
  14     应用 Elements and Element Trees 来通过XPath 迅速理解XML
  15     """
  16     file = open("uss.xml", "r")
  17     weblog = ElementTree.parse('uss.xml').getroot()
  18     commands = weblog.findall('.//Command')
  19     for node in commands:
  20         print node.attrib["CommandID"] 

040815 开始

  • QQ+Msn 与HD 讨论,明白Otter 的开发目标,方式
  • 最小特性开发,保证每一细小的特性KO先!

  • 每日保持就感!

zqOtterDevLog (last edited 2009-12-25 07:16:43 by localhost)