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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:35:42+00:00 2026-05-31T04:35:42+00:00

I have 290 Group Policy Backup xml files which I need to enumerate in

  • 0

I have 290 Group Policy Backup xml files which I need to enumerate in separate folders.

With each Group Policy backup xml file, I need to query the Policy settings.

Anyone who’s looked at a Group Policy xml backup file before would know they’re chock-a-block full of Namespace declarations.

I want to know, using Linq to XML, as I query each xml file, how can I dynamically query the XML the Namespace and then append the Namespace into the Linq query for the child nodes/values?

Here are some examples of the xml structure.

  <User>
    <ExtensionData>
      <Extension xmlns:q1="http://www.microsoft.com/GroupPolicy/Settings/Scripts" xsi:type="q1:Scripts">
        <q1:Script>


    <ExtensionData>
      <Extension xmlns:q1="http://www.microsoft.com/GroupPolicy/Settings/IE" xsi:type="q1:InternetExplorerSettings">
        <q1:PreferenceMode>true</q1:PreferenceMode>


    <ExtensionData>
      <Extension xmlns:q2="http://www.microsoft.com/GroupPolicy/Settings/Registry" xsi:type="q2:RegistrySettings">
        <q2:Policy>
          <q2:Name>Disable changing accessibility settings</q2:Name>
          <q2:State>Enabled</q2:State>


    <ExtensionData>
      <Extension xmlns:q1="http://www.microsoft.com/GroupPolicy/Settings/DriveMaps" xsi:type="q1:DriveMapSettings">
        <q1:DriveMapSettings clsid="{8FDDCC1A-0C3C-43cd-A6B4-71A6DF20DA8C}">

My initial code looks like this:

Dim NS As XNamespace = "http://www.microsoft.com/GroupPolicy/Settings"
NodeValue = XDoc.Descendants(NS + NodeName).First().Value

As you can see I’m going to face literally dozens of different Namespaces, at this stage I don’t even know what they all are.

My end-task is to trawl through 290 directories, each containing one Group Policy xml backup file. I then need to read the Policy Name from each of the settings contained within the backup file.

Because I don’t know what Policy settings each xml flie will contain, I don’t know what Namespace(s) I need to use when attempting to read the xml values. Each xml file may even contain multiple namespaces.

How do I dynamically read the Namespace in Linq so I can read the values?

Thanks

  • 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-31T04:35:43+00:00Added an answer on May 31, 2026 at 4:35 am

    Here’s what I ended up with:

    Dim ListOfNamespaces = z.Root.DescendantsAndSelf.Attributes().Where(Function(a) a.IsNamespaceDeclaration).GroupBy(Function(a) If(a.Name.[Namespace] = XNamespace.None, [String].Empty, a.Name.LocalName), Function(a) XNamespace.[Get](a.Value)).ToDictionary(Function(g) g.Key, Function(g) g.First())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of files in mnesia directory, like fs_my@node_14585_1263_545605_962084.273 fs_my@node_14702_1263_545842_879762.273 fs_my@node_14585_1263_545605_962084.290 ...
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have the following view model which contains an array of elements function ReservationsViewModel()
I have the following jQuery code which I'm using to populate a jqGrid. It
I have a process which suddenly hanged and is not giving any core dump
I have a table in the following structure... ID USER_ID INTEREST 1 290 soccer
I have custom UIViewController which looks like this. @implementation UIViewControllerCustom - (id)init { self
I have a UITableView to which I add a tableFooterView , for some reason
I have a set of data and need to pull out one record for
I have int valA[3] = {290, 340, 390}; int valB[3] = {160, 200, 240};

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.