Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Need help with XML::Twig, something strange is happening!!

by stevee (Acolyte)
on Mar 28, 2007 at 13:35 UTC ( #607020=perlquestion: print w/replies, xml ) Need Help??

stevee has asked for the wisdom of the Perl Monks concerning the following question:

I have a script which in a simpler form was working quite happily, but now things are just a little more complicated does something funny.
The script opens a csv file which has many rows each corresponding to an entity (called a section) in an XML file. The columns contain values for attibutes, the most important of which are the nodeId (uniques) and the parentNodeId. In effect each section corresponds to a web page as this is a Stellant project file. The home root (of which there is only one) has all other sections as children, though some of those children can have their own children (nested sections). Nesting can be up to level 8. The parentNodeId is the unique nodeId of the parent.
My simpler test version worked fine on csv files which had up to level 5 nesting and 5 attributes per section element. The real thing has up to level 8 nesting and some twenty odd attributes, but I do not think the number of attributes matters.
The real meat of the code (less the loading of files etc.) is as follows:
foreach $line (@navmod) { #sorting taken out, file now pre-sorted out +side this perl routine chomp($line); print "$line\n"; print LOG "$line\n"; $linecount++; print LOG "Line $linecount\n"; #($ParentNodeId, $label, $PrimaryURL, $NavNodeId, $SecondaryURL, $ +UrlDirName) = split /,/, $line; ($ParentNodeId,$NodeId, $level, $canode, $label, $theme, $template +, $active, $secgrp, $secacc, $ptemp, $stemp, $altlabel, $fragsof +f, $canodeid, $f2, $clist1, $clist2, $clist3, $clist4, $clist5, $clist6, $clist7, $clist8, + $clist9, $clist10, $clist11, $clist12, $clist13) = split /,/, $line; #get children of root and create sections if ($ParentNodeId eq 1) { #add node to %proc_secs #$proc_secs{$NodeId} = $PrimaryURL; print LOG "Level eq 1\n"; #print "$label is a Child of a Child\n"; #create section my $section = ""; my $esec = new XML::Twig::Elt('section',$section); #need to get label and urkdirname #label is as per model #urlDirName is label less spaces $esec->set_att('label',$label); $label =~ s/\s//g; $esec->set_att('urlDirName',$label); $esec->set_att('active',$active); $esec->set_att('dSecurityGroup',$secgrp); $esec->set_att('dDocAccount',$secacc); $esec->set_att('primaryUrl',$ptemp); $esec->set_att('secondaryUrl',$stemp); $esec->set_att('AltLabel',$altlabel); $esec->set_att('FragmentsOff',$fragsoff); $esec->set_att('ContentArchitectureNodeId',$canodeid); #this w +ill need changing for real run $esec->set_att('FragmentsOffSiteLevel',$f2); $esec->set_att('ContentList_CriteriaMetaData',$clist1); $esec->set_att('ContentList_ResultCount',$clist2); $esec->set_att('ContentList_MaxGetSearchResultCount',$clist3); $esec->set_att('ContentList_RangeMetaDataField',$clist4); $esec->set_att('ContentList_RangeMin', $clist5); $esec->set_att('ContentList_RangeMax',$clist6); $esec->set_att('ContentList_ExtraCriteria',$clist7); $esec->set_att('ContentList_SortSpec',$clist8); $esec->set_att('csFragMaxDepth',$clist9); $esec->set_att('csFragStartNodeId',$clist10); $esec->set_att('ContentList_Title',$clist11); $esec->set_att('ContentList_ShowDetailsOff', $clist12); $esec->set_att('ContentList_OptionalDisplayField',$clist13); $esec->set_att('nodeId',$NodeId); $esec->paste('last_child', $root); print LOG "$esec\n"; $twig->flush; $twig->print; } #get children of children and create sections if ($ParentNodeId gt 1) { #get relevant section with a catch all #need to use get_xpath command my @sections = $twig->get_xpath('section[@nodeId = "'.$ParentN +odeId.'"]'); print "@sections\n"; foreach my $sectioncount (@sections) { #check for more than one? NodeIds should be unique. my $numsections = @sections; print LOG "The number of sections returned is $numsections +\n\n\n"; if ($numsections gt 1) { die "Critical failure at section \n".$sectioncount->sp +rint."\nMore than one section found with id\n"; } print LOG " parent node is $sectioncount\n"; print $sectioncount->sprint; print "\n\n"; #now add the section my $section = ""; my $esec = new XML::Twig::Elt('section',$section); print LOG "Level is $level\n"; $esec->set_att('label',$label); $label =~ s/\s//g; $esec->set_att('urlDirName',$label); $esec->set_att('active',$active); $esec->set_att('dSecurityGroup',$secgrp); $esec->set_att('dDocAccount',$secacc); $esec->set_att('primaryUrl',$ptemp); $esec->set_att('secondaryUrl',$stemp); $esec->set_att('AltLabel',$altlabel); $esec->set_att('FragmentsOff',$fragsoff); $esec->set_att('ContentArchitectureNodeId',$canodeid); #th +is will need changing for real run $esec->set_att('FragmentsOffSiteLevel',$f2); $esec->set_att('ContentList_CriteriaMetaData',$clist1); $esec->set_att('ContentList_ResultCount',$clist2); $esec->set_att('ContentList_MaxGetSearchResultCount',$clis +t3); $esec->set_att('ContentList_RangeMetaDataField',$clist4); $esec->set_att('ContentList_RangeMin', $clist5); $esec->set_att('ContentList_RangeMax',$clist6); $esec->set_att('ContentList_ExtraCriteria',$clist7); $esec->set_att('ContentList_SortSpec',$clist8); $esec->set_att('csFragMaxDepth',$clist9); $esec->set_att('csFragStartNodeId',$clist10); $esec->set_att('ContentList_Title',$clist11); $esec->set_att('ContentList_ShowDetailsOff', $clist12); $esec->set_att('ContentList_OptionalDisplayField',$clist13 +); $esec->set_att('nodeId',$NodeId); $esec->paste('last_child', $sectioncount); print LOG "$esec\n"; $twig->flush; $twig->print; } } } $twig->print; #print out xml file open (OUT, "> $output"); $twig->set_pretty_print( 'nsgmls'); $twig->print(\*OUT); close OUT;
The csv file (which is the navigation model) is read into an array called @navmod.
The output is (as xml and apologies as this is long)
<?xml version="1.0" encoding="UTF-8"?> <project errorNodeId="949" format="1" siteId="Schoolsweb" siteLabel="Schoolsweb" siteType="idoc" xmlns="http://www.stellent.com/sitestudio/Project/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.stellent.com/sitestudio/Project/ http:/ +/www.stellent.com/sitestudio/ss_project_schema.xsd" ><section AdvSearchCategories="Archived information,Events,Classroom assessment, +Classroom resources,Forums and hotseats,General information,Good prac +tice and case studies,Lesson plans and planning aids,Management tools + and resources,National Strategies,News,Official guidance,Publication +s,Research,Schemes of Work,Statutory information" AdvSearchProviders="BECTA,ContinYou,DEFRA,Department for Work and Pens +ions,Department of Health,DfES,FCO,FENTO,Generation Europe,Governorne +t,GTCE,HM Treasury,IIP,Language Works,learning for life,Link Communit +y Development,LEA,MCA and RNLI,Music Manifesto,National Assessment Ag +ency,National Institute of Adult Continuing Education,NRT,NCSL,nerf,n +fer,NGFL,nhs,No creator,Office of Fair Trading,OFSTED,parentcentre,QC +A,Read On,Secretary of State,standardssite,teachernet,TTV,The Associa +tion of Jewish Sixthformers,TSO,TTA,ukonline" AdvSearchRoles="Adult learners,Bursars,Carers,Child related voluntary +sector,Children's health services,Corporation of FE Institutions,DfES +,Education and training professionals,Employers,Governors,HE Students +,Headteachers,Higher Education Institutions,Lead Member for Children' +s Services,LEAs,Lecturers,Local Authorites,Local Authorities,Local au +thorities and key statutory agencies,Local authority Directors of Chi +ldren's Services,Local authority partners,London Local Authorities,Lo +ndon Local Government,London Secondary Schools,Opinion formers in Lon +don,Parents,People who work with children,Primary headteachers,Primar +y School teachers of Key Stage 2 pupils,Primary teachers,Principals o +f FE Institutions,Proprietors of Independent Schools,Public,Pupils,Se +condary headteachers,Social workers,support staff,Teachers,Teachers f +or Looked After Children,Teaching assistants,Trainers,Training provid +ers,Voluntary Bodies,Young people,Youth Justice,Youth Service Provide +rs" AltLabel="Home" CSS_Screen="sw" ContentArchitectureNodeId="1" LinkBoxSize="3" MetadataDefault="35" NewsCategoryQueryDays="90" NewsFilterCategories="Teacher TV,test,BECTA,teachernet,nhs,DfES" NewsHeadlineQueryDays="60" NewsSearchCategories="Teachers TV,test" NewsSummaryCount="5" NumberOfYearsToSubtract="7" PopularQuestionsLatestMaxNumber="14" PopularQuestionsNumberPerPage="5" PopularQuestionsSummaryListSize="3" PopularQuestionsURL="1429" RssSubscriptionURL="1127" SearchAZURL="899" SearchHelpURL="1134" SearchJargonURL="903" SearchMoreOptionsURL="1462" SearchResultsURL="1107" TopicBoxListSize="15" active="TRUE" dSecurityGroup="Public" label="Schoolsweb" mostPopularListSize="10" mostPopularShowAllListSize="20" nodeId="1" primaryUrl="T01?region6=DFES001313&amp;region5=DFES001420&amp;region4= +DFES001411&amp;region3=DFES001413&amp;region2=Footer_Region&amp;regio +n1=HEADER_REGION" recentlyVisitedListSize="5" recentlyVisitedShowAllListSize="20" secondaryUrl="T02" secondaryUrlVariableField="region1" urlDirName="Schoolsweb" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Teaching and learning" nodeId="2" primaryUrl="T02" secondaryUrl="T02" urlDirName="Teachingandlearning" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Teaching the curriculum" nodeId="3" primaryUrl="T02" secondaryUrl="T02" urlDirName="Teachingthecurriculum" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Pedagogy and practice" nodeId="208" primaryUrl="T02" secondaryUrl="T02" urlDirName="Pedagogyandpractice" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Assessment and Achievement" nodeId="287" primaryUrl="T02" secondaryUrl="T02" urlDirName="AssessmentandAchievement" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Using ICT to support teaching and learning" nodeId="326" primaryUrl="T02" secondaryUrl="T02" urlDirName="UsingICTtosupportteachingandlearning" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Qualifications" nodeId="343" primaryUrl="T02" secondaryUrl="T02" urlDirName="Qualifications" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Ideas for teaching" nodeId="364" primaryUrl="T02" secondaryUrl="T02" urlDirName="Ideasforteaching" ></section></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Pupil support" nodeId="370" primaryUrl="T02" secondaryUrl="T02" urlDirName="Pupilsupport" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Behaviour and attendance " nodeId="371" primaryUrl="T02" secondaryUrl="T02" urlDirName="Behaviourandattendance" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Inclusion and learner support" nodeId="413" primaryUrl="T02" secondaryUrl="T02" urlDirName="Inclusionandlearnersupport" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Special Education Needs (SEN)" nodeId="466" primaryUrl="T02" secondaryUrl="T02" urlDirName="SpecialEducationNeeds(SEN)" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Extended services" nodeId="533" primaryUrl="T02" secondaryUrl="T02" urlDirName="Extendedservices" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Parents and carers" nodeId="541" primaryUrl="T02" secondaryUrl="T02" urlDirName="Parentsandcarers" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Community and support services" nodeId="551" primaryUrl="T02" secondaryUrl="T02" urlDirName="Communityandsupportservices" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Transfer and transition" nodeId="561" primaryUrl="T02" secondaryUrl="T02" urlDirName="Transferandtransition" ></section></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Careers and Employment" nodeId="578" primaryUrl="T02" secondaryUrl="T02" urlDirName="CareersandEmployment" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Pay and Pensions" nodeId="579" primaryUrl="T02" secondaryUrl="T02" urlDirName="PayandPensions" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Training and development" nodeId="621" primaryUrl="T02" secondaryUrl="T02" urlDirName="Traininganddevelopment" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Entering teaching" nodeId="651" primaryUrl="T02" secondaryUrl="T02" urlDirName="Enteringteaching" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Career opportunities" nodeId="659" primaryUrl="T02" secondaryUrl="T02" urlDirName="Careeropportunities" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Disciplinary procedures and grievances" nodeId="668" primaryUrl="T02" secondaryUrl="T02" urlDirName="Disciplinaryproceduresandgrievances" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Unions and associations " nodeId="675" primaryUrl="T02" secondaryUrl="T02" urlDirName="Unionsandassociations" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Employers obligations " nodeId="679" primaryUrl="T02" secondaryUrl="T02" urlDirName="Employersobligations" ></section></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Administration and finance" nodeId="704" primaryUrl="T02" secondaryUrl="T02" urlDirName="Administrationandfinance" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="School administration" nodeId="705" primaryUrl="T02" secondaryUrl="T02" urlDirName="Schooladministration" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="School expenditure" nodeId="728" primaryUrl="T02" secondaryUrl="T02" urlDirName="Schoolexpenditure" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Building and assets " nodeId="739" primaryUrl="T02" secondaryUrl="T02" urlDirName="Buildingandassets" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Administrative aspects of recruitment " nodeId="747" primaryUrl="T02" secondaryUrl="T02" urlDirName="Administrativeaspectsofrecruitment" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Schools recurrent funding" nodeId="752" primaryUrl="T02" secondaryUrl="T02" urlDirName="Schoolsrecurrentfunding" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Health and safety " nodeId="765" primaryUrl="T02" secondaryUrl="T02" urlDirName="Healthandsafety" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Resource management and logistics" nodeId="777" primaryUrl="T02" secondaryUrl="T02" urlDirName="Resourcemanagementandlogistics" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Schools financial management" nodeId="780" primaryUrl="T02" secondaryUrl="T02" urlDirName="Schoolsfinancialmanagement" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Emergency planning " nodeId="789" primaryUrl="T02" secondaryUrl="T02" urlDirName="Emergencyplanning" ></section></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Leadership and governance" nodeId="810" primaryUrl="T02" secondaryUrl="T02" urlDirName="Leadershipandgovernance" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Managing and leading staff" nodeId="811" primaryUrl="T02" secondaryUrl="T02" urlDirName="Managingandleadingstaff" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Managing teaching and learning" nodeId="866" primaryUrl="T02" secondaryUrl="T02" urlDirName="Managingteachingandlearning" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Governance" nodeId="918" primaryUrl="T02" secondaryUrl="T02" urlDirName="Governance" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Local authorites and agencies" nodeId="932" primaryUrl="T02" secondaryUrl="T02" urlDirName="Localauthoritesandagencies" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Strategic funding and income " nodeId="968" primaryUrl="T02" secondaryUrl="T02" urlDirName="Strategicfundingandincome" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="School Performance and Improvement" nodeId="989" primaryUrl="T02" secondaryUrl="T02" urlDirName="SchoolPerformanceandImprovement" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Government policy and strategies" nodeId="1024" primaryUrl="T02" secondaryUrl="T02" urlDirName="Governmentpolicyandstrategies" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Partnerships and collaborative networks" nodeId="1025" primaryUrl="T02" secondaryUrl="T02" urlDirName="Partnershipsandcollaborativenetworks" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="School ethos" nodeId="1040" primaryUrl="T02" secondaryUrl="T02" urlDirName="Schoolethos" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Types of schools" nodeId="1052" primaryUrl="T02" secondaryUrl="T02" urlDirName="Typesofschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Academies" nodeId="1053" primaryUrl="T02" secondaryUrl="T02" urlDirName="Academies" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Specialist schools" nodeId="1061" primaryUrl="T02" secondaryUrl="T02" urlDirName="Specialistschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Training schools" nodeId="1067" primaryUrl="T02" secondaryUrl="T02" urlDirName="Trainingschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Trust schools" nodeId="1072" primaryUrl="T02" secondaryUrl="T02" urlDirName="Trustschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Special schools" nodeId="1073" primaryUrl="T02" secondaryUrl="T02" urlDirName="Specialschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="LA maintained schools" nodeId="1074" primaryUrl="T02" secondaryUrl="T02" urlDirName="LAmaintainedschools" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Independent schools" nodeId="1075" primaryUrl="T02" secondaryUrl="T02" urlDirName="Independentschools" ></section></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Tools and Initiatives" nodeId="1076" primaryUrl="T02" secondaryUrl="T02" urlDirName="ToolsandInitiatives" ><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Research" nodeId="1077" primaryUrl="T02" secondaryUrl="T02" urlDirName="Research" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Initiatives" nodeId="1080" primaryUrl="T02" secondaryUrl="T02" urlDirName="Initiatives" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Tools and applications" nodeId="1085" primaryUrl="T02" secondaryUrl="T02" urlDirName="Toolsandapplications" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Community" nodeId="1091" primaryUrl="T02" secondaryUrl="T02" urlDirName="Community" ></section><section AltLabel="0" ContentArchitectureNodeId="0" ContentList_CriteriaMetaData="xWebsiteSection" ContentList_ExtraCriteria="0" ContentList_MaxGetSearchResultCount="100" ContentList_OptionalDisplayField="0" ContentList_RangeMax="0" ContentList_RangeMetaDataField="0" ContentList_RangeMin="0" ContentList_ResultCount="100" ContentList_ShowDetailsOff="0" ContentList_SortSpec="0" ContentList_Title="0" FragmentsOff="F036" FragmentsOffSiteLevel="0" active="TRUE" csFragMaxDepth="0" csFragStartNodeId="0" dDocAccount="DfES" dSecurityGroup="Public" label="Educational media" nodeId="1095" primaryUrl="T02" secondaryUrl="T02" urlDirName="Educationalmedia" ></section></section></section></project>
What has happened is that all children with a parentNodeId of either "1" or "2" have been created successfully and properly, but ALL other children have been ignored. I have stepped through a run (in debugger)and the line
my @sections = $twig->get_xpath('section[@nodeId = "'.$ParentNodeId.'" +]');
in the $ParentNodeId gt "1" clause returns a section if the nodeId = "1" or "2", but for any other value (both in the run and done interactively to try and force it) returns nothing.
As far as I can tell other nodeIds exist (as can be seen in the xml) but they are not being found.
Any ideas/help most gratefully received.
All the best
Stevee

Replies are listed 'Best First'.
Re: Need help with XML::Twig, something strange is happening!!
by rhesa (Vicar) on Mar 28, 2007 at 13:55 UTC
    Consider using the numerical comparison operators. You're dealing with numbers, so you shouldn't compare them as strings.

    Try if ($ParentNodeId > 1) { instead of if ($ParentNodeId gt 1) {. Replace eq with ==.

      Rhesa Thanks for the helpful suggestions. Replacing the operator has made no difference though I can see where you are coming from. The problem really lies in the XPATH statement.
      The other suggestion to use a hash is really good and I will look at that because, if nothing else, it saves typing!
      Thanks again.

      Stevee
Re: Need help with XML::Twig, something strange is happening!!
by GrandFather (Saint) on Mar 28, 2007 at 21:50 UTC

    Old advice, often given, ignored at the cost of lots of wasted time: Use strictures (use strict; use warnings;).

    If you are using strictures note that the loop variable ($line in foreach $line (@navmod)) is not the same variable outside the loop - it gets aliased to each element that is iterated over. foreach my $line (@navmod) is a strong hint that you understand that.


    DWIM is Perl's answer to Gödel
      Thanks for the advice Grandfather.

      I have fixed the problem which stemmed from my incomplete understanding of XPATH syntax, a little matter of a missing "//" from one line of the code.

      Stevee
Re: Need help with XML::Twig, something strange is happening!!
by Jenda (Abbot) on Mar 31, 2007 at 21:55 UTC

    Maybe you should step away and rethink your algorithm. Maybe it would be better to create the tree structure of sections first and then export that as XML. As your read the sections from the CSV you can keep a hash (or array if the nodeIds are positive integers and are not too sparse) of references to the individual sections and add the children easily. Without having to search for them using XPath or any other advanced thing:

    my @columns = qw(parentNodeId nodeId level canode label); my $CSV = <<'*END*'; 0,1,0,blah,bloh 1,2,1,foo,faaa 1,3,1,bar,barrar 2,4,2,baz,bazbaz 2,5,2,aaa,aaaaa 3,6,2,bbb,bbbbbbab 4,7,3,zzz,zzzzz *END* my (%sections, $root); my @navmod = split /\n/, $CSV; foreach my $line (@navmod) { my %current; @current{@columns} = split /,/, $line; delete $current{level}; my $nodeId = $current{nodeId}; $sections{$nodeId} = \%current; my $parentNodeId = delete $current{parentNodeId}; if ($parentNodeId) { push @{$sections{$parentNodeId}{section}}, \%current; } else { $root = \%current; } } use XML::Rules; my $parser = XML::Rules->new( rules => []); print $parser->ToXML(section => $root, 0, ' ');
    And if your CSV is already sorted enough so that no node is referenced sooner than it's defined you do not have to read the whole CSV into an array and sort it more, but may read it line by line and build the tree.

    It's actually fairly easy to tweak the code to work even if sections do get referenced before they are defined:

    my @columns = qw(parentNodeId nodeId level canode label); my (%sections, $root); while (my $line = <DATA>) { chomp($line); my %current; @current{@columns} = split /,/, $line; delete $current{level}; my $nodeId = $current{nodeId}; my $parentNodeId = delete $current{parentNodeId}; if ($sections{$nodeId}) { %{$sections{$nodeId}} = ( %current, %{$sections{$nodeId}}); } else { $sections{$nodeId} = \%current; } if ($parentNodeId) { push @{$sections{$parentNodeId}{section}}, $sections{$nodeId}; } else { $root = $sections{$nodeId}; } } use XML::Rules; my $parser = XML::Rules->new( rules => []); print $parser->ToXML(section => $root, 0, ' '); __DATA__ 3,6,2,bbb,bbbbbbab 1,2,1,foo,faaa 2,4,2,baz,bazbaz 2,5,2,aaa,aaaaa 1,3,1,bar,barrar 4,7,3,zzz,zzzzz 0,1,0,blah,bloh

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://607020]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-07-01 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (102 votes). Check out past polls.

    Notices?