/// <summary> /// Ritorna la credenziale di firma (completa di tutte le sue componenti, quindi slot, id smart-card, PIN, ...) /// in forma di nodo Xml. /// </summary> /// <param name="xmlCredential">In uscita contiene la credenziale; se in ingresso non è null, /// viene rimpiazzato, altrimenti viene creato da zero.</param> /// <param name="bAskFor">true per richiedere all'utente di impostare la credenziale, /// false per tornare la credenziale corrente</param> public void GetCredential(ref System.Xml.XmlElement xmlCredential, bool bAskFor) { MSXML2.IXMLDOMElement comXmlCredential = null; // Da System.Xml.XmlElement a MSXML2.IXMLDOMElement if (xmlCredential != null) { MSXML2.IXMLDOMDocument comXmlDoc = new MSXML2.DOMDocument30(); comXmlDoc.loadXML(xmlCredential.OuterXml); comXmlCredential = comXmlDoc.documentElement; } // Chiamata effettiva CheckScResult( NativeMethods.SvScGetCredential(signSCHandle, ref comXmlCredential, bAskFor, "")); // Da MSXML2.IXMLDOMElement a System.Xml.XmlElement System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(comXmlCredential.xml); if (xmlCredential == null) { xmlCredential = xmlDoc.DocumentElement; } else { xmlCredential.OwnerDocument.InsertAfter(xmlDoc.DocumentElement, xmlCredential); xmlCredential.ParentNode.RemoveChild(xmlCredential); } }
/// <summary> /// 給属性赋值 /// </summary> /// <param name="nd">IXMLDOMElement节点</param> /// <param name="name">字段名</param> /// <param name="value">字段值</param> public static void setAttribute(MSXML2.IXMLDOMElement nd, string name, object value) { string strValue = ""; if (value != null && value != DBNull.Value) { strValue = value.ToString(); } nd.setAttribute(name, strValue); }
// saves and closes XML document private void SaveAndCloseDocument(MSXML2.IXMLDOMElement responseElem, MSXML2.IXMLDOMDocument document) { document.async = false; // create Processing Instruction for XML documdnt MSXML2.IXMLDOMProcessingInstruction procsInstruct = document.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"utf-8\""); // create primary element MSXML2.IXMLDOMElement elem = document.createElement("p2p_lng"); // add response object passed to the primary element as child node elem.appendChild(responseElem); // add Processing Instruction object and primary object to document // object passed as child nodes and save the document document.appendChild(procsInstruct); document.appendChild(elem); document.save(ResponsPath); }
/// <summary> /// Imposta la credenziale di firma a partire da un Xml precedentemente generato dalla GetCredential. /// </summary> /// <param name="xmlCredential">Xml generato dalla GetCredential</param> /// <param name="bCompleteCredential">True se la credenziale impostata è completa e /// si può firmare in batch senza l'intervento dell'utente</param> public void SetCredential(System.Xml.XmlElement xmlCredential, out bool bCompleteCredential) { if (xmlCredential == null) { throw new ArgumentException("Null parameter", "xmlCredential"); } // Da System.Xml.XmlElement a MSXML2.IXMLDOMElement MSXML2.IXMLDOMElement comXmlCredential = null; MSXML2.IXMLDOMDocument comXmlDoc = new MSXML2.DOMDocument30(); comXmlDoc.loadXML(xmlCredential.OuterXml); comXmlCredential = comXmlDoc.documentElement; // Chiamata effettiva CheckScResult( NativeMethods.SvScSetCredential(signSCHandle, comXmlCredential, out bCompleteCredential)); }
// writes request XML according to the parameter passed public void WriteRequest(string type, string searchValue, string mask) { // create a document object MSXML2.IXMLDOMDocument document = CreateDocument(); // create request element MSXML2.IXMLDOMElement requestElem = document.createElement("request"); // set attributes of request element requestElem.setAttribute("type", type); // if one of these kinds of request is to be made // specify the filename and pertaining info too. if (type.CompareTo("SHOWFILES") != 0) { string ReqType = ""; if (type.CompareTo("CHAT") == 0) { ReqType = "message"; } else { ReqType = "scope"; } MSXML2.IXMLDOMElement file_infoElem = document.createElement(ReqType.ToString()); if (type.CompareTo("CHAT") == 0) { file_infoElem.setAttribute("sendername", searchValue.Substring(0, searchValue.IndexOf("("))); file_infoElem.setAttribute("senderIP", searchValue.Substring(searchValue.IndexOf("(") + 1).Substring(0, searchValue.Substring(searchValue.IndexOf("(") + 1).Length - 1)); file_infoElem.setAttribute("chatmsg", mask); } else { file_infoElem.setAttribute("type", searchValue); file_infoElem.setAttribute("mask", mask); } requestElem.appendChild(file_infoElem); } // close and save the documdent SaveAndCloseDocument(requestElem, document); }
// The following CreateBasicXMLItmesForSchematicElt private procedure is used to create the first expected XML items for a XML NodeFeature or LinkFeature private void CreateBasicXMLItemsForSchematicElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElement, string inEltTypeName) { MSXML2.IXMLDOMElement xmlElt_EltTypeName; MSXML2.IXMLDOMElement xmlElt_ExternalUID; MSXML2.IXMLDOMElement xmlElt_DatasourceName; MSXML2.IXMLDOMElement xmlElt_UCID; MSXML2.IXMLDOMElement xmlElt_UOID; // Specifying its FeatureClassName xmlElt_EltTypeName = outDOMDoc.createElement("FeatureClassName"); outXMLElement.appendChild(xmlElt_EltTypeName); if (inFeature.Fields.FindField("Feeder") != -1) { xmlElt_EltTypeName.nodeTypedValue = inEltTypeName + "sFeeder" + inFeature.get_Value(inFeature.Fields.FindField("Feeder")).ToString(); } else { xmlElt_EltTypeName.nodeTypedValue = inEltTypeName + "s"; } // Specifying its ExternalUniqueID xmlElt_ExternalUID = outDOMDoc.createElement("ExternalUniqueID"); outXMLElement.appendChild(xmlElt_ExternalUID); xmlElt_ExternalUID.nodeTypedValue = inEltTypeName + "-" + inFeature.OID.ToString(); // Specifying its DatasourceName xmlElt_DatasourceName = outDOMDoc.createElement("DatasourceName"); outXMLElement.appendChild(xmlElt_DatasourceName); xmlElt_DatasourceName.nodeTypedValue = "XMLDataSource"; // Specifying its UCID xmlElt_UCID = outDOMDoc.createElement("UCID"); outXMLElement.appendChild(xmlElt_UCID); xmlElt_UCID.nodeTypedValue = inFeature.Class.ObjectClassID; // Add UOID to NodeElement xmlElt_UOID = outDOMDoc.createElement("UOID"); outXMLElement.appendChild(xmlElt_UOID); xmlElt_UOID.nodeTypedValue = inFeature.OID; }
// writes error XML responses public void WriteErrorResponse(string error) { // create a document object MSXML2.IXMLDOMDocument document = CreateDocument(); // create response and error info elements MSXML2.IXMLDOMElement responseElem = document.createElement("response"); MSXML2.IXMLDOMElement errorInfoElem = document.createElement("errorinfo"); // set attribute of response element responseElem.setAttribute("type", "ERROR"); // set attribute of errorinfo element errorInfoElem.setAttribute("errorcode", "1"); errorInfoElem.setAttribute("severity", "Error"); errorInfoElem.setAttribute("description", error); // add errorinfo element to response object as a child responseElem.appendChild(errorInfoElem); // save the document SaveAndCloseDocument(responseElem, document); }
// The following CompleteXMLEltByProperties private procedure is used to create all the expected propertyset properties listed in the input PropertiesArray array private void CompleteXMLEltByProperties(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElement, string[] propertiesArray) { int i = 0; MSXML2.IXMLDOMElement xmlPropertySet; MSXML2.IXMLDOMElement xmlPropertyArray; MSXML2.IXMLDOMElement xmlPropertySetProperty; MSXML2.IXMLDOMElement xmlProperty_Key; MSXML2.IXMLDOMElement xmlProperty_Value; if (propertiesArray.Length > 0) { //-------- PropertySet Section START -------- // Creating the PropertySet element for the input outXMLElement xmlPropertySet = outDOMDoc.createElement("PropertySet"); outXMLElement.appendChild(xmlPropertySet); // Creating the PropertyArray element xmlPropertyArray = outDOMDoc.createElement("PropertyArray"); xmlPropertySet.appendChild(xmlPropertyArray); while (i < propertiesArray.Length) { // Creating the i PropertySetProperty xmlPropertySetProperty = outDOMDoc.createElement("PropertySetProperty"); xmlPropertyArray.appendChild(xmlPropertySetProperty); // Specifying the key && value field related to that i PropertySetProperty xmlProperty_Key = outDOMDoc.createElement("Key"); xmlPropertySetProperty.appendChild(xmlProperty_Key); xmlProperty_Key.nodeTypedValue = propertiesArray[i].ToString(); xmlProperty_Value = outDOMDoc.createElement("Value"); xmlPropertySetProperty.appendChild(xmlProperty_Value); xmlProperty_Value.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField(propertiesArray[i].ToString())); i += 1; } } //-------- PropertySet Section END -------- }
private void WriteShowfileResponse(string reqType) { // create a document object MSXML2.IXMLDOMDocument document = CreateDocument(); // create response and error info elements MSXML2.IXMLDOMElement responseElem = document.createElement("response"); // set attribute of response element responseElem.setAttribute("type", reqType); // open share.ini for reading StreamReader readfile = new StreamReader(SharedResourceInfoPath); string readData; // read entire file while ((readData = readfile.ReadLine()) != null) { try { // for each entry in share .ini create a fileinfo element // and fill it with required information MSXML2.IXMLDOMElement file_infoElem = document.createElement("fileinfo"); int index = readData.IndexOf("=", 0); file_infoElem.setAttribute("filename", readData.Substring(0, index)); file_infoElem.setAttribute("mask", readData.Substring(index + 1, 1)); int secindex = -1; if (-1 != (secindex = readData.IndexOf("=", index + 1))) { file_infoElem.setAttribute("filesize", readData.Substring(secindex + 1)); } // add this element to response element as child responseElem.appendChild(file_infoElem); } catch (Exception e) { MessageBox.Show("Problem faced while responding : " + e.Message); } } // close and save the documdent SaveAndCloseDocument(responseElem, document); }
bool SvScGetCredential( [MarshalAs(UnmanagedType.U4)] uint hSignSC, /*[MarshalAs(UnmanagedType.IDispatch)]*/ ref MSXML2.IXMLDOMElement xml, [MarshalAs(UnmanagedType.Bool)] bool bAskFor, [MarshalAs(UnmanagedType.LPStr)] string sAskOnlyForThisAttribute);
/// <summary> /// Actual Parsing of ERROR XML /// </summary> /// <param name="Filename"> </param> /// <param name="outStruct"> </param> protected int ParseERRORXML(string Filename, out XMLSTRUCT outStruct) { // initializes all the required variables InitVariables(); // Initialize outStruct variable of this function outStruct = new XMLSTRUCT(); // Process the XML document syncronously document.async = false; // load the xml document in memory for parsing if (document.load(Filename)) { // get the first element of the XML element = document.documentElement; // get the first child of the element node = element.firstChild; // extracts the node list present under the node nodeList = node.childNodes; // iTags will assigns to the number of nodes present // in node list iTags = nodeList.length; // Initialize the ERROR sructure of the outStruct // variable outStruct.ERROR = new XMLSTRUCT.__ERROR(); // move the node to the next node of the nodelist node = nodeList.nextNode(); // Extract each value from its specific node for (iCounter = 0; iCounter < iTags; iCounter++) { // gets the attribute map that is how many attributes // are present in the node nodeMap = node.attributes; // extract the next node from the node map ChildNode = nodeMap.nextNode(); // The following 9 lines of code will extract the // various attribute values from the XML node // and fills it to the outStruct's corresponding // structure do { if (0 == ChildNode.nodeName.CompareTo("errorcode")) { outStruct.ERROR.iErrCode = Convert.ToInt32(ChildNode.nodeValue); } else if (0 == ChildNode.nodeName.CompareTo("severity")) { outStruct.ERROR.sSeverity = ChildNode.nodeValue.ToString(); } else if (0 == ChildNode.nodeName.CompareTo("description")) { outStruct.ERROR.sDescription = ChildNode.nodeValue.ToString(); } } while(null != (ChildNode = nodeMap.nextNode())); // now move to next node node = nodeList.nextNode(); } } // Return the number of nodes parsed for the values return(iCounter == iTags?iCounter:0); }
// The following CreateXMLLNodeElt private procedure is used to create all the expected // XML items for a XML NodeFeature related to a Station or Feeder simple junction feature private void CreateXMLNodeElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElements, string inNodeTypeName) { if (!inFeature.HasOID) { MessageBox.Show("No OID"); return; } MSXML2.IXMLDOMElement xmlNode; MSXML2.IXMLDOMElement xmlNode_XCoord; MSXML2.IXMLDOMElement xmlNode_YCoord; MSXML2.IXMLDOMElement xmlNode_RelatedContainerID; bool relatedContainer; MSXML2.IXMLDOMNodeList xmlNodeList; MSXML2.IXMLDOMElement xmlDrawing; MSXML2.IXMLDOMElement xmlDrawing_EltTypeName; MSXML2.IXMLDOMElement xmlDrawing_ExternalUID; //-------- Feature Section START related to the "infeature" -------- // Creating the NodeFeature element xmlNode = outDOMDoc.createElement("NodeFeature"); outXMLElements.appendChild(xmlNode); // Specifying basic XML items for this NodeFeature CreateBasicXMLItemsForSchematicElt(inFeature, ref outDOMDoc, ref xmlNode, inNodeTypeName); // Specifying its X && Y when they exist if ((inFeature.Fields.FindField("X") > 0) && (inFeature.Fields.FindField("Y") > 0)) { // Specifying InitialX xmlNode_XCoord = outDOMDoc.createElement("InitialX"); xmlNode.appendChild(xmlNode_XCoord); xmlNode_XCoord.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("X")); // Specifying InitialY xmlNode_YCoord = outDOMDoc.createElement("InitialY"); xmlNode.appendChild(xmlNode_YCoord); xmlNode_YCoord.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("Y")); } else { // Retrieving initial position from Geometry ESRI.ArcGIS.Geometry.IPoint oPoint = (ESRI.ArcGIS.Geometry.IPoint)inFeature.ShapeCopy; if (oPoint != null) { // Specifying InitialX xmlNode_XCoord = outDOMDoc.createElement("InitialX"); xmlNode.appendChild(xmlNode_XCoord); xmlNode_XCoord.nodeTypedValue = oPoint.X; // Specifying InitialY xmlNode_YCoord = outDOMDoc.createElement("InitialY"); xmlNode.appendChild(xmlNode_YCoord); xmlNode_YCoord.nodeTypedValue = oPoint.Y; } } xmlNode_RelatedContainerID = outDOMDoc.createElement("RelatedContainerID"); xmlNode.appendChild(xmlNode_RelatedContainerID); // Specifying its properties switch (inFeature.Class.AliasName) { case "Station": { xmlNode_RelatedContainerID.nodeTypedValue = "Container-" + System.Convert.ToString(inFeature.get_Value(inFeature.Fields.FindField("Feeder"))); // For Station feature, the field contained in the StationsPropertiesArray will be exported CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlNode, m_stationsPropertiesArray); break; } case "Feeder": { xmlNode_RelatedContainerID.nodeTypedValue = "Container-" + inFeature.OID.ToString(); // For Feeder feature, the field contained in the StationsPropertiesArray will be exported CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlNode, m_feedersPropertiesArray); break; } } //-------- Feature Section END related to the "infeature" -------- // Checking the existence of the related container xmlNodeList = outXMLElements.selectNodes("NodeFeature/ExternalUniqueID"); relatedContainer = false; foreach (MSXML2.IXMLDOMNode node in xmlNodeList) { if (node.text == xmlNode_RelatedContainerID.nodeTypedValue.ToString()) { relatedContainer = true; break; } } // pNode // Creating the related container when it doesn//t already exist if (!relatedContainer) { xmlDrawing = outDOMDoc.createElement("NodeFeature"); outXMLElements.appendChild(xmlDrawing); // Specifying its FeatureClassName xmlDrawing_EltTypeName = outDOMDoc.createElement("FeatureClassName"); xmlDrawing.appendChild(xmlDrawing_EltTypeName); xmlDrawing_EltTypeName.nodeTypedValue = "Containers"; // Specifying its ExternalUniqueID xmlDrawing_ExternalUID = outDOMDoc.createElement("ExternalUniqueID"); xmlDrawing.appendChild(xmlDrawing_ExternalUID); xmlDrawing_ExternalUID.nodeTypedValue = xmlNode_RelatedContainerID.nodeTypedValue; } }
// determins the request type passed in the given XML document public string DetermineRequestType(string path, out int UploadDownloadPrint, out string[] chatInfo) { int b = 0; string scopeVal = ""; bool flag = false; string[] st = new string[3]; try { // load the XML document MSXML2.IXMLDOMDocument document = new MSXML2.DOMDocument(); if (!document.load(path)) { throw new Exception("XML request found corrupted."); } // retrieve the request element MSXML2.IXMLDOMElement element = document.documentElement; MSXML2.IXMLDOMNode node = element.firstChild; MSXML2.IXMLDOMNamedNodeMap nodemap = node.attributes; // retrieve it's attributes MSXML2.IXMLDOMNode childNode = nodemap.nextNode(); if (0 == node.nodeName.CompareTo("request")) { // see what value does the element tequest holds // and react apprpriately switch (childNode.nodeValue.ToString()) { case "CHAT": { b = 4; MSXML2.IXMLDOMNode scope = node.firstChild; MSXML2.IXMLDOMNamedNodeMap nodemap2 = scope.attributes; MSXML2.IXMLDOMNode childNode2 = nodemap2.nextNode(); MSXML2.IXMLDOMNode childNode3 = nodemap2.nextNode(); MSXML2.IXMLDOMNode childNode4 = nodemap2.nextNode(); // set file name to upload to "path" parameter st.Initialize(); st.SetValue(childNode2.nodeValue.ToString(), 0); st.SetValue(childNode3.nodeValue.ToString(), 1); st.SetValue(childNode4.nodeValue.ToString(), 2); break; } case "SEARCH": { WriteSearchResponse(node); break; } case "SHOWFILES": { WriteShowfileResponse("SHOWFILES"); break; } case "DOWNLOAD": { // set flag that its download request b = 2; flag = true; break; } case "UPLOAD": { // set flag that its upload request b = 1; flag = true; break; } case "PRINT": { // set flag that its print request b = 3; flag = true; break; } case "STREAMING": { // set flag that its Streaming request b = 5; flag = true; break; } default: throw new Exception("Request type could not be resolved."); } if (flag) { MSXML2.IXMLDOMNode scope = node.firstChild; MSXML2.IXMLDOMNamedNodeMap nodemap2 = scope.attributes; MSXML2.IXMLDOMNode childNode2 = nodemap2.nextNode(); // set file name to upload to "path" parameter scopeVal = childNode2.nodeValue.ToString(); } } } catch (Exception e) { WriteErrorResponse(e.Message); } chatInfo = st; UploadDownloadPrint = b; return(scopeVal); }
// responds for search requests private void WriteSearchResponse(MSXML2.IXMLDOMNode node) { try { MSXML2.IXMLDOMNode scope = node.firstChild; MSXML2.IXMLDOMNamedNodeMap nodemap = scope.attributes; MSXML2.IXMLDOMNode childNode = nodemap.nextNode(); MSXML2.IXMLDOMNode childNode2 = nodemap.nextNode(); string scopeVal = childNode.nodeValue.ToString(); string maskVal = childNode2.nodeValue.ToString(); // make sure that search request has criteria specified in it if (0 != scope.nodeName.CompareTo("scope")) { return; } // validated that directory's existing if (!Directory.Exists(scopeVal.Substring(0, scopeVal.LastIndexOf("\\") + 1))) { throw new Exception("Directory does not exists any more"); } MSXML2.IXMLDOMDocument document = CreateDocument(); MSXML2.IXMLDOMElement responseElem = document.createElement("response"); responseElem.setAttribute("type", "SHOWFILES"); int i = 0; // get files in the specified directory satisfying the // given criteria string[] files = Directory.GetFiles(scopeVal.Substring(0, scopeVal.LastIndexOf("\\") + 1), scopeVal.Substring(scopeVal.LastIndexOf("\\") + 1)); files.Initialize(); while (i < files.Length) { // make fileinfo elements and fill then up with // required MSXML2.IXMLDOMElement file_infoElem = document.createElement("fileinfo"); file_infoElem.setAttribute("filename", files[i]); file_infoElem.setAttribute("mask", maskVal); file_infoElem.setAttribute("filesize", Convert.ToString(new FileInfo(files[i]).Length)); ++i; // add them to response element as children; responseElem.appendChild(file_infoElem); } // get files in the specified directory satisfying the // given criteria string[] dirs = Directory.GetDirectories(scopeVal.Substring(0, scopeVal.LastIndexOf("\\") + 1), scopeVal.Substring(scopeVal.LastIndexOf("\\") + 1)); dirs.Initialize(); i = 0; while (i < dirs.Length) { // make fileinfo elements and fill then up with // required MSXML2.IXMLDOMElement file_infoElem = document.createElement("fileinfo"); file_infoElem.setAttribute("filename", dirs[i] + "\\"); file_infoElem.setAttribute("mask", maskVal); ++i; // add them to response element as children; responseElem.appendChild(file_infoElem); } // close and save the document SaveAndCloseDocument(responseElem, document); } catch (Exception e) { WriteErrorResponse(e.Message); } }
bool SvScSetCredential( [MarshalAs(UnmanagedType.U4)] uint hSignSC, /*[MarshalAs(UnmanagedType.IDispatch)]*/ MSXML2.IXMLDOMElement xml, [MarshalAs(UnmanagedType.Bool)] out bool bCredentialComplete);
bool SvScGetCertXml( [MarshalAs(UnmanagedType.U4)] uint hSignSC, ref MSXML2.IXMLDOMElement xml);
// The following CreateXMLLinkElt private procedure is used to create all the expected XML items for a XML LinkFeature related to a HV_Line or LV_Line simple edge feature private void CreateXMLLinkElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElements, string inLinkTypeName) { if (!inFeature.HasOID) { MessageBox.Show("No OID"); return; } MSXML2.IXMLDOMElement xmlLink; MSXML2.IXMLDOMElement xmlLink_FromNode; MSXML2.IXMLDOMElement xmlLink_ToNode; int indexListPoints; string listPoints; int nbVertices; string vertices; MSXML2.IXMLDOMElement xmlLink_Vertices; MSXML2.IXMLDOMElement xmlLink_Vertex; MSXML2.IXMLDOMElement xmlLink_XVertex; MSXML2.IXMLDOMElement xmlLink_YVertex; string xValue; string yValue; //-------- Feature Section START related to the "infeature" -------- // Creating the LinkFeature Feature xmlLink = outDOMDoc.createElement("LinkFeature"); outXMLElements.appendChild(xmlLink); // Specifying basic XML items for this LinkFeature CreateBasicXMLItemsForSchematicElt(inFeature, ref outDOMDoc, ref xmlLink, inLinkTypeName); // Specifying its FromNode xmlLink_FromNode = outDOMDoc.createElement("FromNode"); xmlLink.appendChild(xmlLink_FromNode); xmlLink_FromNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("FromJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("FromJunctionOID")); // Specifying its ToNode xmlLink_ToNode = outDOMDoc.createElement("ToNode"); xmlLink.appendChild(xmlLink_ToNode); xmlLink_ToNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("ToJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("ToJunctionOID")); //Add Vertices to LinkFeature ---- NEED TO BE COMPLETED indexListPoints = inFeature.Fields.FindField("ListPoints"); if (indexListPoints > 0) { listPoints = ""; listPoints = inFeature.get_Value(indexListPoints).ToString(); if (listPoints != "") { int foundChar = listPoints.IndexOf(";", 1); nbVertices = System.Convert.ToInt32(listPoints.Substring(0, foundChar)); vertices = listPoints.Substring(foundChar + 1); if (nbVertices > 0) { // Specifying its Vertices xmlLink_Vertices = outDOMDoc.createElement("Vertices"); xmlLink.appendChild(xmlLink_Vertices); int iLoc; for (int i = 1; i <= nbVertices; i++) { xValue = ""; yValue = ""; iLoc = vertices.IndexOf(";", 1); if (vertices != "" && (iLoc) > 0) { xValue = vertices.Substring(0, iLoc); } vertices = vertices.Substring(iLoc + 1); iLoc = vertices.IndexOf(";", 1); if (vertices != ";" && (iLoc) > 0) { yValue = vertices.Substring(0, iLoc); } if (xValue != "" && yValue != "") { xmlLink_Vertex = outDOMDoc.createElement("Vertex"); xmlLink_Vertices.appendChild(xmlLink_Vertex); xmlLink_XVertex = outDOMDoc.createElement("X"); xmlLink_Vertex.appendChild(xmlLink_XVertex); xmlLink_XVertex.nodeTypedValue = xValue; xmlLink_YVertex = outDOMDoc.createElement("Y"); xmlLink_Vertex.appendChild(xmlLink_YVertex); xmlLink_YVertex.nodeTypedValue = yValue; if (vertices.Length - iLoc > 0) { vertices = vertices.Substring(iLoc + 1); //sVertices.Length - iLoc) } else { break; } } else { break; } } } } } else { // Retrieving ListPoint from geometry ESRI.ArcGIS.Geometry.IPolyline oPoly = (ESRI.ArcGIS.Geometry.IPolyline)inFeature.ShapeCopy; ESRI.ArcGIS.Geometry.IPointCollection colLink = (ESRI.ArcGIS.Geometry.IPointCollection)oPoly; if (colLink != null && colLink.PointCount > 2) { ESRI.ArcGIS.Geometry.IPoint oPoint; xmlLink_Vertices = outDOMDoc.createElement("Vertices"); xmlLink.appendChild(xmlLink_Vertices); for (int i = 1; i < colLink.PointCount - 1; i++) { oPoint = colLink.get_Point(i); xmlLink_Vertex = outDOMDoc.createElement("Vertex"); xmlLink_Vertices.appendChild(xmlLink_Vertex); xmlLink_XVertex = outDOMDoc.createElement("X"); xmlLink_Vertex.appendChild(xmlLink_XVertex); xmlLink_XVertex.nodeTypedValue = oPoint.X; xmlLink_YVertex = outDOMDoc.createElement("Y"); xmlLink_Vertex.appendChild(xmlLink_YVertex); xmlLink_YVertex.nodeTypedValue = oPoint.Y; } } } //Specifying its properties switch (inFeature.Class.AliasName) { case "LV_Line": { CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlLink, m_LVLinesPropertiesArray); break; } } //-------- Feature Section END related to the "infeature" -------- }