当前位置: 首页>>代码示例>>C#>>正文


C# XmlNode.Clone方法代码示例

本文整理汇总了C#中System.Xml.XmlNode.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# XmlNode.Clone方法的具体用法?C# XmlNode.Clone怎么用?C# XmlNode.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlNode的用法示例。


在下文中一共展示了XmlNode.Clone方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisualFunction

        public VisualFunction(XmlNode xnode)
        {
            //keep a record for future use (and self clone)
            functionXml = xnode.Clone();
            XmlNode tempFunctionXml = updateInputIDs(functionXml);
            //MessageBox.Show(printer.PrintToString(xnode) + "\n\n" + printer.PrintToString(tempFunctionXml));

            //interaction handlers
            this.MouseDown += new MouseButtonEventHandler(VisualFunction_MouseDown);
            this.MouseMove += new MouseEventHandler(VisualFunction_MouseMove);

            //method data (arguments: inputs and outputs)
            XmlNode xdata = tempFunctionXml.SelectSingleNode("args");
            //XmlNode xdataTemp = updateInputIDs(xdata);
            this.Data = xdata.Clone();

            //method reverse data (arguments: args -> reverse operation on data.output, and inputs -> placeholder of data outputs)
            XmlNode xdataR = tempFunctionXml.SelectSingleNode("argsR");
            //this.DataR = xdataR.Clone();
            this.DataR = xdataR.Clone();

            //create the picture content
            imageName = tempFunctionXml.SelectSingleNode("image").InnerXml;
            //MessageBox.Show(imageName);
            this.Content = getImage();
        }
开发者ID:imanavaz,项目名称:CONVErT,代码行数:26,代码来源:VisualFunction.cs

示例2: VisualCondition

        public VisualCondition(XmlNode xnode)
        {
            //keep a record for future use (and self clone)
            functionXml = xnode.Clone();

            //interaction handlers
            this.MouseDown += new MouseButtonEventHandler(VisualCondition_MouseDown);
            this.MouseMove += new MouseEventHandler(VisualCondition_MouseMove);

            //method data (arguments: inputs and outputs)
            //XmlNode xdata = xnode.SelectSingleNode("args");
            this.Data = xnode.Clone();

            //method reverse data (arguments: args -> reverse operation on data.output, and inputs -> placeholder of data outputs)
            //XmlNode xdataR = xnode.SelectSingleNode("argsR");
            //if (xdataR != null)
            //{
            //    this.DataR = xdataR.Clone();
            //    hasReverse = true;
            //}
            //else
            //{
            //    hasReverse = false;
            //    this.DataR = null;
            //}

            //get condition string
            //conditions = xnode.SelectSingleNode("conditions");

            //if (conditions.ChildNodes.Count > 1)
             //   isMultiCondition = true;
            //else
               //     isMultiCondition = false;

            //create the picture content
            imageName = Data.SelectSingleNode("image").InnerXml;

            if(!String.IsNullOrEmpty(imageName))
                this.Content = getImage();
        }
开发者ID:imanavaz,项目名称:CONVErT,代码行数:40,代码来源:VisualCondition.cs

示例3: ImplementTemplate

        private static void ImplementTemplate(XmlDocument xml, XmlNode templateNode, string imageName, Dictionary<string, string> strings)
        {
            var newNode = templateNode.Clone();

            var childNodes = new List<XmlNode>();
            childNodes.AddRange(TemplateXmlGenerator.Flatten(newNode.ChildNodes));

            TemplateXmlGenerator.ReplaceText(strings, childNodes);

            newNode = xml.ImportNode(newNode, deep: true);
            childNodes.Clear();
            childNodes.AddRange(newNode.ChildNodes.Cast<XmlNode>());

            foreach (var childNode in childNodes)
            {
                templateNode.ParentNode.InsertBefore(childNode, templateNode);
            }
        }
开发者ID:GWBasic,项目名称:PhotoLibraryGenerator,代码行数:18,代码来源:TemplateXmlGenerator.cs

