什么';这个Format.ps1xml文件有什么问题吗&引用;TableControl、ListControl、WideControl、CustomControl”中缺少节点;

什么';这个Format.ps1xml文件有什么问题吗&引用;TableControl、ListControl、WideControl、CustomControl”中缺少节点;,xml,powershell,formatting,Xml,Powershell,Formatting,我试图编写一个Format.ps1xml文件,但在加载它时,我收到一条非常不明确的错误消息: Import-Module : Errors occurred while loading the format data file: Test.Format.ps1xml, Error at XPath /Configuration/ViewDefinitions/View[1] in file Test.Format.ps1xml: A node is missing from TableContr

我试图编写一个Format.ps1xml文件,但在加载它时,我收到一条非常不明确的错误消息:

Import-Module : Errors occurred while loading the format data file:
Test.Format.ps1xml, Error at XPath /Configuration/ViewDefinitions/View[1] in file Test.Format.ps1xml: A node is missing from TableControl, ListControl, WideControl, CustomControl.
At line:1 char:1
+ Import-Module ./PSSourcegraph.psd1 -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
我多次阅读每个节点的名称,但没有看到缺少的节点。特别是
ListControl
的文档说明:

此元素只能包含一个子元素

奇怪的是,如果我删除
EntrySelectedBy
标记,错误就会消失

以下是Format.ps1xml:

<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
    <ViewDefinitions>
        <View>
            <Name>MyType</Name>
            <ViewSelectedBy>
                <TypeName>MyTypeName1</TypeName>
                <TypeName>MyTypeName2</TypeName>
            </ViewSelectedBy>
            <ListControl>
                <ListEntries>
                    <ListEntry>
                        <EntrySelectedBy>
                            <TypeName>MyTypeName1</TypeName>
                        </EntrySelectedBy>
                        <ListItems>
                            <ListItem>
                                <PropertyName>myProp</PropertyName>
                            </ListItem>
                        </ListItems>
                    </ListEntry>
                </ListEntries>
            </ListControl>
        </View>
    </ViewDefinitions>
</Configuration>

MyType
MyTypeName1
MyTypeName2
MyTypeName1
myProp

我不是
xml
的粉丝,这篇文章太长了,不能作为评论。如果没有帮助,我会删除我自己

编辑未完成选择过程。根据评论进行编辑。我认为您缺少
&
节点。然后,您可以选择selectionset,然后使用
选择您的条目


MyTypes
MyTypeName1
MyTypeName2
儿童
MyTypes
MyTypeName1
myProp

如何仅为
MyTypeName1
选择
myProp
?@felixbecker很好。我看不出我的不同方法。
<?xml version="1.0" encoding="utf-8" ?>
<Configuration>
    <SelectionSets>
        <SelectionSet>
            <Name>MyTypes</Name>
            <Types>
                <TypeName>MyTypeName1</TypeName>
                <TypeName>MyTypeName2</TypeName>
            </Types>
        </SelectionSet>
    </SelectionSets>
    <ViewDefinitions>
        <View>
            <Name>children</Name>
            <ViewSelectedBy>
                <SelectionSetName>MyTypes</SelectionSetName>
            </ViewSelectedBy>
            <ListControl>
                <ListEntries>
                    <ListEntry>
                        <EntrySelectedBy>
                            <TypeName>MyTypeName1</TypeName>
                        </EntrySelectedBy>
                        <ListItems>
                            <ListItem>
                                <PropertyName>myProp</PropertyName>
                            </ListItem>
                        </ListItems>
                    </ListEntry>
                </ListEntries>
            </ListControl>
        </View>
    </ViewDefinitions>
</Configuration>