Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3318996
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:46:20+00:00 2026-05-17T22:46:20+00:00

<Connections> <Connection ID = 1 Source=1:0 Sink=4:0/> <Connection ID = 2 Source=2:0 Sink=4:1/> <Connection

  • 0
  <Connections>
     <Connection ID = "1" Source="1:0" Sink="4:0"/>
     <Connection ID = "2" Source="2:0" Sink="4:1"/>
     <Connection ID = "3" Source="2:0" Sink="5:0"/>
     <Connection ID = "4" Source="3:0" Sink="5:1"/>
     <Connection ID = "5" Source="4:0" Sink="6:0"/>
     <Connection ID = "6" Source="5:0" Sink="7:0"/>
  </Connections>

When I need to get info from the previous XML code, Python’s lxml can be used as follows.

def getNodeList(self):
    connection = self.doc.find('Connections')
    cons = connection.find('Connection')

    for con in cons.iter():
        con.get("ID") # get attribute
        ...
  • What C# libraries/function can I use for getting the info like python’s lxml? I mean, can I use find()/iter() or similar with C#?
  • What C# libraries are similar to python’s lxml?

ADDED

Based on dtb’s answer, I could get what I needed.

using System;
using System.Xml;
using System.Xml.Linq;

namespace HIR {
  class Dummy {

    static void Main(String[] argv) {

      XDocument doc = XDocument.Load("test2.xml");

      var connection = doc.Descendants("Connections"); // .First();
      var cons = connection.Elements("Connection");

      foreach (var con in cons)
      {
        var id = (string)con.Attribute("ID");
        Console.WriteLine(id);
      }
    }
  }
}

I had to remove the ‘First()’ to avoid compiler error. With mono I could run the following to get the binary.

dmcs /r:System.Xml.Linq main.cs
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T22:46:21+00:00Added an answer on May 17, 2026 at 10:46 pm

    You want to use LINQ-to-XML:

    void GetNodeList()
    {
        var connection = this.doc.Descendants("Connections").First();
        var cons = connection.Elements("Connection");
    
        foreach (var con in cons)
        {
            var id = (string)con.Attribute("ID");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is source code for multithreaed server and client in python. In the code
Hello Im using OLE DB Source for get rows from a dBase IV file
I have read that HttpURLConnection supports persistent connections, so that a connection can be
I configured mysql ODBC connector in ODBC Data Source Configuration => test connection is
I have an open source'd website. Some content is private such as connection parameters,
heelo this is my connection string <connectionStrings> <add name=DefaultConnection connectionString=Data Source=.\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True providerName=System.Data.SqlClient;Password=;User
My understanding is that PHP's p* connections is that it keeps a connection persistent
I have to check connection leak in my application i.e. open connections which have
I'm reading about SQLAlchemy's connection pooling, which has a default of 5 connections and
stream_get_contents doesn't seem to handle persistent (KeepAlive) connections correctly. It waits for the connection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.