Xml.Document

 

This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns the contents of an XML document as a hierarchical table (list of records).

Xml.Document(contents as any, optional options as nullable record, optional encoding as nullable number) as table  

ArgumentDescription
contentsThe contents may be directly passed to the function as text, or it may be the binary value returned by a function like File.Contents or Web.Contents.
optionsXml document options.
encodingEncoding value.
  • The output of the function has a tabular shape. Each row in the table corresponds to a node at the current level of depth. Descending into the XML tree is done through accessing the “Value” property of a given row.

The precise shape of the output table is as follows:

Value.Type(Xml.Document("<a></a>")) =  
  
type {[  
  
    Name = text,  
  
    Namespace = text,  
  
    Value = any,  
  
    Attributes = {[  
  
        Name = text,  
  
        Namespace = text,  
  
        Value = text  
  
    ]}  
  
]}  

Xml.Document("<a></a>")  
  
    equals  { [  
  
    Name = "a",  
  
    Namespace = "",  
  
    Value = {},  
  
    Attributes = {}  
  
] }  

Show: