Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有没有办法像读取.xml文件一样轻松地读取.yml文件?_Xml_Vb.net_Parsing_Yaml - Fatal编程技术网

有没有办法像读取.xml文件一样轻松地读取.yml文件?

有没有办法像读取.xml文件一样轻松地读取.yml文件?,xml,vb.net,parsing,yaml,Xml,Vb.net,Parsing,Yaml,我使用此示例读取windows窗体中的.xml文件 Try If System.IO.File.Exists(Pathto & "\MinecartMania\MinecartManiaConfiguration.xml") = True Then FileFlag(1) = True MinecartManiaCoreConfiguration = XDocument.Load(Pathto & "\MinecartMania\Minec

我使用此示例读取windows窗体中的.xml文件

Try
    If System.IO.File.Exists(Pathto & "\MinecartMania\MinecartManiaConfiguration.xml") = True Then
        FileFlag(1) = True
        MinecartManiaCoreConfiguration = XDocument.Load(Pathto & "\MinecartMania\MinecartManiaConfiguration.xml").Root
        For Each option As XElement In MinecartManiaCoreConfiguration.Elements

            If (option.Name = "LoggingMode") Then
                LoggingMode = CStr(option.Value)
            End If
            If (option.Name = "MinecartsKillMobs") Then
                MinecartsKillMobs = CBool(option.Value)
            End If
.yml文件有类似的功能吗? 我环顾四周,但我发现只有复杂的方法我不明白


编辑:来吧,人们!不会那么难吧

从结构的外观来看,您可以从二进制读取器开始,然后从那里开始。您可以在站点中查找的标记是

文件开头“--”

个别条目“-”

属性名称和值“{Property_Name}”:{value}

数组在属性{property_name}旁边以“[]”开头:[]

我首先解析文件,然后在运行时使用.net的动态类型通过添加遇到的每个新属性来构建模型


从那里,您应该有一个动态类型的通用集合,并且应该能够使用lambda或linq查询解析的yml文件。从结构的外观来看,您可能可以从二进制读取器开始,然后从那里开始。您可以在站点中查找的标记是

文件开头“--”

个别条目“-”

属性名称和值“{Property_Name}”:{value}

数组在属性{property_name}旁边以“[]”开头:[]

我首先解析文件,然后在运行时使用.net的动态类型通过添加遇到的每个新属性来构建模型


从那里,您应该有一个动态类型的通用集合,并且应该能够使用lambda或linq查询解析后的yml文件

什么是yml?你能展示一下示例YML文件吗?你看过“C#/.NET”下的工具了吗?可能是YML的副本吗?你能展示一下示例YML文件吗?你看过“C#/.NET”下的工具了吗?可能是重复的