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 3229480
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:48:56+00:00 2026-05-17T16:48:56+00:00

Here is part of the xml I am trying to parse: <?xml version=1.0 encoding=UTF-8?>

  • 0

Here is part of the xml I am trying to parse:

<?xml version="1.0" encoding="UTF-8"?>
<Workflow xmlns="http://soap.sforce.com/2006/04/metadata">
    <alerts>
        <fullName>Broker_Not_In_SF_Current_Broker_Account</fullName>
        <description>Broker Not In SF - Current Broker Account</description>
        <protected>false</protected>
        <recipients>
            <recipient>GeddyLee@YYZ.com</recipient>
            <type>user</type>
        </recipients>
        <senderType>CurrentUser</senderType>
        <template>Broker_Emails/Current_Broker_on_Acct_Not_in_SF</template>
    </alerts>
    <rules>
        <fullName>No Service Contact Assigned</fullName>
        <active>true</active>
        <criteriaItems>
            <field>Account.Type</field>
            <operation>equals</operation>
            <value>Client</value>
        </criteriaItems>
        <criteriaItems>
            <field>Account.Service_Contact__c</field>
            <operation>equals</operation>
        </criteriaItems>
        <description>Notification when a service contact has not been assigned after 5 days, then 8 days.</description>
        <triggerType>onCreateOrTriggeringUpdate</triggerType>
    </rules>
</Workflow>

I can use simple Linq to XML on some random SIMPLE XML file, but In this instance I get nothing. I assume because of the xml namespace, but is there a way around this other than removing that in the xml rile prior to parsing?

I haven’t done much XML work in the past, so I’m trying to understand the best way that I can take a file like shown and pull out the rule nodes to create a collection or rules with properties. I can get the object/collection part, but I’m stuck on WHY the namespace is failing this simple call:

var setting = xmlDoc.Descendants("rules").First(e => e.Element("fullName").Value == "No Service Contact Assigned");
Console.WriteLine(setting.Element("active").Value); 

Thanks for any help on what to do about this or how to properly use the namespace.

  • 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-17T16:48:56+00:00Added an answer on May 17, 2026 at 4:48 pm

    You need an XNamespace like this:

    XNamespace ns = "http://soap.sforce.com/2006/04/metadata";
    var setting = xmlDoc.Root.Descendants(ns+"rules").First(e => e.Element(ns+"fullName").Value == "No Service Contact Assigned");
    Console.WriteLine(setting.Element(ns+"active").Value); 
    

    Note that the document is not the root node (e.g. Workflow element), but the Root property on the document is. I also added that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my JSF/Facelets app, here's a simplified version of part of my form: <h:form
I am beginner in PHP. I am trying to parse this xml file. <relationship>
Here is part of my web.config for my WCF service: <bindings> <basicHttpBinding> <binding name=sslBinding>
Here is my code, which takes two version identifiers in the form 1, 5,
I have an XML file, part of which looks like this: <wave waveID=1> <well
Trying to parse an HTML document and extract some elements (any links to text
I am trying to use XML::RAI perl module on UTF8 coded text and I
I'm trying to make a meta-language for writing markup code (such as xml and
I know that using Regular expressions to parse or manipulate HTML/XML is a bad
I am trying to learn XML by reading from W3schools. I am already at

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.