示例4: SelectNodes

		/// <summary>
		/// Selects child nodes from a parent node satisfying the xpath
		/// </summary>
		/// <param name="xmlNode"></param>
		/// <param name="xpath"></param>
		/// <returns></returns>
		public static XmlNodeList SelectNodes (XmlNode xmlNode, string xpath)
		{

			XmlNode retXmlNode = xmlNode.Clone();
			retXmlNode.RemoveAll();
	
			IEnumerator iEnumerator = xmlNode.GetEnumerator();
			
			while (iEnumerator.MoveNext())
			{	
				XmlNode childXmlNode = (XmlNode)iEnumerator.Current;
				if (childXmlNode.LocalName.ToString() == xpath)
				{
					retXmlNode.AppendChild(childXmlNode.CloneNode(true));
				}
			}
		
			XmlNodeList retXmlNodeList = retXmlNode.ChildNodes;
			return retXmlNodeList; 
			
		}
开发者ID:JeffreyZksun,项目名称:gpstranslator,代码行数:27,代码来源:XPath.cs

示例5: AssignContent

 public virtual void AssignContent(XmlNode contentNode, object instance, Type instanceType, Func<Type, IParcer> valueParcerResolver)
 {
     var objectFactoryInstance = instance as ModernFactory.ObjectFactory;
       if (objectFactoryInstance == null)
       {
     throw new Exception("Unexpected value");
       }
       var contentNodeClone = contentNode.Clone();
       var typeAttribute = contentNodeClone.Attributes["type"];
       if (typeAttribute == null)
       {
     throw new Exception("Unexpected value");
       }
       var indexOfColon = typeAttribute.Value.IndexOf(":");
       if (indexOfColon == -1)
       {
     throw new Exception("Unexpected value");
       }
       var newTypeValue = typeAttribute.Value.Substring(indexOfColon + 1);
       typeAttribute.Value = newTypeValue;
       objectFactoryInstance.Initialize(contentNodeClone);
 }
开发者ID:Zvirja,项目名称:TrayGarden,代码行数:22,代码来源:ObjectFactoryAssigner.cs

示例6: ExchengeNodes

 private void ExchengeNodes(XmlNode vNode_1, XmlNode vNode_2){
   XmlNode vParentNode = vNode_2.ParentNode;
   XmlNode vNode_1_clone = vNode_1.Clone();
   vParentNode.InsertBefore(vNode_1_clone, vNode_2);
   vParentNode.ReplaceChild(vNode_2, vNode_1);
 }
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:6,代码来源:dom4cs.cs

