Reading XML - problem with name spaces

Hello Guys,

Im trying to get Elements from my XML file, but i dont know how to select it when i have namespaces like that:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ksx="http://www.w3.org/1999/XSL/Transform" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<xsl:output encoding="utf-8" indent="no" method="html"/>
<documents xmlns="http://www.w3.org">

So per online viewers my element tree is like that stylesheet->documents.

I have tried something like that - xmlDoc.Element(“stylesheet”).Element(“documents”).Elements(…). Obviously its not working i cannot select first two elements. I believe its due name spacing used. Could you help me here please?

Hello Peter,

Thank you i have followed the guide, but i have got error:

For Each: The ‘:’ character, hexadecimal value 0x3A, cannot be included in a name.

namespace1=http://www.w3.org/1999/XSL/Transform

doc.Element(namespace1+“stylesheet”)

Could you assist please?

please share the xml as file with us. thanks

also check on how the initial check can be done within the immediate panel. Please do it for the root and let us know the result

I had to put brackets in namespace1={XSLT Namespace} - now it is working. Thank you Peter!

its not recommended as it looks like namespace1 variable was used as of dtatype string but is needed as of datatype: XNamespace

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.