<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python´s xml.dom.minidom and Maya in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/python-s-xml-dom-minidom-and-maya/m-p/4261209#M14971</link>
    <description>Hi Folks,&lt;BR /&gt;&lt;BR /&gt;has anyone of you experience with &lt;BR /&gt;Python´s &lt;B&gt;xml.dom.minidom&lt;/B&gt; and Maya.&lt;BR /&gt;&lt;BR /&gt;I want to export some Maya Attributes (Int,String,Float)&lt;BR /&gt;via Python in a XML-File.&lt;BR /&gt;I didn´t find any good howTo/Tutorial on the Web which explains me all the syntax in a&lt;BR /&gt;Dummie-fashion-way.&lt;BR /&gt;&lt;BR /&gt;Thanks for any Links/help,&lt;BR /&gt;&lt;BR /&gt;Cheers, 5inch</description>
    <pubDate>Fri, 24 Aug 2012 07:53:40 GMT</pubDate>
    <dc:creator>5inch</dc:creator>
    <dc:date>2012-08-24T07:53:40Z</dc:date>
    <item>
      <title>Python´s xml.dom.minidom and Maya</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-s-xml-dom-minidom-and-maya/m-p/4261209#M14971</link>
      <description>Hi Folks,&lt;BR /&gt;&lt;BR /&gt;has anyone of you experience with &lt;BR /&gt;Python´s &lt;B&gt;xml.dom.minidom&lt;/B&gt; and Maya.&lt;BR /&gt;&lt;BR /&gt;I want to export some Maya Attributes (Int,String,Float)&lt;BR /&gt;via Python in a XML-File.&lt;BR /&gt;I didn´t find any good howTo/Tutorial on the Web which explains me all the syntax in a&lt;BR /&gt;Dummie-fashion-way.&lt;BR /&gt;&lt;BR /&gt;Thanks for any Links/help,&lt;BR /&gt;&lt;BR /&gt;Cheers, 5inch</description>
      <pubDate>Fri, 24 Aug 2012 07:53:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-s-xml-dom-minidom-and-maya/m-p/4261209#M14971</guid>
      <dc:creator>5inch</dc:creator>
      <dc:date>2012-08-24T07:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python´s xml.dom.minidom and Maya</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/python-s-xml-dom-minidom-and-maya/m-p/4261210#M14972</link>
      <description>I am not in front of Maya so there may be some minor syntax errors, but the code below should give you some guidance...&lt;BR /&gt;&lt;BR /&gt;hope it helps&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;import xml.dom.minidom as xml&lt;BR /&gt;import pymel.core as pm&lt;BR /&gt;&lt;BR /&gt;## Create the xml document node which gives&lt;BR /&gt;## us access to everything&lt;BR /&gt;xml_doc = xml.Document()&lt;BR /&gt;&lt;BR /&gt;## Create the first ( root ) xml node. The argument is&lt;BR /&gt;## the node name. We then need to make the node a&lt;BR /&gt;## child of the document&lt;BR /&gt;xml_root = xml_doc.createElement( "Object" )&lt;BR /&gt;xml_doc.appendChild( xml_root )&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;## Cycle through all the attributes of the selected&lt;BR /&gt;## object&lt;BR /&gt;for obj in pm.selected() :&lt;BR /&gt;    &lt;BR /&gt;    ## Create a node for each selected object&lt;BR /&gt;    xml_obj = xml_doc.createElement( "Object")&lt;BR /&gt;    xml_obj.setAttribute( 'name', obj.name() )&lt;BR /&gt;&lt;BR /&gt;    ## Now cycle the attributes for this object&lt;BR /&gt;    for attr in obj.listAttr() :&lt;BR /&gt;&lt;BR /&gt;        ## Create an xml nde to represent the attribute&lt;BR /&gt;        xml_attr = xml_doc.createNode( 'Attribute' )&lt;BR /&gt;        xml_attr.setAttribute( 'name', attr.name() )&lt;BR /&gt;        xml_attr.setAttribute( 'type', attr.type() )&lt;BR /&gt;    &lt;BR /&gt;        ## we'll store the value as a text node&lt;BR /&gt;        text_xml = xml_doc.createTextNode( str(attr.get()))&lt;BR /&gt;&lt;BR /&gt;        ## set the node parenting&lt;BR /&gt;        xml_attr.appendChild( text_xml )&lt;BR /&gt;        obj.appendChild( xml_attr )&lt;BR /&gt;    &lt;BR /&gt;    ## set the object node as a child of the root&lt;BR /&gt;    xml_root.appendChild( xml_obj )&lt;BR /&gt;f = open( r"c:\test.xml" )&lt;BR /&gt;f.write( xml_doc.toprettyxml() )&lt;BR /&gt;f.close()&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Sep 2012 08:25:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/python-s-xml-dom-minidom-and-maya/m-p/4261210#M14972</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-06T08:25:46Z</dc:date>
    </item>
  </channel>
</rss>

