Jump to content

namespaces not found while reading attributes in an Xelement

- - - - -

  • Please log in to reply
No replies to this topic

#1
AWS

AWS

    Administrator

  • Administrators
  • 53995 posts
  • LocationJoliet, IL U.S.A.

I am reading an xml doc in an Xdocument. There are several namespaces declared in the root node:

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:nflx="http://www.netflix.com/20111231" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" targetNamespace="http://www.netflix.com/20111231" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:num="http://www.xbrl.org/dtr/type/numeric" xmlns:nonnum="http://www.xbrl.org/dtr/type/non-numeric" xmlns:us-types="http://fasb.org/us-types/2011-01-31" xmlns:invest="http://xbrl.sec.gov/invest/2011-01-31">

When I look at elements in the xdocument, I can always retrieve the correct namespace no problem: e.g.

    <link:roleType roleURI="http://www.netflix.com/role/StatementConsolidatedBalanceSheets" id= "StatementConsolidatedBalanceSheets">

     "doc1.Root.Elements.ElementAt(0).Name.NamespaceName"    returns: http://www.xbrl.org/2003/linkbase as expected.

BUT when I do the same for an ATTRIBUTE in an element, I always get nothing, regardless of whether there is a prefix or not: e.g.

<element id="ContentLibraryNetCurrent" name="ContentLibraryNetCurrent" nillable="true" type="xbrli:monetaryItemType" substitutionGroup="xbrli:item" xbrli:periodType="instant" xbrli:balance="debit" />

   "Element.Attributes.ElementAt(0).Name.NamespaceName"  (no prefix) returns an empty string
   "Element.Attributes.ElementAt(3).Name.NamespaceName" (prefix is xbrli) also returns an empty string

Anyone know what's up?


View the full article




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users