I'm really struggling to figure it out.
Im using c #.
I want to return IEnumerable products from an xml file.
The following is a sample xml structure.
I need to get a list of products for which the user attribute productEnriched is set to true.
Some products usually do not have a custom attribute section.
my head wanted to hurt just thinking about it!
<?xml version="1.0" encoding="UTF-8"?> <catalog xmlns="http://www.mynamespace.com" catalog-id="MvgCatalog"> <product> <custom-attributes> <custom-attribute attribute-id="productEnriched">true</custom-attribute> </custom-attributes> </product> </category>
thanks for any help
To clear things up, I added some more elements to the xml example
I need to get a list of products only those products that have a custom-attribute with the productEnriched attribute and true some products in xml will not have any custom-attributes or custom-attributes some products will have it, but with a false value I just need a list of products where it exists and is true
<?xml version="1.0" encoding="UTF-8"?> <catalog xmlns="http://www.mynamespace.com" catalog-id="MvgCatalog"> <product> <upc>000000000000</upc> <productTitle>My product name</productTitle> <custom-attributes> <custom-attribute attribute-id="productEnriched">true</custom-attribute> <custom-attribute attribute-id="somethingElse">4</custom-attribute> <custom-attribute attribute-id="anotherThing">otherdata</custom-attribute> </custom-attributes> </product> </category>
source share