private void ProcessBSCSignalTreeNode( dbSignal signal, XmlDocument document, XmlElement parentElement )
{
if (signal != null)
{
XmlElement basElement = document.CreateElement(signal.signalName);
XmlAttribute id = document.CreateAttribute("id");
XmlAttribute xmlns = document.CreateAttribute("xmlns");
XmlAttribute uuid = document.CreateAttribute("uuid");
id.Value = signal.signalId.ToString();
xmlns.Value = signal.xmlns;
uuid.Value = signal.uuid==null?"":signal.uuid.ToString();
basElement.Attributes.Append(id);
basElement.Attributes.Append(xmlns);
basElement.Attributes.Append(uuid);
foreach (dbSignalAttribute attribute in signal.Attributes)
{
XmlAttribute att = document.CreateAttribute(attribute.attributeName);
att.Value = attribute.Value;
basElement.Attributes.Append(att);
}
if (parentElement == null)
document.AppendChild(basElement);
else
parentElement.AppendChild(basElement);
foreach (dbSignal child in signal.ChildSignals)
{
ProcessBSCSignalTreeNode(child, document, basElement);
}
if (signal.signalName.Equals("TSF"))
{
//Process TSFs
List<dbTSFLibrary> tsfs = getTSFLibraries();
foreach (dbTSFLibrary dbTsfLibrary in tsfs)
{
XmlElement lElement = document.CreateElement(dbTsfLibrary.libraryName);
List<dbTSFSignal> sigs = getTSFLibrarySignals(dbTsfLibrary.id);
foreach (dbTSFSignal dbTsfSignal in sigs )
{
dbSignal tsfSignal = getSignal(dbTsfSignal.signalName, dbTsfLibrary.targetNamespace);
ProcessBSCSignalTreeNode(tsfSignal, document, lElement );
}
basElement.AppendChild(lElement);
}
}
}
}