变量问题
def __init__(self,parentNode,node):
self.__node=node
self.__allChildNodes=[]
tmpTextValue=''
print 000
for item in self.__node.childNodes:
if(item.nodeType==1):
tmpNodeInfo=nodeInfo(self.__node,item)
setattr(tmpNodeInfo,tmpNodeInfo.tagName(),tmpNodeInfo.allChildNodes())
for itemKey in item.attributes.keys():
setattr(tmpNodeInfo,itemKey,item.getAttribute(itemKey))
print 222,tmpTextValue
if(len(tmpTextValue) > 0):
setattr(tmpNodeInfo,'textValue',tmpTextValue)
self.__allChildNodes.append(tmpNodeInfo)
elif item.nodeType==3 and len(item.nodeValue.strip())>0:
tmpTextValue=item.nodeValue.strip()
print 333,tmpTextValue
这是部分打印信息:
0
333 MSXML 5.0 SDK
222
222
tmpTextValue是先赋值的,怎么后面访问是又为空呢?
self.__node=node
self.__allChildNodes=[]
tmpTextValue=''
print 000
for item in self.__node.childNodes:
if(item.nodeType==1):
tmpNodeInfo=nodeInfo(self.__node,item)
setattr(tmpNodeInfo,tmpNodeInfo.tagName(),tmpNodeInfo.allChildNodes())
for itemKey in item.attributes.keys():
setattr(tmpNodeInfo,itemKey,item.getAttribute(itemKey))
print 222,tmpTextValue
if(len(tmpTextValue) > 0):
setattr(tmpNodeInfo,'textValue',tmpTextValue)
self.__allChildNodes.append(tmpNodeInfo)
elif item.nodeType==3 and len(item.nodeValue.strip())>0:
tmpTextValue=item.nodeValue.strip()
print 333,tmpTextValue
这是部分打印信息:
0
333 MSXML 5.0 SDK
222
222
tmpTextValue是先赋值的,怎么后面访问是又为空呢?
...全文
相关推荐
浅析Python多线程下的变量问题
多线程编程中变量问题主要表现在几个方面:1. 全局变量问题:如果多个线程需要访问或修改全局变量,就必须进行适当的同步,通常是通过锁(Lock)来实现。
双变量问题三板斧.pdf
在高中数学的范畴内,双变量问题通常是指涉及两个变量的数学问题,而解决这类问题的常见策略包括构造函数、换元以及同构思想。
kepware关联变量高低顺序问题
在KEPWARE中配置与西门子S7-200系列PLC的通讯时,经常需要解决的一个问题是字节的高低顺序问题,特别是在处理布尔变量时。本篇文章将详细解释这个问题,并提供解决方案。
c语言全局变量和局部变量问题及解决汇总
"这篇文章主要探讨了C语言中的全局变量和局部变量的相关问题,包括它们的命名、引用、存储以及static关键字的应用。"在C语言中,全局变量和局部变量是两种不同作用域的变量,它们各有特点并适用于不
JS变量问题详解
关于变量的问题,除了作用域和声明关键字外,还可能涉及变量提升、作用域链、闭包、全局变量、垃圾回收等概念。由于这些概念相对复杂,对于初学者来说,可能会出现理解上的困难。


