/** * Nulls out unneeded values in an array of StructuredDataNode * objects * * @param sDataNodes */ private static void nullStructuredData(structureddatanode[] sDataNodes) { if (sDataNodes != null) { for (int k = 0; k < sDataNodes.Length; k++) { structureddatanode thisNode = sDataNodes[k]; if (structureddatatype.asset == thisNode.type) { thisNode.text = null; if (thisNode.assetType == "block")//structureddataassettype.block) { if (thisNode.blockId == null && thisNode.blockPath == null) { thisNode.blockPath = ""; } else { thisNode.blockId = null; } // null out the other asset type references thisNode.fileId = null; thisNode.filePath = null; thisNode.pageId = null; thisNode.pagePath = null; thisNode.symlinkId = null; thisNode.symlinkPath = null; thisNode.structuredDataNodes = null; } else if (thisNode.assetType == "file")//structureddataassettype.file) { if (thisNode.fileId == null && thisNode.filePath == null) { thisNode.filePath = ""; } else { thisNode.fileId = null; } // null out the other asset type references thisNode.blockId = null; thisNode.blockPath = null; thisNode.pageId = null; thisNode.pagePath = null; thisNode.symlinkId = null; thisNode.symlinkPath = null; thisNode.structuredDataNodes = null; } else if (thisNode.assetType == "page")//structureddataassettype.page) { if (thisNode.pageId == null && thisNode.pagePath == null) { thisNode.pagePath = ""; } else { thisNode.pageId = null; } // null out the other asset type references thisNode.fileId = null; thisNode.filePath = null; thisNode.blockId = null; thisNode.blockPath = null; thisNode.symlinkId = null; thisNode.symlinkPath = null; thisNode.structuredDataNodes = null; } else if (thisNode.assetType == "symlink")//structureddataassettype.symlink) { if (thisNode.symlinkId == null && thisNode.symlinkPath == null) { thisNode.symlinkPath = ""; } else { thisNode.symlinkId = null; } // null out the other asset type references thisNode.fileId = null; thisNode.filePath = null; thisNode.pageId = null; thisNode.pagePath = null; thisNode.blockId = null; thisNode.blockPath = null; thisNode.structuredDataNodes = null; } } else if (structureddatatype.group == thisNode.type) { structureddatanode[] sDataNodeArray = thisNode.structuredDataNodes; nullStructuredData(sDataNodeArray); thisNode.text = null; thisNode.assetType = null; // null out the other asset type references thisNode.blockId = null; thisNode.blockPath = null; thisNode.fileId = null; thisNode.filePath = null; thisNode.pageId = null; thisNode.pagePath = null; thisNode.symlinkId = null; thisNode.symlinkPath = null; thisNode.recycled = null; } else if (structureddatatype.text == thisNode.type) { thisNode.assetType = null; thisNode.structuredDataNodes = null; if (thisNode.text == null) { thisNode.text = ""; } // null out the other asset type references thisNode.blockId = null; thisNode.blockPath = null; thisNode.fileId = null; thisNode.filePath = null; thisNode.pageId = null; thisNode.pagePath = null; thisNode.symlinkId = null; thisNode.symlinkPath = null; thisNode.structuredDataNodes = null; thisNode.recycled = null; } else { thisNode.assetType = null; thisNode.text = null; } } } }
public static string printStructuredDataNodes(structureddatanode[] sdNodes) { string val = "<li>structuredDataNodes = "; if (sdNodes != null && sdNodes.Length > 0) { foreach (structureddatanode node in sdNodes) { val += "<ul><li>NODE = </li><li><ul>"; val += "<li>assetType = " + node.assetType + "</li>"; val += "<li>blockId = " + node.blockId + "</li>"; val += "<li>blockPath = " + node.blockPath + "</li>"; val += "<li>fileId = " + node.fileId + "</li>"; val += "<li>filePath = " + node.filePath + "</li>"; val += "<li>identifier = " + node.identifier + "</li>"; val += "<li>pageId = " + node.pageId + "</li>"; val += "<li>pagePath = " + node.pagePath + "</li>"; val += "<li>recycled = " + node.recycled + "</li>"; val += printStructuredDataNodes(node.structuredDataNodes); val += "<li>symlinkId = " + node.symlinkId + "</li>"; val += "<li>symlinkPath = " + node.symlinkPath + "</li>"; val += "<li>text = " + node.text + "</li>"; val += "<li>type = " + node.type + "</li>"; val += "</ul></li></ul>"; } } else { val += "empty"; } val += "</li>"; return val; }