A
AK
Hiya,
I've got some xml elements that look like this:
<dc:title xml:lang="fr">myTitle</dc:title>
I would like to be able to get the name with the prefix, i.e.
'dc:title', but I can only manage to get either 'title' only or the
namespace (xmlns:dc="http://purl.org/dc/elements/1.1/"). Code is
below.
XElement xml = XElement.Load(metadataPath);
foreach (XElement child in xml.Elements())
{
string childElement = child.Name.LocalName; // returns 'title'
string namespace= child.Name.NamespaceName; // returns 'http://
purl.org/dc/elements/1.1/'
}
Is it possible to get out what I want from this?
Many thanks,
AK
I've got some xml elements that look like this:
<dc:title xml:lang="fr">myTitle</dc:title>
I would like to be able to get the name with the prefix, i.e.
'dc:title', but I can only manage to get either 'title' only or the
namespace (xmlns:dc="http://purl.org/dc/elements/1.1/"). Code is
below.
XElement xml = XElement.Load(metadataPath);
foreach (XElement child in xml.Elements())
{
string childElement = child.Name.LocalName; // returns 'title'
string namespace= child.Name.NamespaceName; // returns 'http://
purl.org/dc/elements/1.1/'
}
Is it possible to get out what I want from this?
Many thanks,
AK