Adverti horiz upsell

xml_lib.mel 1.1.0 for Maya (maya script)

XML parsing for MEL

License
Button download
1,463 Downloads

Compatibility

  • 7.x, 6.x, 5.x

Operating Systems

  • Irix
  • Linux
  • Mac
  • Windows

History

Created:03/16/2006
Last Modified:03/16/2006
File Size: 34.1 KB
xml_lib.mel is very different from most MEL scripts, in that it is meant to be used as a libary rather than being called directly. By including xml_lib in your own scripts, you will be able to load XML data into a Maya scene and utilize it in any way you choose.

The xml_lib script loads data into a scene by creating a number of transform nodes. The data (both attributes within tags and raw text) contained in the XML file is stored in various custom attributes residing on the various nodes. The transform nodes are basically being used as a way of getting MEL to work in a more object-orientated fashion. For a more thourough description of that approach, have a look at my article on faking object-orientated programming in MEL, available here

The nodes are arranged in a hierarchy to represent the nesting order of tags in the document. Here's an example of a simple XML file and the resulting heirarchy in Maya:

click for larger version

All of the created nodes have a "type" attribute added to them. In this case, there is one with a type of XMLfile, two of type "object", and two of type" subname. "Foo" and "Hello", since they are attributes within the object tag, are stored in attribute of type name (the same as the name of the attribute listed in the tag). "Bar" and "World", on the other hand, are both raw text within a subname tag. As a result, they are stored into the hierarchy in a "data" attribute on the two subname nodes.



Please use the Bug System to report any bugs.
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.

People who favorited this item:

  • josemonet
    josemonet