Jump to content

mark110384

Members
  • Posts

    171
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Newcastle

mark110384's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. I am working on developing an application that will take 2 xml files and merge into 1. At present I can generate an xml file but it is not formated the way that I want, and I have hit a brick wall at the moment, any help will be greatly appreciated. The application reads 2 xml files and then goes through each staff member record from one of the xml files. For each staff member record it looks for the corresponding record in the second xml and once it has been discovered it generates a series of new nodes and populates it with the information from the second xml file. I would like to place these new nodes in the the relating staff record at a specific point (at present it just dumps them all at the bottom of the xml document) The PHP <?php $schoolExtract = new DOMDocument; $schoolExtract->load('schoolExtract.xml'); $kcsExtract = new DOMDocument; $kcsExtract->preserveWhiteSpace = false; $kcsExtract->load('kcsFinalExtract.xml'); $xp = new DOMXPath($kcsExtract); header("Content-Type: text/plain"); $kcsUserRecord = $kcsExtract->getElementsByTagName( "StaffDetails" ); $schoolRecord = $schoolExtract->getElementsByTagName( "StaffDetails" ); $schoolRecordCount = $schoolExtract->getElementsByTagName( "SchoolWorkforceMember" ); $noRecords = $schoolRecordCount->length; set_time_limit(0); $i = 0; foreach($schoolRecord as $row2) { $foundRecord = 0; $NationalInsuranceSE = $row2->getElementsByTagName("NINumber")->item(0)->nodeValue; $StaffMemberNameSE = $row2->getElementsByTagName("PersonFamilyName")->item(0)->nodeValue; $PersonGivenNameSE = $row2->getElementsByTagName("PersonGivenName")->item(0)->nodeValue; $DOBSE = $row2->getElementsByTagName("PersonBirthDate")->item(0)->nodeValue; $newDOBSE = date("d/m/Y", strtotime($DOBSE)); foreach($kcsUserRecord as $row4) { $NationalInsuranceKCS = $row4->getElementsByTagName("NationalInsurance")->item(0)->nodeValue; $StaffMemberNameKCS = $row4->getElementsByTagName("StaffMemberName")->item(0)->nodeValue; $DOBKCS = $row4->getElementsByTagName("PersonBirthDate")->item(0)->nodeValue; if($NationalInsuranceSE == $NationalInsuranceKCS && $StaffMemberNameSE == $StaffMemberNameKCS){ $foundRecord = 1; $xpQuery = $xp->query('/KCSExtract/StaffRecord[staffDetails/NationalInsurance="'. $NationalInsuranceKCS . '"]'); foreach ($xpQuery as $item) { $newItem = $schoolExtract->documentElement->appendChild( $schoolExtract->createElement('ContractOrServiceGroup') ); foreach (array('ContractType', 'ContractStart', 'ContractEnd','Post', 'SchoolArrivalDate', 'DestinationCode', 'Origin', 'LASchoolLevel', 'Estab', 'PostLevelDetails', 'Roles') as $elementName) { $newItem->appendChild( $schoolExtract->importNode( $item->getElementsByTagName($elementName)->item(0), true ) ); } } $i++; } } if($foundRecord == 1){ /*No Handlers in place yet*/ } else if($foundRecord == 0){ /*No Handlers in place yet*/ } } $schoolExtract->formatOutput = true; echo $schoolExtract->saveXml(); ?> schoolExtract.xml <Members> <SchoolWorkforceMembers> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Wayne</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Bruce</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>BW123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Parker</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Peter</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>SM123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> </SchoolWorkforceMembers> </Members> kcsFinalExtract.xml <KCSExtract> <StaffRecord> <StaffDetails> <NationalInsurance>BW123456</NationalInsurance> <PersonBirthDate>1974-08-07</PersonBirthDate> <StaffMemberName>Wayne</StaffMemberName> <PersonGivenName>Bruce</PersonGivenName> </StaffDetails> <ContractOrServiceGroup> <ContractOrService> <ContractType>PRM</ContractType> <ContractStart>01/09/2003</ContractStart> <ContractEnd></ContractEnd> <Post>TCH</Post> <SchoolArrivalDate>01/12/2007</SchoolArrivalDate> <DestinationCode>TU</DestinationCode> <Origin>NOTKNW</Origin> <LASchoolLevel></LASchoolLevel> <Estab></Estab> <PostLevelDetails> <Payments> <Scale>TU</Scale> <RegionSpine>EW</RegionSpine> <SpinePoint>U2</SpinePoint> <TotalPay>35,447.00</TotalPay> <SafeguardedSalary>FALSE</SafeguardedSalary> </Payments> <Hours> <Hours>32.5</Hours> <FTEHours>32.5</FTEHours> <WeeksPerYear>52</WeeksPerYear> </Hours> </PostLevelDetails> <Roles> <Role> <RoleIdentifier>TCHR</RoleIdentifier> </Role> </Roles> </ContractOrService> </ContractOrServiceGroup> </StaffRecord> <StaffRecord> <StaffDetails> <NationalInsurance>SM123456</NationalInsurance> <PersonBirthDate>03/01/1971</PersonBirthDate> <StaffMemberName>Parker</StaffMemberName> <PersonGivenName>Peter</PersonGivenName> </StaffDetails> <ContractOrServiceGroup> <ContractOrService> <ContractType>PRM</ContractType> <ContractStart>01/09/2003</ContractStart> <ContractEnd></ContractEnd> <Post>TCH</Post> <SchoolArrivalDate>01/12/2007</SchoolArrivalDate> <DestinationCode>TU</DestinationCode> <Origin>NOTKNW</Origin> <LASchoolLevel></LASchoolLevel> <Estab></Estab> <PostLevelDetails> <Payments> <Scale>TU</Scale> <RegionSpine>EW</RegionSpine> <SpinePoint>U2</SpinePoint> <TotalPay>35,447.00</TotalPay> <SafeguardedSalary>FALSE</SafeguardedSalary> </Payments> <Hours> <Hours>32.5</Hours> <FTEHours>32.5</FTEHours> <WeeksPerYear>52</WeeksPerYear> </Hours> </PostLevelDetails> <Roles> <Role> <RoleIdentifier>TCHR</RoleIdentifier> </Role> </Roles> </ContractOrService> </ContractOrServiceGroup> </StaffRecord> </KCSExtract> Generated Output <?xml version="1.0"?> <Members> <SchoolWorkforceMembers> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Wayne</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Bruce</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>BW123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Parker</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Peter</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>SM123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> </SchoolWorkforceMembers> <ContractOrServiceGroup><ContractType>PRM</ContractType><ContractStart>01/09/2003</ContractStart><ContractEnd/><Post>TCH</Post><SchoolArrivalDate>01/12/2007</SchoolArrivalDate><DestinationCode>TU</DestinationCode><Origin>NOTKNW</Origin><LASchoolLevel/><Estab/><PostLevelDetails><Payments><Scale>TU</Scale><RegionSpine>EW</RegionSpine><SpinePoint>U2</SpinePoint><TotalPay>35,447.00</TotalPay><SafeguardedSalary>FALSE</SafeguardedSalary></Payments><Hours><Hours>32.5</Hours><FTEHours>32.5</FTEHours><WeeksPerYear>52</WeeksPerYear></Hours></PostLevelDetails><Roles><Role><RoleIdentifier>TCHR</RoleIdentifier></Role></Roles></ContractOrServiceGroup><ContractOrServiceGroup><ContractType>PRM</ContractType><ContractStart>01/09/2003</ContractStart><ContractEnd/><Post>TCH</Post><SchoolArrivalDate>01/12/2007</SchoolArrivalDate><DestinationCode>TU</DestinationCode><Origin>NOTKNW</Origin><LASchoolLevel/><Estab/><PostLevelDetails><Payments><Scale>TU</Scale><RegionSpine>EW</RegionSpine><SpinePoint>U2</SpinePoint><TotalPay>35,447.00</TotalPay><SafeguardedSalary>FALSE</SafeguardedSalary></Payments><Hours><Hours>32.5</Hours><FTEHours>32.5</FTEHours><WeeksPerYear>52</WeeksPerYear></Hours></PostLevelDetails><Roles><Role><RoleIdentifier>TCHR</RoleIdentifier></Role></Roles></ContractOrServiceGroup></Members> Desired output <Members> <SchoolWorkforceMembers> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Wayne</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Bruce</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>BW123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <ContractOrServiceGroup> <ContractOrService> <ContractType>PRM</ContractType> <ContractStart>01/09/2003</ContractStart> <ContractEnd></ContractEnd> <Post>TCH</Post> <SchoolArrivalDate>01/12/2007</SchoolArrivalDate> <DestinationCode>TU</DestinationCode> <Origin>NOTKNW</Origin> <LASchoolLevel></LASchoolLevel> <Estab></Estab> <PostLevelDetails> <Payments> <Scale>TU</Scale> <RegionSpine>EW</RegionSpine> <SpinePoint>U2</SpinePoint> <TotalPay>35,447.00</TotalPay> <SafeguardedSalary>FALSE</SafeguardedSalary> </Payments> <Hours> <Hours>32.5</Hours> <FTEHours>32.5</FTEHours> <WeeksPerYear>52</WeeksPerYear> </Hours> </PostLevelDetails> <Roles> <Role> <RoleIdentifier>TCHR</RoleIdentifier> </Role> </Roles> </ContractOrService> </ContractOrServiceGroup> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> <SchoolWorkforceMember> <StaffDetails> <TeacherNumber>123456</TeacherNumber> <StaffMemberName> <PersonFamilyName>Parker</PersonFamilyName> <GivenNames> <GivenName> <PersonGivenName>Peter</PersonGivenName> </GivenName> </GivenNames> </StaffMemberName> <NINumber>SM123456</NINumber> <GenderCurrent>2</GenderCurrent> <PersonBirthDate>1974-08-07</PersonBirthDate> <Ethnicity>WBRI</Ethnicity> <Disability>NOBT</Disability> <QTStatus>true</QTStatus> <HLTAStatus>false</HLTAStatus> </StaffDetails> <ContractOrServiceGroup> <ContractOrService> <ContractType>PRM</ContractType> <ContractStart>01/09/2003</ContractStart> <ContractEnd></ContractEnd> <Post>TCH</Post> <SchoolArrivalDate>01/12/2007</SchoolArrivalDate> <DestinationCode>TU</DestinationCode> <Origin>NOTKNW</Origin> <LASchoolLevel></LASchoolLevel> <Estab></Estab> <PostLevelDetails> <Payments> <Scale>TU</Scale> <RegionSpine>EW</RegionSpine> <SpinePoint>U2</SpinePoint> <TotalPay>35,447.00</TotalPay> <SafeguardedSalary>FALSE</SafeguardedSalary> </Payments> <Hours> <Hours>32.5</Hours> <FTEHours>32.5</FTEHours> <WeeksPerYear>52</WeeksPerYear> </Hours> </PostLevelDetails> <Roles> <Role> <RoleIdentifier>TCHR</RoleIdentifier> </Role> </Roles> </ContractOrService> </ContractOrServiceGroup> <Absences> <Absence> <FirstDayOfAbsence>2011-09-05</FirstDayOfAbsence> <LastDayOfAbsence>2011-10-30</LastDayOfAbsence> <WorkingDaysLost>033.0</WorkingDaysLost> <AbsenceCategory>SIC</AbsenceCategory> <Estab>6905</Estab> </Absence> <Absence> <FirstDayOfAbsence>2012-01-17</FirstDayOfAbsence> <LastDayOfAbsence>2012-01-17</LastDayOfAbsence> <AbsenceCategory>OTH</AbsenceCategory> <Estab>6905</Estab> </Absence> </Absences> </SchoolWorkforceMember> </SchoolWorkforceMembers> </Members> Any help will be greatly appreciated.
  2. Hello all, is the following possible, I have a flash movie (A jotter that users can scribble on), a user will then select a button which calls to a JS Function that captures the swf as an image or cache to memory so it can be recalled at a later point? Any help will be greatly appreciated.
  3. Hey guys, I am currently experiencing an issue with FLV auto rewind. The issue is that I get the following compiler error. 1046: Type was not found or was not a compile-time constant: VideoEvent. The coding is as follows var tut_video:Video = new Video(); addChild(tut_video); function ns_onMetaData(item:Object):void { // Resize video instance. tut_video.width = 257.4; tut_video.height = 171.7; // Position video instance on stage tut_video.x = 274.9; tut_video.y = 105.5; } var movie_url = "../movies/Courage.flv"; var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); ns.client = { onMetaData:ns_onMetaData }; tut_video.attachNetStream(ns); ns.play(movie_url); /* If un-quoted the flv will not run! function playAgain(eventObject:VideoEvent):void { ns.autoRewind = true; ns.autoPlay(); } ns.addEventListener(VideoEvent.COMPLETE, playAgain); */ I also tried adding import fl.video.VideoEvent; but to no avail it failed to work. Any suggestions would appreciated. Thanks in advance
  4. Typo in the title, doh. Thats suppose to be provide* my apologies
  5. Please could you provide a critique for this website that I developed. I was looking for a clean and tidy look to it, which is easy to get around. The URL is http://www.lilleyandgillie.co.uk/landg/home/home.php Thanks
  6. Maq, what browser (version) and OS are you using? Thanks
  7. Please could you provide me with some construct comments and critism for this site that I have developed, the URL at the moment is http://www.lilleyandgillie.co.uk/2009/new_dpm/home/home.html I have to keep the design clean and the navigation simple. Thanks
  8. Sorry it's w3c schools the link is http://www.w3schools.com/cert/default.asp , does it hold any weight in boosting you development profile. Or is there something similar that could be useful? Thanks
  9. Hey guys, Not really a technical question I'm just looking for advice. I'm thinking on taking a PHP w3c certified exam, I'm just wondering if it is really worth doing, will it really boost my profile as a web developer or be a complete and utter waste of money? Thanks
  10. Excellent that works exactly how I wanted to do thanks guys. This is what I've got now $t=0; $post_no = 2; while ($t < $lastpage){ if ($pageno == $t){ $no_post = (($pageno-1) * 14 + 2); } else if ($pageno == 1){ $no_post = 2; } $t++; }
  11. Hmmm that works somewhat Kickstart altough the 1 pages starts at 16 because it completes the first loop and adds it on the end.
  12. Hey guys I'm having a problem with following loop, it essentially adds number to post replies with regard to the page number (using pagation) this is the code that I've got so far. $pageno = $_GET['pagenum']; $t=0; $post_no = 2; while ($t < $lastpage) { if ($pageno == $t){ $no_post = $post_no; } $post_no + 14; $t++; } this is what I want it to, but put it in a loop form if ($pageno == 1){ $no_post = 2; } else if ($pageno == 2){ $no_post = 16; } else if ($pageno == 3){ $no_post = 30; } else if ($pageno == 4){ $no_post = 44; } else if ($pageno == 5){ $no_post = 58; } and so on Thanks
  13. Unfortunately the website isn't is live yet the JS Function that the button calls is the following function add_quote(message, id){ var msg = message; var q_id = id; document.getElementById("reply_txtbox").value = "<QUOTE>" + msg + "</QUOTE>"; document.getElementById("hidden_q_number").value = q_id; } It's quite puzzling as I don't see any errors in that either. FF isn't detecting an error but IE is?
  14. Thants for quotation tip, an example of the output that is being effected is <table style="background-image: url(../images/quote_btn.PNG); background-repeat: no-repeat" border="0" width="62px" cellpadding="3" cellspacing="0" onClick="javascript: add_quote('Another Test','262');" onMouseOver="this.style.cursor = 'pointer';"> The coding is for a button when you select it takes the $reply_Msg and using JS pops it into a textarea and the $ID_Reply into a hidden text area. It only seems to happen with pages that have a quotation table included (Users can add quoted replies). The following is the quotation table with the buttons. <br> <table border = "0" width="80%" align="center" style="border: 1px solid #555555" bgcolor = "#EEEEEE"> <tr> <td width="40px" style= "border-left: 10px solid #cccccc" rowspan = "2" valign="top"><img src="../images/quote_open.png" alt=""></td> <td class="smalltxt"><b>QUOTE</b> (<? echo $quote_Author;?> @ <? echo $quote_Date;?>) </td> <td rowspan="2" width="40px" valign="bottom"><img src="../images/quote_close.png" alt=""></td> </tr> <tr> <td class="normaltxt"><? echo $quote_Msg; ?> </td> </tr> </table> <br> <? } echo $reply_Msg; ?> </td> </tr> <tr bgcolor="#CCCCCC"> <td colspan="2" style="border-top: solid 1px #AAA" align="right"> <? if(isset($name)){ $onlcick_event = "javascript: add_quote('" . $reply_Msg . "','" . $ID_Reply . "');"; } else{ $onlcick_event ="window.location = '../forum_files/loginfrontend.php'"; } ?> <table style="background-image: url(../images/quote_btn.PNG); background-repeat: no-repeat" border="0" width="62px" cellpadding="3" cellspacing="0" onClick="<?php echo $onlcick_event; ?>" onMouseOver="this.style.cursor = 'pointer';"> <tr> <td width="10px"> </td> <td valign="top" class="button_txt">QUOTE</td> </tr> </table> </td> <td align="right" style="border-top: solid 1px #AAA"> <table style="background-image: url(../images/reply_btn.PNG); background-repeat: no-repeat" border="0" width="62px" cellpadding="3" cellspacing="0" onClick="window.location = '<? echo "$link_status"; ?> ';" onMouseOver="this.style.cursor = 'pointer';"> <tr> <td width="13px"> </td> <td valign="top" class="button_txt">REPLY</td> </tr> </table></td> </tr> </table> <?
  15. Could anyone tell me why I've getting an error with the following coding? It works but I get an error in IE, "Undetermined string constant". the coding is onClick="javascript: add_quote('<? echo "$reply_Msg"; ?>','<? echo "$ID_Reply"; ?>');" Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.