how to use method in node(xml)

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Jul 31 08:10:38 EDT 2001


"sdf" <wqh-2 at 263.net> writes:

> I am a newbie to python with xml.  there is a appendchild method in
> Node(I know this from python Document),

> but when I use 
> >>>dir(Node)
> the result is 
> ['ATTRIBUTE_NODE', 'CDATA_SECTION_NODE', 'COMMENT_NODE', 'DOCUMENT_FRAGMENT_NODE', 'DOCUMENT_NODE', 'DOCUMENT_TYPE_NODE', 'ELEMENT_NODE', 'ENTITY_NODE', 'ENTITY_REFERENCE_NODE', 'NOTATION_NODE', 'PROCESSING_INSTRUCTION_NODE', 'TEXT_NODE', '__doc__', '__module__']
> 
> and no appendchild accur,
> it is right to use Node.__doc__
> but how can I use appendchild (wrong appear when 
> use Nod.appendchild).please post an example,better in detail

Where did you get Node from? It works for me:

>>> from xml.dom.minidom import Node
>>> dir(Node)
['__doc__', '__getattr__', '__init__', '__module__', '__nonzero__', '_debug', '_get_firstChild', '_get_lastChild', '_makeParentNodes', 'allnodes', 'appendChild', 'childNodeTypes', 'cloneNode', 'debug', 'hasChildNodes', 'insertBefore', 'isSameNode', 'namespaceURI', 'normalize', 'removeChild', 'replaceChild', 'toprettyxml', 'toxml', 'unlink']

xml.dom.Node is a base class of xml.dom.minidom.Node.

Regards,
Martin



More information about the Python-list mailing list