How to extract the attribute value from XML file using custom extractor using U-SQL job. I can able to extract the sub element values from XML file.
sample Xml File:
<?xml version="1.0" encoding="UTF-8"?>
<Users>
<User ID="001">
<FirstName>david</FirstName>
<LastName>bacham</LastName>
</User>
<User ID="002">
<FirstName>xyz</FirstName>
<LastName>abc</LastName>
</User>
</Users>
I can able to extract Firstname and lastname using the below code.How can i get ID value as a part of csv file.
Sample U sql Job:
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];
@input = EXTRACT
FirstName string,
LastName string
FROM @"/USERS.xml"
USING new Microsoft.Analytics.Samples.Formats.Xml.XmlExtractor("User",
new SQL.MAP<string, string> {
{"FirstName","FirstName"},
{"LastName","LastName"}
);
@output = SELECT * FROM @input;
OUTPUT @output
TO "/USERS.csv"
USING Outputters.Csv();
