Index: trunk/src/scriptbuilder/structures/CadData.java
===================================================================
--- trunk/src/scriptbuilder/structures/CadData.java	(revision 39)
+++ trunk/src/scriptbuilder/structures/CadData.java	(revision 43)
@@ -28,4 +28,6 @@
     public String Master_Inc_Num = "";
 
+    public String P = "";
+
     public String Info_Type = "";
 
@@ -37,20 +39,20 @@
 
     public String General_Text = "";
-    
+
     public String Location_Beat = "";
-    
+
+    public String Location_Address = "";
+
     public String Location_Loc = "";
-    
+
+    public String Location_City = "";
+
+    public String Location_Area = "";
+
     public String Location_Fire = "";
-    
+
     public String Location_Law = "";
-    
+
     public String Location_Ems = "";
-    
-    public String Location_City = "";
-    
-    public String Location_Address = "";
-    
-    public String Location_Area = "";
 
     public ArrayList<Location_Info> locInfo;
@@ -59,5 +61,135 @@
     public String toXML()
     {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        String output = "";
+
+        if (!Master_Inc_Num.equals(""))
+        {
+            output += openTag(ELEMENT.MASTER_INC_NUM.tag);
+            output += Master_Inc_Num;
+            output += closeTag(ELEMENT.MASTER_INC_NUM.tag);
+        }
+
+        if (!P.equals(""))
+        {
+            output += openTag(ELEMENT.P.tag);
+            output += P;
+            output += closeTag(ELEMENT.P.tag);
+        }
+
+        if (hasAdditionalInfo())
+        {
+            output += openTag(ELEMENT.ADDITIONAL_INFO.tag);
+            output += openTag(ELEMENT.TYPE_CODE.tag);
+            output += Info_Type_Code;
+            output += closeTag(ELEMENT.TYPE_CODE.tag);
+            output += openTag(ELEMENT.TYPE.tag);
+            output += Info_Type;
+            output += closeTag(ELEMENT.TYPE.tag);
+            output += closeTag(ELEMENT.ADDITIONAL_INFO.tag);
+        }
+
+        if (hasLocation())
+        {
+            output += openTag(ELEMENT.LOCATION.tag);
+            if (!Location_Beat.equals(""))
+            {
+                output += openTag(ELEMENT.BEAT.tag);
+                output += Location_Beat;
+                output += closeTag(ELEMENT.BEAT.tag);
+            }
+
+            if (!Location_Address.equals(""))
+            {
+                output += openTag(ELEMENT.ADDRESS.tag);
+                output += Location_Address;
+                output += closeTag(ELEMENT.ADDRESS.tag);
+            }
+
+            if (!Location_Loc.equals(""))
+            {
+                output += openTag(ELEMENT.LOC.tag);
+                output += Location_Loc;
+                output += closeTag(ELEMENT.LOC.tag);
+            }
+
+            if (!Location_City.equals(""))
+            {
+                output += openTag(ELEMENT.CITY.tag);
+                output += Location_City;
+                output += closeTag(ELEMENT.CITY.tag);
+            }
+
+            if (!Location_Area.equals(""))
+            {
+                output += openTag(ELEMENT.AREA.tag);
+                output += Location_Area;
+                output += closeTag(ELEMENT.AREA.tag);
+            }
+
+            if (!Location_Fire.equals(""))
+            {
+                output += openTag(ELEMENT.FIRE.tag);
+                output += Location_Fire;
+                output += closeTag(ELEMENT.FIRE.tag);
+            }
+
+            if (!Location_Law.equals(""))
+            {
+                output += openTag(ELEMENT.LAW.tag);
+                output += Location_Law;
+                output += closeTag(ELEMENT.LAW.tag);
+            }
+
+            if (!Location_Ems.equals(""))
+            {
+                output += openTag(ELEMENT.EMS.tag);
+                output += Location_Ems;
+                output += closeTag(ELEMENT.EMS.tag);
+            }
+
+            output += closeTag(ELEMENT.LOCATION.tag);
+        }
+
+        if (!Agy.equals(""))
+        {
+            output += openTag(ELEMENT.GENERAL.tag);
+            output += openTag(ELEMENT.AGY.tag);
+            output += Agy;
+            output += closeTag(ELEMENT.AGY.tag);
+            output += closeTag(ELEMENT.GENERAL.tag);
+        }
+
+        if (hasHeaderInfo())
+        {
+            output += openTag(ELEMENT.HEADER_INFO.tag);
+
+            output += openTag(ELEMENT.Type.tag);
+            output += Header_Type;
+            output += closeTag(ELEMENT.Type.tag);
+
+            output += openTag(ELEMENT.Beat.tag);
+            output += Header_Beat;
+            output += closeTag(ELEMENT.Beat.tag);
+
+            output += openTag(ELEMENT.TruncLoc.tag);
+            output += Header_TruncLoc;
+            output += closeTag(ELEMENT.TruncLoc.tag);
+
+            output += openTag(ELEMENT.FullLoc.tag);
+            output += Header_FullLoc;
+            output += closeTag(ELEMENT.FullLoc.tag);
+
+            output += closeTag(ELEMENT.HEADER_INFO.tag);
+        }
+
+        if (locInfo.size() > 0)
+        {
+            for (Location_Info li : locInfo)
+            {
+                output += li.toXML();
+            }
+        }
+
+        return output;
     }
 
@@ -65,5 +197,5 @@
     public String openTag(String s)
     {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        return "<" + s + ">";
     }
 
@@ -71,5 +203,5 @@
     public String closeTag(String s)
     {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        return "</" + s + ">\n";
     }
 
@@ -77,5 +209,29 @@
     public String emptyTag(String s)
     {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        return "<" + s + "/>\n";
+    }
+
+    public boolean hasHeaderInfo()
+    {
+        return !Header_Type.equals("") || !Header_Beat.equals("")
+                || !Header_FullLoc.equals("") || !Header_TruncLoc.equals("");
+    }
+
+    public boolean hasLocation()
+    {
+        return !Location_Address.equals("") || !Location_Area.equals("")
+                || !Location_Beat.equals("") || !Location_City.equals("")
+                || !Location_Ems.equals("") || !Location_Fire.equals("")
+                || !Location_Law.equals("") || !Location_Loc.equals("");
+    }
+
+    public boolean hasGeneralInfo()
+    {
+        return !General_Text.equals("") || !General_Title.equals("");
+    }
+
+    public boolean hasAdditionalInfo()
+    {
+        return !Info_Type.equals("") || !Info_Type_Code.equals("");
     }
 
