Xml tag processing

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
Im reading in the following xml data below. I am trying to isolate on any tag/node that contains the literal "filler" and weed-out the rest when the file is saved.

I tried to use this code unsuccessfully:

Dim xmlFile = XDocument.Load("Main.xml")
Dim xNoFiller As XDocument = <?xml version="1.0" encoding="utf-8"?>
<Rows> _
<%= From qRw As XElement In xmlFile.Element("Rows").Elements _
Where qRw.Element("Filler").Value <> "" _
Select Rw = qRw _
Order By Rw.Attribute("SortOrder") %> _
</Rows>


Id appreciate any insight to accomplishing this using VS and VB 2010.

Thanks in advance.

------------
<?xml version="1.0" encoding="utf-8"?>
<Rows> _

<Row Sortorder="1
<span style="white-space:pre <Field1 Deleteme="false 1</Field1>
<span style="white-space:pre <Field2 Deleteme="false </Field2>
<span style="white-space:pre <Field3 Deleteme="false </Field3>
<span style="white-space:pre <Field4 Deleteme="false </Field4>
<span style="white-space:pre <Field5 Deleteme="false </Field5>
<span style="white-space:pre <Filler Deleteme="false filler</Filler>
</Row>
<Row Sortorder="1
<span style="white-space:pre <Field1 Deleteme="false </Field1>
<span style="white-space:pre <Field2 Deleteme="false </Field2>
<span style="white-space:pre <Field3 Deleteme="false </Field3>
<span style="white-space:pre <Field4 Deleteme="false </Field4>
<span style="white-space:pre <Field5 Deleteme="false </Field5>
<span style="white-space:pre <Filler Deleteme="false </Filler>
</Row>
<Row Sortorder="1
<span style="white-space:pre <Field1 Deleteme="false </Field1>
<span style="white-space:pre <Field2 Deleteme="false </Field2>
<Field3 Deleteme="false </Field3>
<Field4 Deleteme="false </Field4>
<Field5 Deleteme="false </Field5>
<Filler Deleteme="false </Filler>
</Row>
<Row Sortorder="2
<Field1 Deleteme="false 2</Field1>
<Field2 Deleteme="false </Field2>
<Field3 Deleteme="false </Field3>
<Field4 Deleteme="false </Field4>
<Field5 Deleteme="false </Field5>
<Filler Deleteme="false filler</Filler>
</Row>

<br/>

View the full article
 
Back
Top