[DevExpress] obtains a set of sub-nodes in the visible area under a node. devexpress is visible.

Source: Internet
Author: User

[DevExpress] obtains a set of sub-nodes in the visible area under a node. devexpress is visible.

Key code:

/// <Summary> /// recursion down the TreeListNode node /// </summary> /// <param name = "node"> the node to be recursion down </param> /// <param name = "conditionHanlder"> DeleGate </param> public static void DownRecursiveNode (this TreeListNode node, action <TreeListNode> conditionHanlder) {foreach (TreeListNode _ childNode in node. nodes) {conditionHanlder (_ childNode); DownRecursiveNode (_ childNode, conditionHanlder );}}
/// <Summary> /// obtain the subnode set of the visible area under the node /// </summary> /// <param name = "node"> obtain the visible subnode </param> /// <param name = "conditonHanlder"> condition DeleGate </param> /// <returns> visible subnode set </returns> public static List <TreeListNode> GetVisibleChildNodes (this TreeListNode node, predicate <TreeListNode> conditonHanlder) {List <TreeListNode> _ visibleChildNodes = new List <TreeListNode> (); TreeList _ tree = node. treeList; DownRecursiv ENode (node, n => {RowInfo _ rowInfo = _ tree. ViewInfo. RowsInfo [n]; if (_ rowInfo! = Null) {if (conditonHanlder (n) {_ visibleChildNodes. add (n) ;}}); return _ visibleChildNodes ;} /// <summary> /// obtain the subnode set of the visible area under the node /// </summary> /// <param name = "node"> obtain the visible subnode </param> /// <returns> visible sub-node set </returns> public static List <TreeListNode> GetVisibleChildNodes (this TreeListNode node) {return GetVisibleChildNodes (node, n => 1 = 1 );}

Hope this is helpful!


C # Read the XML file. I put all the sub-nodes of a node in a set, but I only want the information of some sub-nodes, using foreach

You can use Node. Name to obtain the Node Name and determine whether the Node is required.
For example, the node name of <a> </a> is ""

How to obtain the node attribute set in xml

// The dom4j package is required
Import java. util. HashMap;
Import java. util. HashSet;
Import java. util. Iterator;
Import java. util. Map;
Import java. util. Set;

Import org. dom4j. Attribute;
Import org. dom4j. Document;
Import org. dom4j. extends entexception;
Import org. dom4j. DocumentHelper;
Import org. dom4j. Element;

Public class CollectAttrs {
// Store all node names
Static Set <String> nodeName = new HashSet <String> ();
// Stores the attributes of a node name.
Static Map <String, Set <String> map = new HashMap <String, Set <String> ();

Static String xml = "<root>"
+ "<Person name = 'p1' age = '2' sex = 'man'> <address addrCon = 'ss'/> <zip code = '123'/> </ person>"
+ "<Person name = 'p3 'age = '2' sex = 'man' birthday = '2017-10-2'> <address addrCon = 'ss' alias = '22 '/> <zip code = '000000'/> </person>"
+ "<Company name = 'cool 'comAddr = 'ss'/>" + "</root> ";

/**
* @ Param args
* @ Throws define entexception
*/
Public static void main (String [] args) throws extends entexception {
// Text Test
Document doc = incluenthelper. parseText (xml );
// File test, the jar-versions.xml is the xml file under the src package
// SAXReader sax = new SAXReader ();
// Document doc = sax. read ("bin/jar-versions.xml ");
Element root = doc. getRootElement... the remaining full text>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.