MaXML 2.0 Released!

BlitzMax Forums/BlitzMax Programming/MaXML 2.0 Released!

John,

I'm trying MaXML, but if I load my file over and over I eventually get an error or odd results. Is there any bugs I should be aware of? Here is my module:

	Method LoadXmlMap:TSector(sMapName:String, pTGamePlayManager:TGamePlayScreen) 
		
		Try
			'Create a new XML document object and load data from the example.xml file.
			Local pXmlDocument:xmlDocument = Null  
			Local pHeaderXmlNode:xmlNode   = Null           
			Local pSectorXmlNode:xmlNode   = Null
			Local pStarshipXmlNode:xmlNode = Null  
			Local sTitle:String  
			Local sAuthor:String 
			Local sDescription:String 
			Local iSectorOID:Int  
			Local sSectorName:String    
			Local iSectorX:Int, iSectorY:Int
			Local iStarshipX:Int, iStarshipY:Int 
			Local iHullOID:Int, iPlayerOID:Int 
			Local pTSector:TSector                                   = Null
			Local pTPlayer:TPlayer                                   = Null 
			Local pTShieldIndicator:TShieldIndicator                 = Null   
			Local pTStarship:TStarship                               = Null 
			Local pTHull:THull                                       = Null 
			Local pTVehicleFlockingStrategy:TVehicleFlockingStrategy = Null

			pXmlDocument = New xmlDocument 

			'Load "example1.xml" into doc1
			pXmlDocument.Load("xml/" + sMapName)

			pHeaderXmlNode = pXmlDocument.Root().FindChild("Header")		
			sTitle = pHeaderXmlNode.FindChild("Title").Value
			sAuthor = pHeaderXmlNode.FindChild("Author").Value
			sDescription = pHeaderXmlNode.FindChild("Description").Value
            
			'-------------------------------------------
			'Find the node that contains the XML Sector.
			'-------------------------------------------
			pSectorXmlNode = pXmlDocument.Root().FindChild("Sector")
			
			While pSectorXmlNode <> Null
				If pSectorXmlNode.name = "Sector" Then
				
					iSectorOID = Int(pSectorXmlNode.FindChild("OID").Value)
					Print "Reading XML SectorOID = " + iSectorOID
					
					sSectorName = pSectorXmlNode.FindChild("Name").Value   
					iSectorX = Int(pSectorXmlNode.FindChild("X").Value)
					iSectorY = Int(pSectorXmlNode.FindChild("Y").Value)
					
					'Create the Sector.			
					pTSector = New TSector  
					pTSector.Initialize(pTGamePlayManager.m_pTGalaxy, iSectorOID)
					pTSector.SetPosition(iSectorX, iSectorY)

					'Get the Next Node
					pStarshipXmlNode = pSectorXmlNode.FindChild("Starship")
					
					While pStarshipXmlNode <> Null 
					
						Print "Loading Starship"
						iStarshipX = Int(pStarshipXmlNode.FindChild("X").Value)	
						iStarshipY = Int(pStarshipXmlNode.FindChild("Y").Value)	
						iHullOID   = Int(pStarshipXmlNode.FindChild("HullOID").Value)	
						iPlayerOID = Int(pStarshipXmlNode.FindChild("PlayerOID").Value)	
	
						'Create the Starship.
						pTShieldIndicator = TEntityFactory.GetInstance().CreateShieldIndicator()
						pTHull = TComponentFactory.GetInstance().GetHull(iHullOID).Clone()
						pTPlayer = pTGamePlayManager.GetPlayer(iPlayerOID) 						
						pTStarship = TEntityFactory.GetInstance().CreateStarship(iStarshipX, iStarshipY, iHullOID, pTPlayer, pTShieldIndicator, pTHull, pTSector)
						pTStarship.Launch()
	
						'Create the Starship Strategy.
						pTVehicleFlockingStrategy = New TVehicleFlockingStrategy
						pTVehicleFlockingStrategy.Initialize(pTStarship)
						pTStarship.SetStrategy(pTVehicleFlockingStrategy)	
						
						pStarshipXmlNode = pStarshipXmlNode.NextSibling()	'Get the next node	 
						If pStarshipXmlNode <> Null
							Print pStarshipXmlNode.name
						End If
					Wend
						
				End If
		
				pSectorXmlNode = pSectorXmlNode.NextSibling()	'Get the next node   
			Wend
			
			'Close the xml file by freeing the xml document
			pXmlDocument = Null

			GCCollect
		     		     
	    Catch ex:Object
			Throw("TLevelBuilder.LoadXmlLevel - " + ex.ToString())
		End Try
		
	End Method


Works must of the time?