Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
adamplowman
New Member

Looping through XML

Hi All 

 

I have the following XML 

 

 

 

 

 

<?xml version="1.0" encoding="UTF-8" ?>
<webUsers>
<webUser>
		<description></description>
		<name>Name</name>
		<email>Email</email>
		<virtualFile>
			<description>This is a folder</description>
			<path>Path</path>
			<virtualFiles>
				<virtualFile>
					<path>Path</path>
					<alias>Folder</alias>
					<virtualFiles>
						<virtualFile>
							<path>Path</path>
							<alias>Folder</alias>
							<virtualFiles />
						</virtualFile>
					</virtualFiles>
				</virtualFile>
				<virtualFile>
					<path>Path</path>
					<alias>Folder</alias>
					<virtualFiles>
						<virtualFile>
							<path>Path</path>
							<alias>Folder</alias>
							<virtualFiles>
								<virtualFile>
									<path>Path</path>
									<alias>Folder</alias>
									<virtualFiles />
								</virtualFile>
							</virtualFiles>
						</virtualFile>
						<virtualFile>
							<path>Path</path>
							<alias>Folder</alias>
							<virtualFiles>
								<virtualFile>
									<path>Path</path>
									<alias>Folder</alias>
									<virtualFiles />
								</virtualFile>
							</virtualFiles>
						</virtualFile>
					</virtualFiles>
				</virtualFile>
			</virtualFiles>
		</virtualFile>
	</webUser>
	<webUser>
		<description></description>
		<name>Name</name>
		<email>Email</email>
		<virtualFile>
			<description>This is a folder</description>
			<path>Path</path>
			<virtualFiles>
				<virtualFile>
					<path>Path</path>
					<alias>Folder</alias>
					<virtualFiles>
						<virtualFile>
							<path>Path</path>
							<alias>Folder</alias>
							<virtualFiles />
						</virtualFile>
					</virtualFiles>
				</virtualFile>
			</virtualFiles>
		</virtualFile>
	</webUser>
	
</webUsers>

 

 

 

 I need to loop through this, pulling out all the virtualfiles information. The issue here is that there could be x number of these per webUsers. 

2 REPLIES 2
adamplowman
New Member

Thanks and sorry for not being clear. The issue is that the XML will have an unknow number of webUser nodes with varying virtualFile nodes. I need to expand them all dynamically to show the value "Path"

 

For Example 

 

<virtualFile>
			<description>This is a folder</description>
			<path>Path</path>
			<virtualFiles>
				<virtualFile>
					<path>Path 1</path>
					<alias>Folder 1</alias>
					<virtualFiles>
						<virtualFile>
							<path>Path 2</path>
							<alias>Folder 2</alias>
							<virtualFiles />
						</virtualFile>
					</virtualFiles>
				</virtualFile>
				<virtualFile>
					<path>Path 3</path>
					<alias>Folder 3</alias>
					<virtualFiles>
						<virtualFile>
							<path>Path 4</path>
							<alias>Folder 4</alias>
							<virtualFiles>
								<virtualFile>
									<path>Path 5</path>
									<alias>Folder 5</alias>
									<virtualFiles />
								</virtualFile>
							</virtualFiles>
						</virtualFile>
						<virtualFile>
							<path>Path 6</path>
							<alias>Folder 6</alias>
							<virtualFiles>
								<virtualFile>
									<path>Path 7</path>
									<alias>Folder 7</alias>
									<virtualFiles />
								</virtualFile>
							</virtualFiles>
						</virtualFile>
					</virtualFiles>
				</virtualFile>
			</virtualFiles>
		</virtualFile>

 

So with the above i need to show Path 2, Path 5 and Path 7

 

 

v-kkf-msft
Community Support
Community Support

Hi @adamplowman ,

 

What is your question? Based on my testing, if we import the data directly using the XML connector, PQ will automatically loop through the data.

 

vkkfmsft_0-1653547791189.png

vkkfmsft_2-1653547915924.png

 

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors