using .Net to implement Collada tools


I just started to write a tool for translating Collada
files using .Net with C#. So far so good.

(Maya)->Collada XML->ColladaTrans->(PSP Text Format)GMS

I’m currently using Visual Studio .Net but the C# code
should be portable to the opensource implementation
of .Net (

I’ll post more info as I go along.



You should have no problem, this is a very good approach.
I have seen other COLLADA projects using this approach successfully.
No need for the COLLADA API in C#

– Remi

I have noticed that .NET 2003 code generation from XML schema is limited and can’t process the COLLADA schema. .NET 2005 Beta2 handles it well though. Also XMLSPY 2005 works too.

Thanks for the heads-up. I’m actually just using XmlTextReader class to populate a TreeView for now. But I’ll be using the XmlDocument class for actual processing.

Here’s a code snippet that might be helpful…

if( openColladaFileDialog.ShowDialog() == DialogResult.OK )
   // open xml document
   //   parse xml document
   //   store node data inside tree view
   //     -- use a Stack to keep track of the depth in the TreeView
   Stack nodeCollectionStack = new Stack();
   System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(openColladaFileDialog.FileName);
   System.Windows.Forms.TreeNodeCollection curNodes = xmlTreeView.Nodes;

   statusBar.Text = "Parsing " + openColladaFileDialog.FileName;

   curNodes.Add(new TreeNode(openColladaFileDialog.FileName));


   curNodes = curNodes[curNodes.Count-1].Nodes;
   while (reader.Read())
        bool emptyElement = reader.IsEmptyElement;

	switch (reader.NodeType)
	     case System.Xml.XmlNodeType.Element: 
		  curNodes.Add(new TreeNode(reader.Name));	
		  curNodes = curNodes[curNodes.Count-1].Nodes;
		  while (reader.MoveToNextAttribute()) 
		        curNodes.Add(new TreeNode(reader.Name + " = " + reader.Value));
		  if( emptyElement )
		       curNodes = (System.Windows.Forms.TreeNodeCollection) nodeCollectionStack.Pop();
	    case System.Xml.XmlNodeType.EndElement: 
		curNodes = (System.Windows.Forms.TreeNodeCollection) nodeCollectionStack.Pop();

  // Begin repainting the TreeView.
  statusBar.Text = "Done " + openColladaFileDialog.FileName;