Accept() 공개 메소드

Accepts the specified visitor by calling the appropriate Visit method on it.
public Accept ( IYamlVisitor visitor ) : void
visitor IYamlVisitor /// A . ///
리턴 void
예제 #1
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();
                document.Accept(this);
                Random random = new Random();

                foreach (KeyValuePair <YamlNode, bool> visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string text;
                        if (string.IsNullOrEmpty(visitedNode.Key.Anchor) || existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            do
                            {
                                text = random.Next().ToString(CultureInfo.InvariantCulture);
                            }while (existingAnchors.Contains(text));
                        }
                        else
                        {
                            text = visitedNode.Key.Anchor;
                        }
                        existingAnchors.Add(text);
                        visitedNode.Key.Anchor = text;
                    }
                }
            }
예제 #2
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                var random = new Random();

                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        // If the existing anchor is not already used, we can have it
                        if (!string.IsNullOrEmpty(visitedNode.Key.Anchor) && !existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            anchor = visitedNode.Key.Anchor;
                        }
                        else
                        {
                            do
                            {
                                anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                            } while (existingAnchors.Contains(anchor));
                        }

                        existingAnchors.Add(anchor);
                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
예제 #3
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                Random random = new Random();

                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        do
                        {
                            anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                        } while (existingAnchors.Contains(anchor));
                        existingAnchors.Add(anchor);

                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
예제 #4
0
            public void AssignAnchors(YamlDocument document)
            {
                this.existingAnchors.Clear();
                this.visitedNodes.Clear();
                document.Accept(this);
                Random random = new Random();

                foreach (KeyValuePair <YamlNode, bool> pair in this.visitedNodes)
                {
                    if (pair.Value)
                    {
                        while (true)
                        {
                            string item = random.Next().ToString(CultureInfo.InvariantCulture);
                            if (!this.existingAnchors.Contains(item))
                            {
                                this.existingAnchors.Add(item);
                                pair.Key.Anchor = item;
                                break;
                            }
                        }
                    }
                }
            }
예제 #5
0
            public void AssignAnchors(YamlDocument document)
            {
                existingAnchors.Clear();
                visitedNodes.Clear();

                document.Accept(this);

                var random = new Random();
                foreach (var visitedNode in visitedNodes)
                {
                    if (visitedNode.Value)
                    {
                        string anchor;
                        // If the existing anchor is not already used, we can have it
                        if (!string.IsNullOrEmpty(visitedNode.Key.Anchor) && !existingAnchors.Contains(visitedNode.Key.Anchor))
                        {
                            anchor = visitedNode.Key.Anchor;
                        }
                        else
                        {
                            do
                            {
                                anchor = random.Next().ToString(CultureInfo.InvariantCulture);
                            } while (existingAnchors.Contains(anchor));
                        }

                        existingAnchors.Add(anchor);
                        visitedNode.Key.Anchor = anchor;
                    }
                }
            }
예제 #6
0
			public void AssignAnchors(YamlDocument document)
			{
				existingAnchors.Clear();
				visitedNodes.Clear();

				document.Accept(this);

				Random random = new Random();
				foreach (var visitedNode in visitedNodes)
				{
					if (visitedNode.Value)
					{
						string anchor;
						do
						{
							anchor = random.Next().ToString(CultureInfo.InvariantCulture);
						} while (existingAnchors.Contains(anchor));
						existingAnchors.Add(anchor);

						visitedNode.Key.Anchor = anchor;
					}
				}
			}
예제 #7
0
 /// <summary>
 /// Converts a <see cref="YamlDocument"/> to <see cref="XmlDocument"/>.
 /// </summary>
 /// <param name="document">The YAML document to convert.</param>
 /// <returns></returns>
 public XmlDocument ToXml(YamlDocument document)
 {
     YamlToXmlDocumentVisitor visitor = new YamlToXmlDocumentVisitor(options);
     document.Accept(visitor);
     return visitor.Document;
 }