If you want to use XPATH like syntax. You can serialize to XML, load it into an XmlDocument, make your changes. Then use the SerializeToX12 method to change the xml back to X12. The code snippet below is from the ParseAndTransformToX12 unit test that demonstrates
that they should produce the exact same x12 as the original. You would just need to do your transformation to the xml variable in between.
This works best if you are just changing existing elements. If you are adding and removing elements it is better to use the object model because some validation against the transaction set's specification will occur.
var parser = new X12Parser();
Interchange interchange = parser.ParseMultiple(stream).First();
string originalX12 = interchange.SerializeToX12(true);
string xml = interchange.Serialize();
string x12 = parser.TransformToX12(xml);
Interchange newInterchange = parser.ParseMultiple(x12).First();
string newX12 = newInterchange.SerializeToX12(true);