xml - select XElements with xmlns -
how select element xmlns specified? need select include/fragment element. i've tried adding http://schemas.microsoft.com/wix/2006/wi before element names, doesn't work. in xmldocument there namespacemanager functionality, don't see same stuff in xdocument. how select element xmlns?
<include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <fragment/> </include>
i've tried:
ienumerable<xelement> fragments = d.element("include").elements("fragment");
and
const string xmlns="http://schemas.microsoft.com/wix/2006/wi/"; ienumerable<xelement> fragments = d.element(xmlns+"include").elements(xmlns+"fragment");
you need make xmlns
variable xnamespace
(instead of string):
xnamespace xmlns = "http://schemas.microsoft.com/wix/2006/wi"; ienumerable<xelement> fragments = doc.element(xmlns + "include").elements(xmlns + "fragment");
then should work fine!
Comments
Post a Comment