JuvenileCitationDocument

JuvenileCitationDocument

本文介绍了如何根据VB.NET中的条件将变量设置为值5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 使用以下xml文档,我需要在vb.net中提供帮助。我想设置一个变量(InCustody),当/ [JuvenileCitationDocument或CitationDocument] / Citation / Citee / InCustodyIndi​​cator = True 我怎么做? 我正在考虑将xml文档放入对象中,例如objXMLInputDoc。该文档(CitationDocumentBatch)将具有或可以具有许多CitationDocuments和/或JuvenileCitationDocuments。 然后,我将查看每个CitationDocument和/或JuvenileCitationDocument的文档。 当我找到CitationDocument或JuvenileCitationDocument的InCustodyIndi​​cator = true(子元素)时,我想设置一个变量为5的值。 我稍后会使用这个值。 < CitationDocumentBatch > < CitationDocument > < 事件 > < Citee > < InCustodyIndi​​cator > true < / InCustodyIndi​​cator > < / Citee > < / Citation > < / CitationDocument < CitationDocumentBatch > < JuvenileCitationDocument > < 事件 > < Citee > < InCustodyIndi​​cator > true < / InCustodyIndi​​cator > < / Citee > < / Citation > < / JuvenileCitationDocument < / CitationDocumentBatch > 我尝试了什么: 我正在考虑将xml文档放入对象中,例如objXMLInputDoc。该文档(CitationDocumentBatch)将具有或可以具有许多CitationDocuments和/或JuvenileCitationDocuments。 然后,我将查看每个CitationDocument和/或JuvenileCitationDocument的文档。 当我找到CitationDocument或JuvenileCitationDocument的InCustodyIndi​​cator = true(子元素)时,我想设置一个变量为5的值。 我稍后会使用这个值。解决方案 为XML创建类(参见VS XML paste special),您可以使用LINQ查询: CitationDocumentBatch batch = ...; bool inCustody = batch.CitationDocument.Any(cd = > cd.Incident.Citee.InCustodyIndi​​cator)|| batch.JuvenileCitationDocument.Any(jd = > jd.Incident.Citee.InCustodyIndi​​cator); 如果(inCustody){ // 等}} Using the following xml document, I need help in vb.net. I would like to set a variable (InCustody) to have value = 5 when /[JuvenileCitationDocument or CitationDocument]/Citation/Citee/InCustodyIndicator = TrueHow do I do this?I am considering putting the xml document into an object e.g. objXMLInputDoc. This document (CitationDocumentBatch) will have or can have many CitationDocuments and or JuvenileCitationDocuments. I will then look into this document for each CitationDocument and or JuvenileCitationDocument. When I find InCustodyIndicator = true (a child element) of a CitationDocument or JuvenileCitationDocument then I want to set a variable to have 5 as it's value. I will use this value later on.<CitationDocumentBatch><CitationDocument><Incident><Citee><InCustodyIndicator>true</InCustodyIndicator></Citee></Citation></CitationDocument<CitationDocumentBatch><JuvenileCitationDocument ><Incident><Citee><InCustodyIndicator>true</InCustodyIndicator></Citee></Citation></JuvenileCitationDocument</CitationDocumentBatch>What I have tried:I am considering putting the xml document into an object e.g. objXMLInputDoc. This document (CitationDocumentBatch) will have or can have many CitationDocuments and or JuvenileCitationDocuments. I will then look into this document for each CitationDocument and or JuvenileCitationDocument. When I find InCustodyIndicator = true (a child element) of a CitationDocument or JuvenileCitationDocument then I want to set a variable to have 5 as it's value. I will use this value later on. 解决方案 Once you create "classes" for your XML (see VS XML paste special), you can use a LINQ query:CitationDocumentBatch batch = ...;bool inCustody = batch.CitationDocument.Any( cd => cd.Incident.Citee.InCustodyIndicator ) || batch.JuvenileCitationDocument.Any( jd => jd.Incident.Citee.InCustodyIndicator );If ( inCustody ) { // etc. } 这篇关于如何根据VB.NET中的条件将变量设置为值5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-21 00:48