How do I get the contents of a node whose immediate ancestor is using linq 2 xml. Here is a sample xml file
- xml version="1.0" encoding="UTF-8"?>
- <article article-type="proceedings" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://www.niso.org/standards/z39-96/ns/oasis-exchange/table">
- <front>
- <title-group>
- <title>SMALL angle scattering polarization biopsy: a comparative analysis of various skin diseasestitle>
- title-group>
- ....
- ....
- front>
- <body>
- <boxed-text id="s1" position="anchor">
- <sidebar-label>S1.sidebar-label>
- <sec id="sec1">
- <title>EXPERIMENTAL TECHNIQUEtitle>
- <p>In the case of lupus the changes in the basal membrane adversely affect differentiation of the epidermis; this results in disorders of keratinization combined with progressive atrophy.p>
- sec>
- boxed-text>
- ....
- ....
- body>
I'm trying to get the value EXPERIMENTAL TECHNIQUE from the above example using both Descendants and Ancestors method of LINQ 2 XML. I've tried
- var item=from x in doc.Descendants("label")
- where x.Ancestors("sec")
- select x;
but getting an error
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'bool'
Nilesh ShahPosted Oct 17, 2017, 9:19 AM
ValoChelePosted Oct 16, 2017, 9:34 PM
Nilesh ShahPosted Oct 16, 2017, 1:29 PM