2011-01-27 13 views
0

これらの要素を異なる名前空間でマージすることが可能かどうかを知りたい。Linq to XML、属性は同じだが異なる名前空間をマージする

 <imsss:objectives> 
     <imsss:primaryObjective objectiveID="ettiquette_completed"/> 
      <imsss:objective objectiveID="previous_sco_completed"> 
       <imsss:mapInfo targetObjectiveID="com.scorm.golfsamples.sequencing.forcedsequential.playing_completed" readNormalizedMeasure="true" readSatisfiedStatus="true" /> 
      </imsss:objective> 
     </imsss:objectives> 
     <adlseq:objectives> 
     <adlseq:objective objectiveID="ettiquette_completed"> 
      <adlseq:mapInfo targetObjectiveID="com.scorm.golfsamples.sequencing.forcedsequential.ettiquette_completed" readCompletionStatus="true" writeCompletionStatus="true"/> 
     </adlseq:objective> 
     <adlseq:objective objectiveID="previous_sco_completed"> 
      <adlseq:mapInfo targetObjectiveID="com.scorm.golfsamples.sequencing.forcedsequential.playing_completed" readCompletionStatus="true" writeCompletionStatus="false"/> 
     </adlseq:objective> 
     </adlseq:objectives> 

ので、基本的に私は、私は同じobjectiveid属性と一緒にすべての要素を置くLINQクエリを持っている現時点で

<imsss:objectives> 
     <imsss:primaryObjective objectiveID="ettiquette_completed"> 
      <imsss:mapInfo targetObjectiveID="com.scorm.golfsamples.sequencing.forcedsequential.ettiquette_completed" readCompletionStatus="true" writeCompletionStatus="true"/> 
     </imsss:primaryObjective> 
      <imsss:objective objectiveID="previous_sco_completed"> 
       <imsss:mapInfo targetObjectiveID="com.scorm.golfsamples.sequencing.forcedsequential.playing_completed" readNormalizedMeasure="true" readSatisfiedStatus="true" readCompletionStatus="true" writeCompletionStatus="false/> 
      </imsss:objective> 
     </imsss:objectives> 

で終わるしたいと思います。

   XElement seqColl = getSequencingCollection(identifier); 
       var ImssObj = seqColl.Element(imsss + "objectives").Elements(); 
       var AdlObj = seqColl.Element(adlSeq + "objectives").Elements(); 
       var newEl = from o in ImssObj 
          join a in AdlObj on o.Attribute("objectiveID").Value equals a.Attribute("objectiveID").Value 
          select new XElement(o.Name, new XAttribute(o.Attribute("objectiveID")), o.Elements(), a.Elements()); 

おかげで、すべての(それは地元のシーケンシングおよび共有シーケンシングを取得する必要がありますようgetSequencingCollectionメソッドは、XMLからすべてのシーケンシング情報を取得するために正しく動作します)。

+0

誰かがそれを見たいと思っているなら、私はこれにかなりの具体的な解決策を行っています。私はそれが誰にも役立つだろうと想像できない。しかし、あなたが長いC#関数iveよりむしろ別の方法を知っていれば、私に知らせてください。ありがとう。 – Shannow

答えて

0

私はこれに非常に具体的な解決策を講じています。私はそれが誰にも役立つだろうと想像できない。しかし、あなたが長いC#関数iveよりむしろ別の方法を知っていれば、私に知らせてください。ありがとう

関連する問題