Well, so far no responses to this last part of my problem - but thanks very 
much to those of you who got me this far. I'm 90% there to the solution I need. 
 So I'm moving this last part of my question to Flashcoders... unless someone 
has any idea how to solve this last part of the problem and can pipe in with an 
answer:


--- In [email protected], "Jason" <jason.merr...@...> wrote:
>
>  So I am almost there now, this is working, EXCEPT the code only inserts one 
> topic per subtopic, even though there are more <row> nodes that are tagged to 
> the same subtopic in the same module.  If more than one topic belongs to a 
> topics node, it gets overwritten, so only the last one found is inserted. The 
> code as I have it now (thanks Ian) is:
> 
> for each (var contentRowItem2:XML in _contentXML..row)
> {
>       var moduleName:String = stripSharepointPoundTag(contentRowItem2.Module);
>       var topicXML:XML = new XML("<topic />");
>       topicx...@title = contentRowItem2.LinkTitle;
>       topicx...@author = stripSharepointPoundTag(contentRowItem2.Author);
>       topicXML.overview = new XML(<overview />);
>       topicXML.overview = contentRowItem2.Overview;
>       
>       var modulesList:XMLList = finalXML..module.(@title == moduleName);
>       
>       modulesList[0]..subsection.(@title==contentRowItem2.Subsection).topics 
> = new XML(<topics />);
>       
>       if (modulesList.length()!= 1)
>       throw new Error("Can't find single module with title:"+moduleName);
>       var topicsList:XMLList = 
> modulesList[0]..subsection.(@title==contentRowItem2.Subsection).topics;
> 
>       if (topicsList.length()!=1)
>       throw new Error("Can't find single subsection with 
> title:"+contentRowItem.Subsection);
> 
>       topicsList[0].appendChild(topicXML);
> }
> 
> 
> This produces this:
> 
> <xml>
>   <modules>
>     <module title="iRequire" orderID="0">
>       <subsections>
>         <subsection title="Technical Constraints">
>           <topics>
>             <topic title="Test Topic 1" author="Markley, Bill">
>               <Overview>Blah blah blah</Overview>
>             </topic>
>           </topics>
>         </subsection>
>         <subsection title="Project Information">
>           <topics>
>             <topic title="Test Topic 3" author="Merrill, Jason">
>               <Overview>Blah blah blah and more blah and even more 
> blah</Overview>
>             </topic>
>           </topics>
>         </subsection>
>       </subsections>
>     </module>
>     <module title="iDesign" orderID="1.00000000000000">
>       <subsections>
>         <subsection title="Assumptions">
>           <topics>
>             <topic title="Test Topic 15" author="Merrill, Jason">
>               <Overview>Blah</Overview>
>             </topic>
>           </topics>
>         </subsection>
>       </subsections>
>     </module>
>     <module title="iBuild" orderID="2.00000000000000">
>       <subsections>
>        ...etc.
> 

But only one topic appears in each subsection.topics - the last one found, not 
all of them found for the module and subsection.

> ...the line, topicsList[0].appendChild(topicXML); is suspect, but wouldn't 
> appendChild just add a new child, not overwrite the existing child?  Thanks 
> for any help,
> 
> Jason
>




Reply via email to