[SOLVED] Looping through items and read desired elements

Issue I have something like this: <ITEMS ASOF_DATE="6/2/2022" RECORDS="1" CREATE_DATE="6/3/2022" > <ITEM> <port_name>95512M</port_name> <bench_name>LEHSECUR</bench_name> <SomeValue>-808</SomeValue> </ITEM> <ITEM> <port_name>95512M</port_name> <bench_name>LEHSECUR</bench_name> <SomeValue>-808</SomeValue> <SomeOtherValue>-808</SomeOtherValue> </ITEM> <ITEM> <port_name>95512M</port_name> <bench_name>LEHSECUR</bench_name> <SomethingElse>234</SomethingElse> </ITEM> </ITEMS> It can have multiple <ITEM> items and those can have multiple elements

Continue reading

[SOLVED] XML Linq with nested elements

Issue I’m trying to load an XML file formatted like this to a datatable: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <controls:controls xmlns="http://scap.nist.gov/schema/sp800-53/2.0" xmlns:controls="http://scap.nist.gov/schema/sp800-53/feed/2.0" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" pub_date="2017-08-01" xsi:schemaLocation="http://scap.nist.gov/schema/sp800-53/feed/2.0 http://scap.nist.gov/schema/sp800-53/feed/2.0/sp800-53-feed_2.0.xsd"> <controls:control> <family>ACCESS CONTROL</family> <number>AC-1</number> <title>POLICY AND PROCEDURES</title> <baseline>LOW</baseline> <baseline>MODERATE</baseline> <baseline>HIGH</baseline> <baseline>PRIVACY</baseline> <statement> <description/> <statement>

Continue reading

[SOLVED] Remove all child nodes from the parent except one specific, an xml in c #

Issue This is Xml <ItemWarehouseInfo> <row> <MinimalStock>0.000000</MinimalStock> <MaximalStock>0.000000</MaximalStock> <MinimalOrder>0.000000</MinimalOrder> <StandardAveragePrice>0.000000</StandardAveragePrice> <Locked>tNO</Locked> <WarehouseCode>Mc</WarehouseCode> <DefaultBinEnforced>tNO</DefaultBinEnforced> </row> …other equal lines </ItemWarehouseInfo> I have to remove all child nodes from every row node except for the WarehouseCode node I tried this method but obviously

Continue reading

[SOLVED] Parsing XML Data with LINQ

Issue I am new to LINQ. I need to return the id with the correct price information for today’s date for each MPrice. Here is an example of the XML: <Pricing> <MPrice> <Id>0079</Id> <Price> <Price>31.25</Price> <StartDt>2009-8-01</StartDt> <EndDt>2009-08-26</EndDt> </Price> <Price> <ListPrice>131.25</ListPrice>

Continue reading