ValoChele

ValoChele

  • 1.8k
  • 68
  • 3.6k

Need help in making xml link node modification?

Nov 8 2017 11:55 AM
I have some xml files which contains nodes like
  1. <disp-formula id="deqn1">...disp-formula>  
  2. <disp-formula id="deqn2-5">...disp-formula>  
  3. <disp-formula id="deqn6-9">...disp-formula>  
  4. <disp-formula id="deqn10">...disp-formula>  
along with other nodes in the file. Also the file has link nodes related to the above nodes like
  1. <xref ref-type="disp-formula" rid="deqn1">...xref>  
  2. <xref ref-type="disp-formula" rid="deqn3">...xref>  
  3. <xref ref-type="disp-formula" rid="deqn8">...xref>  
I'm trying to modify those link nodes <xref ref-type="disp-formula" rid="deqn3">...xref> to <xref ref-type="disp-formula" rid="deqn2-5">...xref>, <xref ref-type="disp-formula" rid="deqn8">...xref> to <xref ref-type="disp-formula" rid="deqn6-9">...xref>
and so on, as there are no such thing as id="deqn3", id="deqn8"
in the file and attribute values like deqn3, deqn8 fall in the range of the attributes <disp-formula id="deqn2-5"> and <disp-formula id="deqn6-9">
 
that is why there are replaced by their respective id's.
 
How do I do this using LINQ to xml?
 
I dont even know where to start and how do I structure the procedures required?
 
Please help!!

Answers (2)