示例7: InitializeTask

        /// <summary>
        /// Initializes the task and verifies parameters.
        /// </summary>
        /// <param name="TaskNode">Node that contains the XML fragment used to define this task instance.</param>
        protected override void InitializeTask(XmlNode TaskNode)
        {
            XmlElement taskXml = (XmlElement) TaskNode.Clone();

            // Expand all properties in the task and its child elements
            if (taskXml.ChildNodes != null) {
                ExpandPropertiesInNodes(taskXml.ChildNodes);
                if (taskXml.Attributes != null) {
                    foreach (XmlAttribute attr in taskXml.Attributes) {
                        attr.Value = Properties.ExpandProperties(attr.Value, Location);
                    }
                }
            }

            // Get the [SchemaValidator(type)] attribute
            SchemaValidatorAttribute[] taskValidators =
                (SchemaValidatorAttribute[])GetType().GetCustomAttributes(
                typeof(SchemaValidatorAttribute), true);

            if (taskValidators.Length > 0) {
                SchemaValidatorAttribute taskValidator = taskValidators[0];
                XmlSerializer taskSerializer = new XmlSerializer(taskValidator.ValidatorType);

                // get embedded schema resource stream
                Stream schemaStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(
                    taskValidator.ValidatorType.Namespace);

                // ensure schema resource was embedded
                if (schemaStream == null) {
                    throw new BuildException(string.Format(CultureInfo.InvariantCulture,
                        "Schema resource '{0}' could not be found.",
                        taskValidator.ValidatorType.Namespace), Location);
                }

                // load schema resource
                XmlTextReader tr = new XmlTextReader(
                    schemaStream, XmlNodeType.Element, null);

                // Add the schema to a schema collection
                XmlSchema schema = XmlSchema.Read(tr, null);
                XmlSchemaCollection schemas = new XmlSchemaCollection();
                schemas.Add(schema);

                string xmlNamespace = (taskValidator.XmlNamespace != null ? taskValidator.XmlNamespace : GetType().FullName);

                // Create a namespace manager with the schema's namespace
                NameTable nt = new NameTable();
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
                nsmgr.AddNamespace(string.Empty, xmlNamespace);

                // Create a textreader containing just the Task's Node
                XmlParserContext ctx = new XmlParserContext(
                    null, nsmgr, null, XmlSpace.None);
                taskXml.SetAttribute("xmlns", xmlNamespace);
                XmlTextReader textReader = new XmlTextReader(taskXml.OuterXml,
                    XmlNodeType.Element, ctx);

                // Copy the node from the TextReader and indent it (for error
                // reporting, since NAnt does not retain formatting during a load)
                StringWriter stringWriter = new StringWriter();
                XmlTextWriter textWriter = new XmlTextWriter(stringWriter);
                textWriter.Formatting = Formatting.Indented;

                textWriter.WriteNode(textReader, true);

                //textWriter.Close();
                XmlTextReader formattedTextReader = new XmlTextReader(
                    stringWriter.ToString(), XmlNodeType.Document, ctx);

                // Validate the Task's XML against its schema
                XmlValidatingReader validatingReader = new XmlValidatingReader(
                    formattedTextReader);
                validatingReader.ValidationType = ValidationType.Schema;
                validatingReader.Schemas.Add(schemas);
                validatingReader.ValidationEventHandler +=
                    new ValidationEventHandler(Task_OnSchemaValidate);

                while (validatingReader.Read()) {
                    // Read strictly for validation purposes
                }
                validatingReader.Close();

                if (!_validated) {
                    // Log any validation errors that have ocurred
                    for (int i = 0; i < _validationExceptions.Count; i++) {
                        BuildException ve = (BuildException) _validationExceptions[i];
                        if (i == _validationExceptions.Count - 1) {
                            // If this is the last validation error, throw it
                            throw ve;
                        }
                        Log(Level.Info, ve.Message);
                    }
                }

                NameTable taskNameTable = new NameTable();
                XmlNamespaceManager taskNSMgr = new XmlNamespaceManager(taskNameTable);
//.........这里部分代码省略.........
开发者ID:vardars,项目名称:ci-factory,代码行数:101,代码来源:SchemaValidatedTask.cs

示例8: CreateWsSpecficLayoutType

		private static XmlNode CreateWsSpecficLayoutType(XmlNode xnLayoutType, string sWsLabel,
			string sWsLayout, string sWsTag)
		{
			XmlNode xnRealLayout = xnLayoutType.Clone();
			xnRealLayout.Attributes["label"].Value = sWsLabel;
			xnRealLayout.Attributes["layout"].Value = sWsLayout;
			foreach (XmlNode config in xnRealLayout.ChildNodes)
			{
				if (config is XmlComment || config.Name != "configure")
					continue;
				string sInternalLayout = XmlUtils.GetAttributeValue(config, "layout");
				Debug.Assert(sInternalLayout.EndsWith("-$ws"));
				config.Attributes["layout"].Value = sInternalLayout.Replace("$ws", sWsTag);
			}
			return xnRealLayout;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:16,代码来源:XmlDocConfigureDlg.cs

示例9: EvaluateNode

		XmlNode EvaluateNode (XmlNode source)
		{
			var elemSource = source as XmlElement;
			if (elemSource != null) {
				var elem = source.OwnerDocument.CreateElement (elemSource.Prefix, elemSource.LocalName, elemSource.NamespaceURI);
				foreach (XmlAttribute attr in elemSource.Attributes)
					elem.Attributes.Append ((XmlAttribute)EvaluateNode (attr));
				foreach (XmlNode child in elemSource.ChildNodes)
					elem.AppendChild (EvaluateNode (child));
				return elem;
			}

			var attSource = source as XmlAttribute;
			if (attSource != null) {
				bool oldResolved = allResolved;
				var att = source.OwnerDocument.CreateAttribute (attSource.Prefix, attSource.LocalName, attSource.NamespaceURI);
				att.Value = Evaluate (attSource.Value);

				// Condition attributes don't change the resolution status. Conditions are handled in the property and item objects
				if (attSource.Name == "Condition")
					allResolved = oldResolved;

				return att;
			}
			var textSource = source as XmlText;
			if (textSource != null) {
				return source.OwnerDocument.CreateTextNode (Evaluate (textSource.InnerText));
			}
			return source.Clone ();
		}
开发者ID:hbons,项目名称:monodevelop,代码行数:30,代码来源:MSBuildEvaluationContext.cs

示例10: InsertBefore

 public override XmlNode InsertBefore(XmlNode newChild, XmlNode refChild)
 {
     bool flag1 = this.ownerDocument.AcceptChanges;
     if (newChild.OwnerDocument != this.OwnerDocument)
     {
         XmlNode node1 = newChild.Clone();
         this.ownerDocument.AcceptChanges = false;
         XmlNode node2 = this.ownerDocument.ImportNode(node1, true);
         newChild = node2;
         this.ownerDocument.AcceptChanges = flag1;
     }
     this.CreateID(newChild);
     XmlNode node3 = base.InsertBefore(newChild, refChild);
     if (node3 is ItopVector.Core.Animate.Animate)
     {
         XmlNode node4 = refChild;
         while (!(node4 is ItopVector.Core.Animate.Animate))
         {
             if (node4 == null)
             {
                 break;
             }
             node4 = node4.NextSibling;
         }
         if (node4 is ItopVector.Core.Animate.Animate)
         {
             if (!this.animatelist.Contains((SvgElement) node3))
             {
                 int num1 = this.animatelist.IndexOf((SvgElement) node4);
                 if (num1 >= 0)
                 {
                     this.animatelist.Insert(num1, (SvgElement) node3);
                     num1 = this.ownerDocument.FlowChilds.IndexOf((SvgElement) node4);
                     this.InsertFlowElment(num1 + this.animatelist.IndexOf((SvgElement) node3), (SvgElement) node3);
                     goto Label_016B;
                 }
                 this.animatelist.Insert(0, (SvgElement) node3);
                 this.InsertFlowElment(0, (SvgElement) node3);
             }
         }
         else if (!this.animatelist.Contains((SvgElement) node3))
         {
             this.animatelist.Insert(0, (SvgElement) node3);
             this.InsertFlowElment(0, (SvgElement) node3);
         }
     }
     Label_016B:
     if (node3 is SvgElement)
     {
         CodeFunc.FormatElement((SvgElement) node3);
     }
     return node3;
 }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:53,代码来源:SvgElement.cs

示例11: updateInputIDs

        private XmlNode updateInputIDs(XmlNode data)
        {
            //copy the whole thing
            XmlNode xdataTemp = data.Clone();

            //get forward and reverse
            XmlNode args = xdataTemp.SelectSingleNode("args");
            XmlNode argsR = xdataTemp.SelectSingleNode("argsR");

            //get forward arguments
            XmlNode inputs = args.SelectSingleNode("inputs");
            XmlNode outputs = args.SelectSingleNode("outputs");
            XmlNode newInputs = inputs.OwnerDocument.CreateElement("inputs");
            XmlNode newOutputs = outputs.OwnerDocument.CreateElement("outputs");

            //getreverse reverse arguments
            XmlNode inputsR = argsR.SelectSingleNode("inputs");
            XmlNode outputsR = argsR.SelectSingleNode("outputs");
            XmlNode newInputsR = inputsR.OwnerDocument.CreateElement("inputs");
            XmlNode newOutputsR = outputsR.OwnerDocument.CreateElement("outputs");

            foreach (XmlNode i in inputs.ChildNodes)
            {
                XmlNode ida = i.Attributes.GetNamedItem("ID");
                if (ida != null)
                {
                    //forward area
                    int iid = int.Parse(ida.Value);
                    int newID = ID++;
                    string previousArgName = "arg" + iid.ToString();
                    string newArgName = "arg" + newID;

                    XmlNode newChild = i.OwnerDocument.CreateElement(newArgName);
                    newChild.AppendChild(newChild.OwnerDocument.CreateTextNode(i.InnerText));//assuming the child has only values as text

                    newInputs.AppendChild(newChild);

                    //reverse (inputs of forward become outputs of reverse)
                    XmlNode reverseUpdatee = argsR.SelectSingleNode("outputs/output[@ID='"+iid+"']");
                    if (reverseUpdatee != null)
                    {
                        XmlNode newReverseOutput = reverseUpdatee.OwnerDocument.CreateElement("output" + newID);
                        newReverseOutput.AppendChild(newReverseOutput.OwnerDocument.CreateTextNode(reverseUpdatee.InnerText));
                        newOutputsR.AppendChild(newReverseOutput);
                    }

                    //update output templates
                    foreach (XmlNode o in outputs.ChildNodes)
                    {
                        string oldValue = o.InnerText;
                        if (!String.IsNullOrEmpty(oldValue))
                        {
                            if (oldValue.IndexOf(previousArgName) != -1)
                            {
                                string newValue = oldValue.Replace(previousArgName+" ", newArgName+ " ");

                                o.ReplaceChild(o.OwnerDocument.CreateTextNode(newValue),o.ChildNodes[0]);
                            }
                        }
                    }
                }
            }
            //replace old and new inputs
            args.ReplaceChild(newInputs, inputs);

            foreach (XmlNode o in outputs.ChildNodes)
            {
                XmlNode ida = o.Attributes.GetNamedItem("ID");
                if (ida != null)
                {
                    int iid = int.Parse(ida.InnerText);
                    int newID = ID++;
                    string previousOutputName = "output" + iid.ToString();
                    string newOutputName = "output" + newID;

                    XmlNode newChild = o.OwnerDocument.CreateElement(newOutputName);
                    newChild.AppendChild(newChild.OwnerDocument.CreateTextNode(o.InnerText));//assuming the child has only values as text

                    newOutputs.AppendChild(newChild);

                    //outputs of forward become inputs of reverse
                    XmlNode reverseInputUpdatee = argsR.SelectSingleNode("inputs/arg[@ID='" + iid + "']");
                    if (reverseInputUpdatee != null)
                    {
                        XmlNode newReverseInput = reverseInputUpdatee.OwnerDocument.CreateElement("arg" + newID);
                        newReverseInput.AppendChild(newReverseInput.OwnerDocument.CreateTextNode(reverseInputUpdatee.InnerText));
                        newInputsR.AppendChild(newReverseInput);

                        foreach (XmlNode oR in newOutputsR.ChildNodes)
                        {
                            string oldValue = oR.InnerText;
                            string previousArgName = "arg" + iid.ToString();
                            string newArgName = "arg" + newID;
                            if (!String.IsNullOrEmpty(oldValue))
                            {
                                if (oldValue.IndexOf(previousArgName) != -1)
                                {
                                    string newValue = oldValue.Replace(previousArgName+" ", newArgName+" ");

                                    oR.ReplaceChild(oR.OwnerDocument.CreateTextNode(newValue), oR.ChildNodes[0]);
//.........这里部分代码省略.........
开发者ID:imanavaz,项目名称:CONVErT,代码行数:101,代码来源:VisualFunction.cs

示例12: MakeClone

 private static XmlNode MakeClone(XmlNode node)
 {
     var clone = node.Clone();
     while (clone.HasChildNodes)
     {
         clone.RemoveChild(clone.FirstChild);
     }
     return clone;
 }
开发者ID:regnrand,项目名称:chorus,代码行数:9,代码来源:MergeLimitedChildrenService.cs

示例13: DoCustomElements

		protected void DoCustomElements(TextWriter contentsStream, CmObject currentObject, XmlNode node)
		{
			string sClass = XmlUtils.GetManditoryAttributeValue(node, "class");
			string sType = XmlUtils.GetOptionalAttributeValue(node, "fieldType", "");
			int[] flids;
			if (!m_customFlids.TryGetValue(sClass + sType, out flids))
			{
				int clid = 0;
				try
				{
					clid = (int)m_cache.MetaDataCacheAccessor.GetClassId(sClass);
				}
				catch
				{
					clid = 0;
				}
				if (clid == 0)
				{
					m_customFlids[sClass + sType] = new int[0];
					return;		// we don't know what to do!
				}
				StringBuilder sbTypes = new StringBuilder();
				switch (sType)
				{
					case "mlstring":
						sbTypes.AppendFormat(" AND Type IN ({0}, {1}, {2}, {3})",
							(int)CellarModuleDefns.kcptMultiUnicode,
							(int)CellarModuleDefns.kcptMultiBigUnicode,
							(int)CellarModuleDefns.kcptMultiString,
							(int)CellarModuleDefns.kcptMultiBigString);
						break;
					case "simplestring":
						sbTypes.AppendFormat(" AND Type IN ({0}, {1})",
							(int)CellarModuleDefns.kcptString,
							(int)CellarModuleDefns.kcptBigString);
						break;
				}
				StringBuilder sb = new StringBuilder("SELECT Id From Field$ WHERE Custom=1 AND Class=");
				sb.Append(clid.ToString());
				if (sbTypes.Length > 0)
					sb.Append(sbTypes.ToString());
				string sql = sb.ToString();
				flids = DbOps.ReadIntArrayFromCommand(m_cache, sql, null);
				m_customFlids[sClass + sType] = flids;
			}
			if (flids.Length == 0)
				return;		// nothing to do.
			for (int i = 0; i < flids.Length; ++i)
			{
				XmlNode parentNode = node.Clone();
				uint flid = (uint)flids[i];
				string labelName = m_cache.MetaDataCacheAccessor.GetFieldLabel(flid);
				string fieldName = m_cache.MetaDataCacheAccessor.GetFieldName(flid);
				string className = m_cache.MetaDataCacheAccessor.GetOwnClsName(flid);
				if (String.IsNullOrEmpty(labelName))
					labelName = fieldName;
				string sfMarker = "zz";
				if (fieldName.StartsWith("custom"))
				{
					sfMarker = String.Format("z{0}", fieldName.Substring(6));
					if (sfMarker == "z")
						sfMarker = "z0";
				}
				ReplaceSubstringInAttr visitorFn = new ReplaceSubstringInAttr("${fieldName}", fieldName);
				ReplaceSubstringInAttr visitorLab = new ReplaceSubstringInAttr("${label}", labelName);
				ReplaceSubstringInAttr visitorSfm = new ReplaceSubstringInAttr("${sfm}", sfMarker);
				foreach (XmlNode xn in parentNode.ChildNodes)
				{
					XmlUtils.VisitAttributes(xn, visitorFn);
					XmlUtils.VisitAttributes(xn, visitorLab);
					XmlUtils.VisitAttributes(xn, visitorSfm);
				}
				if (parentNode.InnerText.Contains("${definition}"))
					FillInCustomFieldDefinition(parentNode, flid);
				if (parentNode.InnerText.Contains("${description}"))
					FillInCustomFieldDescription(parentNode, flid);
				DoChildren(contentsStream, currentObject, parentNode, null);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:79,代码来源:XDumper.cs

示例14: convertXmlNode

 private void convertXmlNode(XmlNode page, XmlNode source, string font, Point offset)
 {
     XmlElement destNode = null;
     if (((source.Name == "label") || (source.Name == "ranlabel")) || ((source.Name == "checkbox") || (source.Name == "radio")))
     {
         destNode = page.OwnerDocument.CreateElement(source.Name);
         this.setAttribute(destNode, source);
         if (this.mPrintFlg || !string.IsNullOrEmpty(font))
         {
             setParentFont(destNode, font);
         }
         adjustLocation(destNode, offset);
         page.AppendChild(destNode);
     }
     else if ((((source.Name == "textbox") || (source.Name == "maskedtextbox")) || ((source.Name == "combobox") || (source.Name == "inputcombobox"))) || ((source.Name == "datetimepicker") || (source.Name == "commatext")))
     {
         destNode = page.OwnerDocument.CreateElement("prttextbox");
         this.setAttribute(destNode, source);
         if (this.mPrintFlg || !string.IsNullOrEmpty(font))
         {
             setParentFont(destNode, font);
         }
         System.Type textBox = DesignControls.TextBox;
         if (source.Name == "maskedtextbox")
         {
             textBox = DesignControls.MaskedTextBox;
             XmlFunc.setStringAttribute(destNode, "Format", getMaskFormat(source));
         }
         else if (source.Name == "datetimepicker")
         {
             textBox = DesignControls.DataTimePicker;
             XmlFunc.setStringAttribute(destNode, "Format", getDateTimeFormat(source));
         }
         else if (source.Name == "commatext")
         {
             textBox = DesignControls.CommaText;
             XmlFunc.setStringAttribute(destNode, "Format", getCommaFormat(source));
         }
         if (XmlFunc.getStringAttribute(source, "isGrid") != "True")
         {
             string borderStyle = XmlFunc.getStringAttribute(source, "BorderStyle").Trim();
             if (borderStyle.Length == 0)
             {
                 borderStyle = ComponentProperty.getPropertyDefault(textBox, "BorderStyle");
                 if (borderStyle == null)
                 {
                     borderStyle = BorderStyle.None.ToString();
                 }
             }
             int num = SizeDef.prtTextMargin(borderStyle);
             Point location = getLocationAttribute(destNode);
             location.Y += num;
             setLocationAttribute(destNode, location);
             System.Drawing.Size size = getSizeAttribute(destNode);
             size.Height -= num * 2;
             setSizeAttribute(destNode, size);
             XmlFunc.setStringAttribute(destNode, "BorderStyle", BorderStyle.None.ToString());
         }
         adjustLocation(destNode, offset);
         page.AppendChild(destNode);
     }
     else if (source.Name == "div-textbox")
     {
         destNode = page.OwnerDocument.CreateElement("prttextbox");
         this.setAttribute(destNode, source);
         if (this.mPrintFlg || !string.IsNullOrEmpty(font))
         {
             setParentFont(destNode, font);
         }
         System.Type maskedTextBox = DesignControls.MaskedTextBox;
         int cnt = XmlFunc.getNumericAttribute(source, "L_MaxLength");
         int num3 = XmlFunc.getNumericAttribute(source, "R_MaxLength");
         StrFunc func = StrFunc.CreateInstance();
         string str2 = func.MakeCycleStr(cnt, "_") + " - " + func.MakeCycleStr(num3, "_");
         XmlFunc.setStringAttribute(destNode, "Format", str2);
         string str3 = XmlFunc.getStringAttribute(source, "BorderStyle").Trim();
         if (str3.Length == 0)
         {
             str3 = BorderStyle.None.ToString();
         }
         int num4 = SizeDef.prtTextMargin(str3) + SizeDef.prtTextMargin(BorderStyle.Fixed3D.ToString());
         Point point2 = getLocationAttribute(destNode);
         point2.Y += num4;
         setLocationAttribute(destNode, point2);
         System.Drawing.Size size2 = getSizeAttribute(destNode);
         size2.Width -= num4 * 2;
         size2.Height -= num4 * 2;
         setSizeAttribute(destNode, size2);
         XmlFunc.setStringAttribute(destNode, "BorderStyle", BorderStyle.None.ToString());
         adjustLocation(destNode, offset);
         page.AppendChild(destNode);
     }
     else if ((source.Name == "container") && isContinueType(source))
     {
         if (XmlFunc.getStringAttribute(source, "type") == "TitlePanel")
         {
             page.AppendChild(source.Clone());
         }
         else if (!isRepetition(source))
         {
//.........这里部分代码省略.........
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:101,代码来源:ConvertTemplate.cs

示例15: assembleLayoutNode

 private static XmlNode assembleLayoutNode(XmlNode source, Point offset)
 {
     XmlNode destNode = source.Clone();
     adjustLocation(destNode, offset);
     return destNode;
 }
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:6,代码来源:ConvertTemplate.cs


注:本文中的System.Xml.XmlNode.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。