- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<?xml version="1.0" encoding="utf-8"?>
<contentViewConfig xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="8.0.5700.0">
<contentViewControls>
<contentViewControl definitionName="ProfileType_SitefinityProfile">
<views>
<view viewName="ViewFrontendCreate">
<sections>
<sections name="CustomFieldsSection">
<fields>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" id="postsCountField" dataFieldName="PostsCount" displayMode="Write" wrapperTag="Li" title="PostsCount" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" resourceClassId="ForumsResources" hidden="True" fieldName="PostsCount" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="-1" minLength="-1" required="False" validateIfInvisible="True" />
</field>
<field mutuallyExclusive="False" renderChoiceAs="SingleCheckBox" hideTitle="False" returnValuesAlwaysInArray="False" id="isPublicProfileField" dataFieldName="IsProfilePublic" displayMode="Write" wrapperTag="Li" title="IsProfilePublic" fieldType="Telerik.Sitefinity.Web.UI.Fields.ChoiceField, Telerik.Sitefinity" resourceClassId="ForumsResources" hidden="False" fieldName="IsProfilePublic" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.ChoiceFieldElement, Telerik.Sitefinity">
<choicesConfig>
<element enabled="False" selected="False" />
</choicesConfig>
<validator expectedFormat="None" maxLength="-1" minLength="-1" required="False" validateIfInvisible="True" />
<expandableDefinition expanded="True" />
</field>
<field dataFieldName="CustomerAccountId" wrapperTag="Li" title="Customer Account" example="Select the Customer Account this User belongs to" fieldType="MasterControl.Sitefinity.Framework.FieldControls.CustomerAccountSelector.CustomerAccountSelectorField, MasterControl.Sitefinity.Framework" fieldName="CustomerAccountId" type:this="MasterControl.Sitefinity.Framework.FieldControls.CustomerAccountSelector.CustomerAccountSelectorFieldDefinitionElement, MasterControl.Sitefinity.Framework">
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
<expandableDefinition expanded="True" />
</field>
<field UtcOffsetMode="Client" dataFieldName="MSAExpirationDate" wrapperTag="Li" fieldType="Telerik.Sitefinity.Web.UI.Fields.DateField, Telerik.Sitefinity" hidden="True" fieldName="MSAExpirationDate" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.DateFieldElement, Telerik.Sitefinity">
<validator expectedFormat="None" maxLength="-1" minLength="-1" required="False" messageCssClass="sfError" validateIfInvisible="True" />
<expandableDefinition expanded="True" />
</field>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" dataFieldName="SalesForceContactId" wrapperTag="Li" title="SalesForce Contact Id" example="Enter the Salesforce Contact Id of this user" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" fieldName="SalesForceContactId" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
</field>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" dataFieldName="UserTitle" wrapperTag="Li" title="User Title" example="Title" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" fieldName="UserTitle" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
</field>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" dataFieldName="UserAddress" wrapperTag="Li" title="User Address" example="Address of the user" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" fieldName="UserAddress" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
</field>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" dataFieldName="UserPhone" wrapperTag="Li" title="User Phone" example="User's phone number" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" fieldName="UserPhone" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
</field>
<field rows="1" isLocalizable="False" showCharacterCounter="False" recommendedCharactersCount="0" maxCharactersCount="0" trimSpaces="False" allowNulls="False" toolTipVisible="False" dataFieldName="Department" wrapperTag="Li" title="Department" example="User's Department" fieldType="Telerik.Sitefinity.Web.UI.Fields.TextField, Telerik.Sitefinity" fieldName="Department" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.TextFieldDefinitionElement, Telerik.Sitefinity">
<expandableDefinition expanded="True" />
<validator expectedFormat="None" maxLength="0" minLength="0" required="False" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageCssClass="sfError" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
</field>
<field mutuallyExclusive="True" renderChoiceAs="RadioButtons" hideTitle="False" returnValuesAlwaysInArray="False" dataFieldName="MCRole" wrapperTag="Li" title="Master Control Role" fieldType="Telerik.Sitefinity.Web.UI.Fields.ChoiceField, Telerik.Sitefinity" fieldName="MCRole" type:this="Telerik.Sitefinity.Web.UI.Fields.Config.ChoiceFieldElement, Telerik.Sitefinity">
<choicesConfig>
<clear />
<element text="Unspecified" value="Unspecified" enabled="False" selected="False" />
<element text="Implementation" value="Implementation" enabled="False" selected="False" />
<element text="Sales" value="Sales" enabled="False" selected="False" />
<element text="Support" value="Support" enabled="False" selected="False" />
<element text="Technical Sales" value="Technical Sales" enabled="False" selected="False" />
<element text="Validation" value="Validation" enabled="False" selected="False" />
</choicesConfig>
<validator expectedFormat="None" maxLength="0" minLength="0" alphaNumericViolationMessage="Non alphanumeric characters are not allowed." currencyViolationMessage="You have entered an invalid currency." emailAddressViolationMessage="You have entered an invalid email address." integerViolationMessage="You have entered an invalid integer." interneturlviolationmessage="You have entered an invalid URL." maxLengthViolationMessage="Too long" maxValueViolationMessage="Too big" messageTagName="div" minLengthViolationMessage="Too short." minValueViolationMessage="Too small." nonAlphaNumericViolationMessage="Alphanumeric characters are not allowed." numericViolationMessage="You have entered an invalid number." percentageViolationMessage="You have entered an invalid percentage." regularExpressionViolationMessage="Invalid format" requiredViolationMessage="Required field." usSocialSecurityNumberViolationMessage="You have entered an invalid US social security number." usZipCodeViolationMessage="You have entered an invalid US ZIP code." validateIfInvisible="True" />
<expandableDefinition expanded="True" />
</field>
</fields>
</sections>
</sections>
</view>
这是我拥有的 XML 文件的一部分,我需要检索在以下位置找到的信息:
<choicesConfig>
<clear />
<element text="Unspecified" value="Unspecified" enabled="False" selected="False" />
<element text="Implementation" value="Implementation" enabled="False" selected="False" />
<element text="Sales" value="Sales" enabled="False" selected="False" />
<element text="Support" value="Support" enabled="False" selected="False" />
<element text="Technical Sales" value="Technical Sales" enabled="False" selected="False" />
<element text="Validation" value="Validation" enabled="False" selected="False" />
</choicesConfig>
我尝试过观看视频和阅读 msdn,但我无法专门访问该区域。有没有什么快速的方法可以通过指定 dataFieldName="MCRole"或更简单的方法来获取这个区域?
我只对每个 <element text = "x"
的文本值感兴趣
提前谢谢你。
最佳答案
加载到 XDocument
,搜索名为“element”的元素,然后获取名为“text”的属性:
var doc = XDocument.Parse(xml);
var texts = doc.Descendants(doc.Root.Name.Namespace + "element").SelectMany(el => el.Attributes(doc.Root.Name.Namespace + "text")).ToList();
如果你只想要 "choicesConfig"
下的元素,你可以这样做:
var texts = doc.Descendants(doc.Root.Name.Namespace + "choicesConfig").Descendants(doc.Root.Name.Namespace + "element").SelectMany(el => el.Attributes(doc.Root.Name.Namespace + "text")).ToList();
更新
对于更复杂的查询,使用 XPathSelectElements
正如其他人所建议的那样不是一个坏主意。因此,如果你想挑选出名为“ViewFrontendCreate”的 View 并将所有文本累积在它们的“choicesConfig”下,你可以这样做:
var viewName = "ViewFrontendCreate";
var views = doc.Root.XPathSelectElements(string.Format("/contentViewConfig/contentViewControls/contentViewControl/views/view[@viewName='{0}']", viewName));
var texts = views.Descendants("choicesConfig").Descendants("element").SelectMany(el => el.Attributes("text")).ToList();
关于C# 无法通过 dataFieldName 获取 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29679910/
我通过 spring ioc 编写了一些 Rest 应用程序。但我无法解决这个问题。这是我的异常(exception): org.springframework.beans.factory.BeanC
我对 TestNG、Spring 框架等完全陌生,我正在尝试使用注释 @Value通过 @Configuration 访问配置文件注释。 我在这里想要实现的目标是让控制台从配置文件中写出“hi”,通过
为此工作了几个小时。我完全被难住了。 这是 CS113 的实验室。 如果用户在程序(二进制计算器)结束时选择继续,我们需要使用 goto 语句来到达程序的顶部。 但是,我们还需要释放所有分配的内存。
我正在尝试使用 ffmpeg 库构建一个小的 C 程序。但是我什至无法使用 avformat_open_input() 打开音频文件设置检查错误代码的函数后,我得到以下输出: Error code:
使用 Spring Initializer 创建一个简单的 Spring boot。我只在可用选项下选择 DevTools。 创建项目后,无需对其进行任何更改,即可正常运行程序。 现在,当我尝试在项目
所以我只是在 Mac OS X 中通过 brew 安装了 qt。但是它无法链接它。当我尝试运行 brew link qt 或 brew link --overwrite qt 我得到以下信息: ton
我在提交和 pull 时遇到了问题:在提交的 IDE 中,我看到: warning not all local changes may be shown due to an error: unable
我跑 man gcc | grep "-L" 我明白了 Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more inf
我有一段代码,旨在接收任何 URL 并将其从网络上撕下来。到目前为止,它运行良好,直到有人给了它这个 URL: http://www.aspensurgical.com/static/images/a
在过去的 5 个小时里,我一直在尝试在我的服务器上设置 WireGuard,但在完成所有设置后,我无法 ping IP 或解析域。 下面是服务器配置 [Interface] Address = 10.
我正在尝试在 GitLab 中 fork 我的一个私有(private)项目,但是当我按下 fork 按钮时,我会收到以下信息: No available namespaces to fork the
我这里遇到了一些问题。我是 node.js 和 Rest API 的新手,但我正在尝试自学。我制作了 REST API,使用 MongoDB 与我的数据库进行通信,我使用 Postman 来测试我的路
下面的代码在控制台中给出以下消息: Uncaught DOMException: Failed to execute 'appendChild' on 'Node': The new child el
我正在尝试调用一个新端点来显示数据,我意识到在上一组有效的数据中,它在数据周围用一对额外的“[]”括号进行控制台,我认为这就是问题是,而新端点不会以我使用数据的方式产生它! 这是 NgFor 失败的原
我正在尝试将我的 Symfony2 应用程序部署到我的 Azure Web 应用程序,但遇到了一些麻烦。 推送到远程时,我在终端中收到以下消息 remote: Updating branch 'mas
Minikube已启动并正在运行,没有任何错误,但是我无法 curl IP。我在这里遵循:https://docs.traefik.io/user-guide/kubernetes/,似乎没有提到关闭
每当我尝试docker组成任何项目时,都会出现以下错误。 我尝试过有和没有sudo 我在这台机器上只有这个问题。我可以在Mac和Amazon WorkSpace上运行相同的容器。 (myslabs)
我正在尝试 pip install stanza 并收到此消息: ERROR: No matching distribution found for torch>=1.3.0 (from stanza
DNS 解析看起来不错,但我无法 ping 我的服务。可能是什么原因? 来自集群中的另一个 Pod: $ ping backend PING backend.default.svc.cluster.l
我正在使用Hibernate 4 + Spring MVC 4当我开始 Apache Tomcat Server 8我收到此错误: Error creating bean with name 'wel
我是一名优秀的程序员,十分优秀!