<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DigiTechLog Dot Com &#187; Python</title>
	<atom:link href="http://digitechlog.com/tag/python-script/feed" rel="self" type="application/rss+xml" />
	<link>http://digitechlog.com</link>
	<description>Adobe AIR、Flex、Flash、Java</description>
	<lastBuildDate>Tue, 08 Nov 2011 12:46:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>python-crawler：Pythonのクローラーライブラリ</title>
		<link>http://digitechlog.com/2011/11/03/python-crawler%ef%bc%9apython%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%83%a9%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa.html</link>
		<comments>http://digitechlog.com/2011/11/03/python-crawler%ef%bc%9apython%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%83%a9%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa.html#comments</comments>
		<pubDate>Thu, 03 Nov 2011 09:39:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://digitechlog.com/?p=1155</guid>
		<description><![CDATA[Python は 生産性とコードの信頼性を重視して設計されており、フリーなオブジェクト指向プログラミング言語です。「python-crawler」では、Pythonで実装されたオープンソースのライブラリです。それを利用して、下記のようで簡単にクローラ機能を利用できます。


from crawler.crawler import Crawler
mycrawler = Crawler()
seeds = ['http://www.example.com/'] # list of url
mycrawler.add_seeds(seeds)
rules = {'^(http://.+example\.com)(.+)$':[ '^(http://.+example\.com)(.+)$' ]}
#your crawling rules: a dictionary type,
#key is the regular expressions for url,
#value is the list of regular expressions for urls which you want to follow from the url in key.
mycrawler.add_rules(rules)
mycrawler.start() # start crawling
データは全部三つのBerkeley DBに格納されます。
python-crawlerは次のＵＲＬからダウンロードできます。
http://code.google.com/p/python-crawler/
Related Posts

PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF [...]]]></description>
			<content:encoded><![CDATA[<p>Python は 生産性とコードの信頼性を重視して設計されており、フリーなオブジェクト指向プログラミング言語です。「python-crawler」では、Pythonで実装されたオープンソースのライブラリです。それを利用して、下記のようで簡単にクローラ機能を利用できます。<br />
<span id="more-1155"></span><br />
<code><br />
from crawler.crawler import Crawler</p>
<p>mycrawler = Crawler()<br />
seeds = ['http://www.example.com/'] # list of url<br />
mycrawler.add_seeds(seeds)<br />
rules = {'^(http://.+example\.com)(.+)$':[ '^(http://.+example\.com)(.+)$' ]}<br />
#your crawling rules: a dictionary type,<br />
#key is the regular expressions for url,<br />
#value is the list of regular expressions for urls which you want to follow from the url in key.<br />
mycrawler.add_rules(rules)<br />
mycrawler.start() # start crawling</code><br />
データは全部三つのBerkeley DBに格納されます。<br />
python-crawlerは次のＵＲＬからダウンロードできます。<br />
<a href="http://code.google.com/p/python-crawler/">http://code.google.com/p/python-crawler/</a><br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html" title="PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供する">PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供する</a></li>
<li><a href="http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html" title="s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース">s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://digitechlog.com/2011/11/03/python-crawler%ef%bc%9apython%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%83%a9%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供する</title>
		<link>http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html</link>
		<comments>http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html#comments</comments>
		<pubDate>Sat, 03 Oct 2009 15:26:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash Project]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[PyAMF]]></category>

		<guid isPermaLink="false">http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html</guid>
		<description><![CDATA[この前はPHPからAMFメソッドを呼び出すライブラリ「SabreAMF: FlexをPHP5と連携させるフレームワーク」などと．NETの「FluorineFx: Flexと.NET間でAMF通信できるライブラリ」を紹介しましたね。フリーなオブジェクト指向プログラミング言語Pythonは、動的な型付け、ガベージコレクション、マルチパラダイム、モジュール、クラス、オブジェクト等の言語の要素が内部からアクセス可能であり、リフレクションを利用した記述が可能など幾つか特徴があるので、Google App EngineもPythonがサポートされています。 
PythonからAMF通信できますか。今回紹介PyAMFとは、オープンソースプロジェクトとして、PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供しています。
 
  
PyAMFにより、Flash、Flex またはAIRで、Pythonによって起動しているWebサーバとリッチインターネットアプリケーション(RIA)クライアント間のAMFベースの通信を可能になります。Google App Engine Webアプリケーション向けの新たなAMFゲートウェイも導入されました。
この前にも紹介したことがあり、AMFはリモートプロシージャーコール(RPC)を、 HTTP/HTTPSまたはRTMP/RTMPSプロトコルを介して転送されるコンパクトなバイナリ表現にエンコードする。PyAMFは、 GAEバックエンドと共にFlexベースのRIAアプリケーションの開発を可能にし、RIAをGoogleクラウドコンピューティングプラットフォームに配置する。
以下はPyAMFの使用方法を簡単で紹介します。
・PyAMFのインストール
easy_installで、もしくはできなければダウンロードしてきてsetup.py installでもいい
easy_install pyamf
・AMFの配備
デフォルトのまま利用する場合は8000のportはあけておく必要があります。
以下のコマンドでserver.xmlを起動します。
python server.py
正常だったら、http://IPアドレス:8000/にAMFでアクセスすることが可能になります。
・クライアントからの接続確認
FlashDevelopを使って、簡単にRemoteObjectで接続してみて、http://pyamf.org/wiki/HelloWorld/Flex のサンプルに従って「Hello World」のサンプルを作れます。どう？簡単でしょう？  
【関連リンク】
http://pyamf.org/ 公式サイト
Related Posts

s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース
リッチインターネットアプリケーション (RIA) 実行環境「Adobe AIR 1.5」のLinux版を公開した
python-crawler：Pythonのクローラーライブラリ
8 Adobe ActionScriptのチュートリアルフラッシュ
GPLFlash: GNU/Linux上でAdobeのFlashムービーを再生しよう
15+綺麗な車に関するアドビPhotoShopの.PSDファイル
5個アドビFlashメニューとナビゲーションのチュートリアル
トップ７個アドビAIRビデオアプリケーション

]]></description>
			<content:encoded><![CDATA[<p>この前はPHPからAMFメソッドを呼び出すライブラリ「<a href="http://digitechlog.com/2009/08/28/sabreamf-is-a-flash-remoting-server-and-client-for-php.html">SabreAMF: FlexをPHP5と連携させるフレームワーク</a>」などと．NETの「<a href="http://digitechlog.com/2009/09/30/fluorine-flash-remoting-for-dot-net.html">FluorineFx: Flexと.NET間でAMF通信できるライブラリ</a>」を紹介しましたね。フリーなオブジェクト指向プログラミング言語Pythonは、動的な型付け、ガベージコレクション、マルチパラダイム、モジュール、クラス、オブジェクト等の言語の要素が内部からアクセス可能であり、リフレクションを利用した記述が可能など幾つか特徴があるので、Google App EngineもPythonがサポートされています。 </p>
<p>PythonからAMF通信できますか。今回紹介PyAMFとは、オープンソースプロジェクトとして、PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供しています。</p>
<p><a href="http://digitechlog.com/wp-content/uploads/2009/10/pythonlogomasterv3trans.png"><img title="python-logo-master-v3-trans" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="216" alt="python-logo-master-v3-trans" src="http://digitechlog.com/wp-content/uploads/2009/10/pythonlogomasterv3trans_thumb.png" width="480" border="0" /></a> </p>
<p><span id="more-611"></span>  </p>
<p>PyAMFにより、Flash、Flex またはAIRで、Pythonによって起動しているWebサーバとリッチインターネットアプリケーション(RIA)クライアント間のAMFベースの通信を可能になります。Google App Engine Webアプリケーション向けの新たなAMFゲートウェイも導入されました。</p>
<p>この前にも紹介したことがあり、AMFはリモートプロシージャーコール(RPC)を、 HTTP/HTTPSまたはRTMP/RTMPSプロトコルを介して転送されるコンパクトなバイナリ表現にエンコードする。PyAMFは、 GAEバックエンドと共にFlexベースのRIAアプリケーションの開発を可能にし、RIAをGoogleクラウドコンピューティングプラットフォームに配置する。</p>
<p>以下はPyAMFの使用方法を簡単で紹介します。</p>
<p><strong>・PyAMFのインストール</strong></p>
<p>easy_installで、もしくはできなければダウンロードしてきてsetup.py installでもいい</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Gray;">easy_install pyamf</span></li></ol></div>
<p><strong>・AMFの配備</strong></p>
<p>デフォルトのまま利用する場合は8000のportはあけておく必要があります。</p>
<p>以下のコマンドでserver.xmlを起動します。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Gray;">python server.py</span></li></ol></div>
<p>正常だったら、http://IPアドレス:8000/にAMFでアクセスすることが可能になります。</p>
<p><strong>・クライアントからの接続確認</strong></p>
<p>FlashDevelopを使って、簡単にRemoteObjectで接続してみて、<a title="http://pyamf.org/wiki/HelloWorld/Flex" href="http://pyamf.org/wiki/HelloWorld/Flex">http://pyamf.org/wiki/HelloWorld/Flex</a> のサンプルに従って「Hello World」のサンプルを作れます。どう？簡単でしょう？ <img src='http://digitechlog.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>【関連リンク】</strong></p>
<p><a title="http://pyamf.org/" href="http://pyamf.org/">http://pyamf.org/</a> 公式サイト</p>
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html" title="s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース">s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース</a></li>
<li><a href="http://digitechlog.com/2008/12/20/rich-internet-application-ria-runtime-adobe-air-15-linux-platform-is-relaeased.html" title="リッチインターネットアプリケーション (RIA) 実行環境「Adobe AIR 1.5」のLinux版を公開した">リッチインターネットアプリケーション (RIA) 実行環境「Adobe AIR 1.5」のLinux版を公開した</a></li>
<li><a href="http://digitechlog.com/2011/11/03/python-crawler%ef%bc%9apython%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%83%a9%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa.html" title="python-crawler：Pythonのクローラーライブラリ">python-crawler：Pythonのクローラーライブラリ</a></li>
<li><a href="http://digitechlog.com/2010/06/06/8-helpfull-adobe-flash-actionscript.html" title="8 Adobe ActionScriptのチュートリアルフラッシュ">8 Adobe ActionScriptのチュートリアルフラッシュ</a></li>
<li><a href="http://digitechlog.com/2009/12/01/gplflash-another-alternative-flash-runtime.html" title="GPLFlash: GNU/Linux上でAdobeのFlashムービーを再生しよう">GPLFlash: GNU/Linux上でAdobeのFlashムービーを再生しよう</a></li>
<li><a href="http://digitechlog.com/2009/11/02/collection-of-15-beautiful-adobe-photoshop-psd-files-for-car.html" title="15+綺麗な車に関するアドビPhotoShopの.PSDファイル">15+綺麗な車に関するアドビPhotoShopの.PSDファイル</a></li>
<li><a href="http://digitechlog.com/2009/10/31/5-useful-aadobe-flash-menu-and-navigation-tutorials.html" title="5個アドビFlashメニューとナビゲーションのチュートリアル">5個アドビFlashメニューとナビゲーションのチュートリアル</a></li>
<li><a href="http://digitechlog.com/2009/07/25/top-7-adobe-air-apps-for-videos-you-should-know.html" title="トップ７個アドビAIRビデオアプリケーション">トップ７個アドビAIRビデオアプリケーション</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>s2x: Flashのcookieファイル(*.sol)とXMLフォーマットの互换用Pythonスクリプトソース</title>
		<link>http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html</link>
		<comments>http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html#comments</comments>
		<pubDate>Sun, 22 Feb 2009 12:04:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash Project]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[s2x]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[スクリプト]]></category>

		<guid isPermaLink="false">http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html</guid>
		<description><![CDATA[すみませんけど、「古い」の話だかも＾＾）、WINDOWSシステムに、「Application Data」→「Macromedia」（現在はAdobe）→「Flash Player」の配下の何にかフォルダの下には、「.sol」ファイルというのがある可能性があります。これって一体何ですか？
SOLファイルというのは、Flashのcookieファイルです。「Flash Player が利異様するクッキー（.solファイル）には、システムファイルの場所を推定できるような情報が含まれている。一方、リモートからその場所にファイルを保存させることができるので、クッキーにスクリプトを含ませておけばローカルのスクリプトとしてブラウザから実行させることができてしまう。ただし、そのためには攻撃者がローカルのユーザ名を知っている必要がある。」という弱点があります（現在のバージョンはその問題がなくなるね）。
 
以前、solファイルの内容を見に安いXMLに変換するため「s2x」というPythonスクリプトがあります。持っているリリースされた公式サイトには、すでにアクセスできないようです。そのスクリプト、現在のFlash Player環境などでは、すでに意味がないと思いますが、開発者に対しては、いい資料だと思います。
※XMLとは、文書やデータの意味や構造を記述するためのマークアップ言語の一つ。マークアップ言語とは、「タグ」と呼ばれる特定の文字列で地の文に構造を埋め込んでいく言語のことで、XMLはユーザが独自のタグを指定できることから、マークアップ言語を作成するためのメタ言語とも言われる。
ソースは以下のようです。
import sys
from&#160;struct import *
from&#160;xml.dom import minidom
#s2x Runtime Error Class Definition:
class&#160;s2xErr(Exception):
&#160; &#160; def&#160;__init__(self,msg):
&#160; &#160; &#160; &#160; self.msg=msg
#constants start:
#------------------------------------------------------------#
NUMBER='\x00'
BOOLEAN='\x01'
STRING='\x02'
OBJOBJ='\x03'
NULL='\x05'
UNDEF='\x06'
OBJARR='\x08'
#RAWARR='\x0A'
OBJDATE='\x0B'
OBJM='\x0D'
OBJXML='\x0F'
OBJCC='\x10'
#constants end.
#------------------------------------------------------------#
argv=sys.argv
if&#160;len(argv)&#60;3:
&#160; &#160; print&#160;'s2x v 0.75 by iceeLyne, Dec., 2003.'
&#160; &#160; print&#160;'usage:'
&#160; &#160; print&#160;'python s2x.py -x foo.sol [foo.xml]'
&#160; &#160; print&#160;'python s2x.py -s foo.xml [foo.sol]'
else:
&#160; &#160; argvSw=argv[1]
&#160; &#160; argvInpFile=argv[2]
&#160; &#160; if&#160;len(argv)&#62;3:
&#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>すみませんけど、「古い」の話だかも＾＾）、WINDOWSシステムに、「Application Data」→「Macromedia」（現在はAdobe）→「Flash Player」の配下の何にかフォルダの下には、「.sol」ファイルというのがある可能性があります。これって一体何ですか？</p>
<p>SOLファイルというのは、Flashのcookieファイルです。「Flash Player が利異様するクッキー（.solファイル）には、システムファイルの場所を推定できるような情報が含まれている。一方、リモートからその場所にファイルを保存させることができるので、クッキーにスクリプトを含ませておけばローカルのスクリプトとしてブラウザから実行させることができてしまう。ただし、そのためには攻撃者がローカルのユーザ名を知っている必要がある。」という弱点があります（現在のバージョンはその問題がなくなるね）。</p>
<p><span id="more-327"></span> </p>
<p>以前、solファイルの内容を見に安いXMLに変換するため「s2x」というPythonスクリプトがあります。持っているリリースされた公式サイトには、すでにアクセスできないようです。そのスクリプト、現在のFlash Player環境などでは、すでに意味がないと思いますが、開発者に対しては、いい資料だと思います。</p>
<p>※XMLとは、文書やデータの意味や構造を記述するためのマークアップ言語の一つ。マークアップ言語とは、「タグ」と呼ばれる特定の文字列で地の文に構造を埋め込んでいく言語のことで、XMLはユーザが独自のタグを指定できることから、マークアップ言語を作成するためのメタ言語とも言われる。</p>
<p>ソースは以下のようです。</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Green;">import</span><span style="color: Gray;"> </span><span style="color: Blue;">sys</span></li>
<li><span style="color: Green;">from</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">struct</span><span style="color: Gray;"> </span><span style="color: Green;">import</span><span style="color: Gray;"> *</span></li>
<li><span style="color: Green;">from</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">xml</span><span style="color: Gray;">.</span><span style="color: Blue;">dom</span><span style="color: Gray;"> </span><span style="color: Green;">import</span><span style="color: Gray;"> </span><span style="color: Blue;">minidom</span></li>
<li><span style="color: #ffa500;">#s2x Runtime Error Class Definition:</span></li>
<li><span style="color: Green;">class</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: Green;">Exception</span><span style="color: Olive;">)</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">__init__</span><span style="color: Olive;">(</span><span style="color: Blue;">self</span><span style="color: Gray;">,</span><span style="color: Blue;">msg</span><span style="color: Olive;">)</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">self</span><span style="color: Gray;">.</span><span style="color: Blue;">msg</span><span style="color: Gray;">=</span><span style="color: Blue;">msg</span></li>
<li><span style="color: #ffa500;">#constants start:</span></li>
<li><span style="color: #ffa500;">#------------------------------------------------------------#</span></li>
<li><span style="color: Blue;">NUMBER</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">BOOLEAN</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">01</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">STRING</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">02</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">OBJOBJ</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">03</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">NULL</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">05</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">UNDEF</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">06</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">OBJARR</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">08</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: #ffa500;">#RAWARR='\x0A'</span></li>
<li><span style="color: Blue;">OBJDATE</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">0B</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">OBJM</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">0D</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">OBJXML</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">0F</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Blue;">OBJCC</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">10</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: #ffa500;">#constants end.</span></li>
<li><span style="color: #ffa500;">#------------------------------------------------------------#</span></li>
<li><span style="color: Blue;">argv</span><span style="color: Gray;">=</span><span style="color: Blue;">sys</span><span style="color: Gray;">.</span><span style="color: Blue;">argv</span></li>
<li><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">argv</span><span style="color: Olive;">)</span><span style="color: Gray;">&lt;</span><span style="color: Maroon;">3</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">s2x v 0.75 by iceeLyne, Dec., 2003.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">usage:</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">python s2x.py -x foo.sol [foo.xml]</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">python s2x.py -s foo.xml [foo.sol]</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">argvSw</span><span style="color: Gray;">=</span><span style="color: Blue;">argv</span><span style="color: Olive;">[</span><span style="color: Maroon;">1</span><span style="color: Olive;">]</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">argvInpFile</span><span style="color: Gray;">=</span><span style="color: Blue;">argv</span><span style="color: Olive;">[</span><span style="color: Maroon;">2</span><span style="color: Olive;">]</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">argv</span><span style="color: Olive;">)</span><span style="color: Gray;">&gt;</span><span style="color: Maroon;">3</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">=</span><span style="color: Blue;">argv</span><span style="color: Olive;">[</span><span style="color: Maroon;">3</span><span style="color: Olive;">]</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">=</span><span style="color: #8b0000;">''</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">argvSw</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">-x</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #ffa500;"># parse sol to xml</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">try</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">=</span><span style="color: Teal;">open</span><span style="color: Olive;">(</span><span style="color: Blue;">argvInpFile</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">rb</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">IOError</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Could Not Open The Input File: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">argvInpFile</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">num2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">s</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">8</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">7F</span><span style="color: Navy;">\x</span><span style="color: Red;">F0</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">Infinity</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">FF</span><span style="color: Navy;">\x</span><span style="color: Red;">F0</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">-Infinity</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">7F</span><span style="color: Navy;">\x</span><span style="color: Red;">F8</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">NaN</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nValue</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;d</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">s</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#Double,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: Teal;">str</span><span style="color: Olive;">(</span><span style="color: Blue;">nValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">number</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">value</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">bol2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">b</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">b</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">false</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">b</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">01</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">true</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Warning: Boolean Value Error.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">true</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">boolean</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">value</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">str2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenStr</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">s</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenStr</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">s</span><span style="color: Gray;">=</span><span style="color: Blue;">s</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">string</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createCDATASection</span><span style="color: Olive;">(</span><span style="color: Blue;">s</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">obj2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: #ffa500;">#is necessary</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">object</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">lastChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">!=</span><span style="color: Maroon;">0</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NUMBER</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">num2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">BOOLEAN</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">bol2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">STRING</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">str2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJARR</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">arr2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJOBJ</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">obj2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJDATE</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">dat2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJXML</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">xml2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJCC</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">occ2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJM</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">ojm2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NULL</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nul2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">UNDEF</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">und2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Teal;">hex</span><span style="color: Olive;">(</span><span style="color: Teal;">ord</span><span style="color: Olive;">(</span><span style="color: Blue;">type</span><span style="color: Olive;">)))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">objend</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#=='\x09'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">parentNode</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">arr2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: #ffa500;">#is necessary</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nArrLength</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">4</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Long,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">array</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">length</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Teal;">str</span><span style="color: Olive;">(</span><span style="color: Blue;">nArrLength</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">lastChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">!=</span><span style="color: Maroon;">0</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NUMBER</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">num2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">BOOLEAN</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">bol2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">STRING</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">str2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJOBJ</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">obj2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJARR</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">arr2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJDATE</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">dat2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJXML</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">xml2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJCC</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">occ2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJM</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">ojm2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NULL</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nul2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">UNDEF</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">und2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Teal;">hex</span><span style="color: Olive;">(</span><span style="color: Teal;">ord</span><span style="color: Olive;">(</span><span style="color: Blue;">type</span><span style="color: Olive;">)))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">objend</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#=='\x09'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">parentNode</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">dat2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nMsec</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;d</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">8</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Double,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nMinOffset</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;h</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nOffset</span><span style="color: Gray;">=</span><span style="color: Blue;">nMinOffset</span><span style="color: Gray;">/</span><span style="color: Maroon;">60</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createComment</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">DateObject:Milliseconds Count From Dec. 1, 1969; Timezone UTC + Offset.</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">date</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">msec</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Teal;">str</span><span style="color: Olive;">(</span><span style="color: Blue;">nMsec</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utcoffset</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Teal;">str</span><span style="color: Olive;">(</span><span style="color: Gray;">-</span><span style="color: Blue;">nOffset</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">xml2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenCData</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">4</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Long,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenCData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">sCData</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">xml</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createCDATASection</span><span style="color: Olive;">(</span><span style="color: Blue;">sCData</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">occ2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: #ffa500;">#is necessary</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenCname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenCname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCname</span><span style="color: Gray;">=</span><span style="color: Blue;">sCname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">c_object</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">class_name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sCname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">lastChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">!=</span><span style="color: Maroon;">0</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NUMBER</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">num2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">BOOLEAN</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">bol2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">STRING</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">str2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJARR</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">arr2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJOBJ</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">obj2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJDATE</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">dat2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJXML</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">xml2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJCC</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">occ2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJM</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">ojm2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NULL</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nul2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">UNDEF</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">und2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Teal;">hex</span><span style="color: Olive;">(</span><span style="color: Teal;">ord</span><span style="color: Olive;">(</span><span style="color: Blue;">type</span><span style="color: Olive;">)))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">objend</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#=='\x09'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">parentNode</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">ojm2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">m_object</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">nul2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">null</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">und2x</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cparent</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">cparent</span><span style="color: Gray;">.</span><span style="color: Blue;">appendChild</span><span style="color: Olive;">(</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">createElement</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">data</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">undefined</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">d</span><span style="color: Gray;">=</span><span style="color: Blue;">minidom</span><span style="color: Gray;">.</span><span style="color: Blue;">parseString</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&lt;solx/&gt;</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">try</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">seek</span><span style="color: Olive;">(</span><span style="color: Maroon;">0</span><span style="color: Gray;">,</span><span style="color: Maroon;">2</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenFile</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">tell</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">seek</span><span style="color: Olive;">(</span><span style="color: Maroon;">0</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sHeader</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenData</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">4</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenData</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenData</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#Unsigned Long,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">nLenFile</span><span style="color: Gray;">!=</span><span style="color: Blue;">nLenData</span><span style="color: Gray;">+</span><span style="color: Maroon;">6</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Warning: Data Length Mismatch.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sFileType</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">4</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#=='TCSO'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sth1</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">6</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenSoln</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenSoln</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solname</span><span style="color: Gray;">=</span><span style="color: Blue;">solname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sth2</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">4</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solxroot</span><span style="color: Gray;">=</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">std_version</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">0.75</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">std_author</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">iceeLyne</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">setAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">sol_name</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">solname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">cparent</span><span style="color: Gray;">=</span><span style="color: Blue;">solxroot</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">tell</span><span style="color: Olive;">()</span><span style="color: Gray;">&lt;</span><span style="color: Blue;">nLenFile</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">,=</span><span style="color: Blue;">unpack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">2</span><span style="color: Olive;">))</span><span style="color: #ffa500;">#Unsigned Short,Big-endian</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">decode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NUMBER</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">num2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">BOOLEAN</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">bol2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">STRING</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">str2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJOBJ</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">obj2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJARR</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">arr2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJDATE</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">dat2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJXML</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">xml2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJCC</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">occ2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">OBJM</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">ojm2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">NULL</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nul2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: Blue;">UNDEF</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">und2x</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Teal;">hex</span><span style="color: Olive;">(</span><span style="color: Teal;">ord</span><span style="color: Olive;">(</span><span style="color: Blue;">type</span><span style="color: Olive;">)))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">end</span><span style="color: Gray;">=</span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">read</span><span style="color: Olive;">(</span><span style="color: Maroon;">1</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#=='\x00'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sxmloutput</span><span style="color: Gray;">=</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">toprettyxml</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\t</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\n</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">==</span><span style="color: #8b0000;">''</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">=</span><span style="color: Blue;">argvInpFile</span><span style="color: Olive;">[</span><span style="color: Gray;">:</span><span style="color: Blue;">argvInpFile</span><span style="color: Gray;">.</span><span style="color: Blue;">rfind</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">.</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)]</span><span style="color: Gray;">+</span><span style="color: #8b0000;">'</span><span style="color: Red;">.xml</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">foutput</span><span style="color: Gray;">=</span><span style="color: Teal;">open</span><span style="color: Olive;">(</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">w</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">foutput</span><span style="color: Gray;">.</span><span style="color: Blue;">write</span><span style="color: Olive;">(</span><span style="color: Blue;">sxmloutput</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">foutput</span><span style="color: Gray;">.</span><span style="color: Blue;">close</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Converted File: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">+</span><span style="color: #8b0000;">'</span><span style="color: Red;"> Was Successfully Created.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Gray;">,</span><span style="color: Blue;">e</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">e</span><span style="color: Gray;">.</span><span style="color: Blue;">msg</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Error.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">unlink</span><span style="color: Olive;">()</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">close</span><span style="color: Olive;">()</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">argvSw</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">-s</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #ffa500;"># parse xml to sol</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">try</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">d</span><span style="color: Gray;">=</span><span style="color: Blue;">minidom</span><span style="color: Gray;">.</span><span style="color: Blue;">parse</span><span style="color: Olive;">(</span><span style="color: Blue;">argvInpFile</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">IOError</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Could Not Open The Input File: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">argvInpFile</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Error At Parsing XML File Input.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2num</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">NUMBER</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">value</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sValue</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">Infinity</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">7F</span><span style="color: Navy;">\x</span><span style="color: Red;">F0</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sValue</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">-Infinity</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">FF</span><span style="color: Navy;">\x</span><span style="color: Red;">F0</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sValue</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">NaN</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">7F</span><span style="color: Navy;">\x</span><span style="color: Red;">F8</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nValue</span><span style="color: Gray;">=</span><span style="color: Teal;">float</span><span style="color: Olive;">(</span><span style="color: Blue;">sValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;d</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2bol</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">BOOLEAN</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sValue</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">value</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sValue</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">true</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">01</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sValue</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">false</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Boolean Value: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">sValue</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2str</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">STRING</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: #8b0000;">''</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">for</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cData</span><span style="color: Gray;"> </span><span style="color: Green;">in</span><span style="color: Gray;"> </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">childNodes</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cData</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">4</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#CDATA_SECTION_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">cData</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeValue</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">break</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">sCData</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenCData</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sCData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenCData</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenCData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenCData</span><span style="color: Gray;">+</span><span style="color: Blue;">sCData</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2obj</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJOBJ</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">temp</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">1</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#ELEMENT_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">number</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2num</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">boolean</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2bol</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">string</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2str</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2obj</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">array</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2arr</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">date</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2dat</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">xml</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2xml</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">c_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2occ</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">m_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2ojm</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">null</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2nul</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">undefined</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2und</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">type</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nextSibling</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">09</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">temp</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2arr</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJARR</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nArrLength</span><span style="color: Gray;">=</span><span style="color: Teal;">float</span><span style="color: Olive;">(</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">length</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sArrLength</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nArrLength</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sArrLength</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">temp</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">1</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#ELEMENT_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">number</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2num</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">boolean</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2bol</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">string</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2str</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2obj</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">array</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2arr</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">date</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2dat</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">xml</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2xml</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">c_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2occ</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">m_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2ojm</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">null</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2nul</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">undefined</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2und</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">type</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nextSibling</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">09</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">temp</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2dat</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJDATE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nMsec</span><span style="color: Gray;">=</span><span style="color: Teal;">float</span><span style="color: Olive;">(</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">msec</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nMinOffset</span><span style="color: Gray;">=-</span><span style="color: Maroon;">60</span><span style="color: Gray;">*</span><span style="color: Teal;">int</span><span style="color: Olive;">(</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utcoffset</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;dh</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nMsec</span><span style="color: Gray;">,</span><span style="color: Blue;">nMinOffset</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2xml</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJXML</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: #8b0000;">''</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">for</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cData</span><span style="color: Gray;"> </span><span style="color: Green;">in</span><span style="color: Gray;"> </span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">childNodes</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">cData</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">4</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#CDATA_SECTION_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">cData</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeValue</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">break</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCData</span><span style="color: Gray;">=</span><span style="color: Blue;">sCData</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenCData</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sCData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenCData</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenCData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenCData</span><span style="color: Gray;">+</span><span style="color: Blue;">sCData</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2occ</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJCC</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCname</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">class_name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sCname</span><span style="color: Gray;">=</span><span style="color: Blue;">sCname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenCname</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sCname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenCname</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenCname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenCname</span><span style="color: Gray;">+</span><span style="color: Blue;">sCname</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">temp</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">1</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#ELEMENT_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">number</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2num</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">boolean</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2bol</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">string</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2str</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2obj</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">array</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2arr</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">date</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2dat</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">xml</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2xml</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">c_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2occ</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">m_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2ojm</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">null</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2nul</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">undefined</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2und</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">type</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nextSibling</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">09</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">temp</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2ojm</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">OBJM</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2nul</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">NULL</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">def</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">x2und</span><span style="color: Olive;">()</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">sData</span><span style="color: Gray;">,</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">,</span><span style="color: Blue;">sVname</span><span style="color: Gray;">,</span><span style="color: Blue;">c</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">+</span><span style="color: Blue;">sVname</span><span style="color: Gray;">+</span><span style="color: Blue;">UNDEF</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">try</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solxroot</span><span style="color: Gray;">=</span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">tagName</span><span style="color: Gray;">!=</span><span style="color: #8b0000;">'</span><span style="color: Red;">solx</span><span style="color: #8b0000;">'</span><span style="color: Gray;"> </span><span style="color: Green;">or</span><span style="color: Gray;"> </span><span style="color: Teal;">float</span><span style="color: Olive;">(</span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">std_version</span><span style="color: #8b0000;">'</span><span style="color: Olive;">))</span><span style="color: Gray;">&gt;</span><span style="color: Maroon;">0.75</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Not Solx File Or Incorrect File Version.</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sHeader</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">BF</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenData</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sFileType</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">TCSO</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sth1</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">04</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solname</span><span style="color: Gray;">=</span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">sol_name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">solname</span><span style="color: Gray;">=</span><span style="color: Blue;">solname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenSoln</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">solname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenSoln</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenSoln</span><span style="color: Olive;">)</span><span style="color: #ffa500;">#2 bytes</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sth2</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">=</span><span style="color: Blue;">sFileType</span><span style="color: Gray;">+</span><span style="color: Blue;">sth1</span><span style="color: Gray;">+</span><span style="color: Blue;">sLenSoln</span><span style="color: Gray;">+</span><span style="color: Blue;">solname</span><span style="color: Gray;">+</span><span style="color: Blue;">sth2</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">solxroot</span><span style="color: Gray;">.</span><span style="color: Blue;">firstChild</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">while</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nodeType</span><span style="color: Gray;">==</span><span style="color: Maroon;">1</span><span style="color: Gray;">:</span><span style="color: #ffa500;">#ELEMENT_NODE</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">name</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sVname</span><span style="color: Gray;">=</span><span style="color: Blue;">sVname</span><span style="color: Gray;">.</span><span style="color: Blue;">encode</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">utf-8</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">nLenVname</span><span style="color: Gray;">=</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenVname</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;H</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Blue;">nLenVname</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">type</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">getAttribute</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">type</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">number</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2num</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">boolean</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2bol</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">string</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2str</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2obj</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">array</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2arr</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">date</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2dat</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">xml</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2xml</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">c_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2occ</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">m_object</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2ojm</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">null</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2nul</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">elif</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">type</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">undefined</span><span style="color: #8b0000;">'</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">x2und</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">raise</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">Unexpected Data Type: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">type</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sData</span><span style="color: Gray;">+=</span><span style="color: #8b0000;">'</span><span style="color: Navy;">\x</span><span style="color: Red;">00</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">c</span><span style="color: Gray;">=</span><span style="color: Blue;">c</span><span style="color: Gray;">.</span><span style="color: Blue;">nextSibling</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">==</span><span style="color: #8b0000;">''</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">=</span><span style="color: Blue;">argvInpFile</span><span style="color: Olive;">[</span><span style="color: Gray;">:</span><span style="color: Blue;">argvInpFile</span><span style="color: Gray;">.</span><span style="color: Blue;">rfind</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">.</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)]</span><span style="color: Gray;">+</span><span style="color: #8b0000;">'</span><span style="color: Red;">.sol</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">=</span><span style="color: Teal;">open</span><span style="color: Olive;">(</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">wb</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">sLenData</span><span style="color: Gray;">=</span><span style="color: Blue;">pack</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">&gt;L</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: Teal;">len</span><span style="color: Olive;">(</span><span style="color: Blue;">sData</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">write</span><span style="color: Olive;">(</span><span style="color: Blue;">sHeader</span><span style="color: Gray;">+</span><span style="color: Blue;">sLenData</span><span style="color: Gray;">+</span><span style="color: Blue;">sData</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">f</span><span style="color: Gray;">.</span><span style="color: Blue;">close</span><span style="color: Olive;">()</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Converted File: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">argvOutFile</span><span style="color: Gray;">+</span><span style="color: #8b0000;">'</span><span style="color: Red;"> Was Successfully Created.</span><span style="color: #8b0000;">'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">except</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">s2xErr</span><span style="color: Gray;">,</span><span style="color: Blue;">e</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">e</span><span style="color: Gray;">.</span><span style="color: Blue;">msg</span></li>
<li><span style="color: #ffa500;">##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; except:</span></li>
<li><span style="color: #ffa500;">##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print 'Unexpected Error.'</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">d</span><span style="color: Gray;">.</span><span style="color: Blue;">unlink</span><span style="color: Olive;">()</span><span style="color: Gray;">#</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">else</span><span style="color: Gray;">:</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">print</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">Invalid Switch: </span><span style="color: #8b0000;">'</span><span style="color: Gray;">+</span><span style="color: Blue;">argvSw</span></li></ol></div>
<p><strong>リソース</strong><br />
・<a title="http://osflash.org/s2x" href="http://osflash.org/s2x">http://osflash.org/s2x</a>　そこだけs2xに関して資料はまだ残してるようです。。。<br />
<h3>Related Posts</h3>
<ul class="related_post">
<li><a href="http://digitechlog.com/2009/10/04/pyamf-an-amf-actionscript-message-format-decoder-and-encoder-for-python.html" title="PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供する">PyAMF: PythonのためにAdobeのFlash Playerに対応しているサポートアクションメッセージ形式（ AMF ）を提供する</a></li>
<li><a href="http://digitechlog.com/2011/11/03/python-crawler%ef%bc%9apython%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%83%a9%e3%83%bc%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa.html" title="python-crawler：Pythonのクローラーライブラリ">python-crawler：Pythonのクローラーライブラリ</a></li>
<li><a href="http://digitechlog.com/2009/05/12/how-to-use-json-to-exchange-data-in-flex-flash.html" title="JSON(json.as)でFlex／Flashアプリケーションにデータを交換する">JSON(json.as)でFlex／Flashアプリケーションにデータを交換する</a></li>
<li><a href="http://digitechlog.com/2009/04/08/animationpackage-an-actionscript-library-compatible-to-flash-player-6-and-above.html" title="AnimationPackage: Flash Player 6以降サポートされてるActionScriptライブラリ">AnimationPackage: Flash Player 6以降サポートされてるActionScriptライブラリ</a></li>
<li><a href="http://digitechlog.com/2009/02/25/4-ways-to-read-and-write-xml.html" title="JavaでXMLを操作の４種類方法とサンプルソース">JavaでXMLを操作の４種類方法とサンプルソース</a></li>
<li><a href="http://digitechlog.com/2009/02/11/javaswf2-provides-parsing-and-generating-facilities-for-flash-4-and-flash-5-content.html" title="JavaSWF2: JavaによるFlash解析、生成ライブラリ">JavaSWF2: JavaによるFlash解析、生成ライブラリ</a></li>
<li><a href="http://digitechlog.com/2009/02/01/swfmill-is-an-xml2swf-and-swf2xml-processor-with-import-functionalities.html" title="swfmill: swfファイルとXMLファイルを相互変換するオープンソースツール">swfmill: swfファイルとXMLファイルを相互変換するオープンソースツール</a></li>
<li><a href="http://digitechlog.com/2009/01/15/how-to-parse-xml-in-jquery-with-sample-source-code.html" title="jQueryを使ってXMLを解析操作する（サンプルソースコード含める）">jQueryを使ってXMLを解析操作する（サンプルソースコード含める）</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://digitechlog.com/2009/02/22/s2x-is-a-python-script-that-allows-the-sol-file-format-represented-as-xml.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

