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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:17:13+00:00 2026-05-18T03:17:13+00:00

Here is a snippet of the XML file I am trying to read. <?xml

  • 0

Here is a snippet of the XML file I am trying to read.

<?xml version="1.0" encoding="UTF-8" ?> 
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
   <ERRORCODE>0</ERRORCODE> 
   <PRODUCT BUILD="06-11-2010" NAME="FileMaker" VERSION="Pro 11.0v2" /> 
   <DATABASE DATEFORMAT="M/d/yyyy" LAYOUT="" NAME="Appointments.fp7" RECORDS="13" TIMEFORMAT="h:mm:ss a" /> 
   <METADATA>
      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="CalDateCalc1" TYPE="DATE" /> 
      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="CalDateCalc2" TYPE="DATE" /> 
      <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="CalDateCalc3" TYPE="DATE" /> 
      ...
   </METADATA>
   ...
</FMPXMLRESULT>

My goal is to get the the NAME attribute and the TYPE attribute out of the xml file. I have tried to use both XElement and XPath but I have gotten neither to work.

foreach (var file in System.IO.Directory.EnumerateFiles(path, "*.xml", System.IO.SearchOption.TopDirectoryOnly))
{
    var fileInfo = new System.IO.FileInfo(file);
    var name = fileInfo.Name.Split('.')[0];
    XElement root = XElement.Load(file);
    if (!db.Tables.Contains(name))
    {
        XElement MetaData = root.Element("METADATA"); //This returns null
        foreach(var field in MetaData.Elements("FIELD"))
        {
            //...
        }
    }
    //...
}

When I try to select the METADATA group the selection returns null. What mistake am I making with my code?

  • 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-18T03:17:13+00:00Added an answer on May 18, 2026 at 3:17 am

    Your <METADATA> element resides in an XML namespace. You have to specify that namespace to the Element() method:

    XNamespace ns = "http://www.filemaker.com/fmpxmlresult";
    XElement metaData = root.Element(ns + "METADATA");  // This will work.
    

    See the XName class for more details.

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

Sidebar

Related Questions

I have a snippet of an XML file that looks like: <?xml version=1.0 encoding=utf-16?>
Here is a snippet from the XML file I am trying to parse: <Item
I have a xml file which has the following header: <?xml version=1.1 encoding=UTF-8?> .
Here is a snippet of the XML file: <Catalog> <CDs> <CD> <Manuals> <Manual>123DHX<Manual> <Manual>5axDHX<Manual>
I'm trying to add all the nodes in an XML file into a listView,
I'm parsing an XML file and trying to return the output to a div.
I have this xml snippet as part of a xml file that will be
I'm trying to create an XML file with a corresponding XSLT stylesheet. Everything sort
I have a XML file that I'm trying to group by the attribute Width.
I've got the following XML snippet as part of a larger XML file that

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.