Last active
September 2, 2015 08:39
-
-
Save taisyo7333/77770fd81da4ece469f2 to your computer and use it in GitHub Desktop.
Get a value of attribute by C# LINQ to XML .
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XElement po = XElement.Load(path_xml); | |
// <Substrates> | |
// <Substrate SubstrateType = "Strip" SubstrateId = "@@@"> | |
var elems = po.Elements().Descendants() | |
.Where(node => node.Name.LocalName == "Substrate" | |
&& (string)node.Attribute("SubstrateType") == "Strip" | |
&& node.Attribute("SubstrateId") != null | |
) | |
.Select(elem => elem.Attribute("SubstrateId").Value); | |
foreach (var el in elems) | |
{ | |
// write out @@@ | |
Trace.WriteLine(el.ToString()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<MapData xmlns="urn:semi-org:xsd.E142-1.V1005.SubstrateMap"> | |
<Layouts> | |
<Layout LayoutId="WaferLayout_abcxyz" DefaultUnits="mm" TopLevel="true"> | |
<Dimension X="1" Y="4" /> | |
<ChildLayouts> | |
<ChildLayout LayoutId="DeviceLayout_abcxyz" /> | |
</ChildLayouts> | |
</Layout> | |
<Layout LayoutId="DeviceLayout_abcxyz" DefaultUnits="mm"> | |
<Dimension X="1" Y="600" /> | |
</Layout> | |
</Layouts> | |
<Substrates> | |
<Substrate SubstrateType="Strip" SubstrateId="MyStripID" /> | |
</Substrates> | |
<SubstrateMaps> | |
<SubstrateMap SubstrateType="Strip" SubstrateId="MyStripID" | |
LayoutSpecifier="WaferLayout_abcxyz/DeviceLayout_abcxyz" | |
Orientation="0" | |
OriginLocation="LowerRight" | |
AxisDirection="UpLeft"> | |
</SubstrateMap> | |
</SubstrateMaps> | |
</MapData> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment