Hi,
This may not be the correct forum but if you could point me in the right direction it would be much appreciated. I am trying to import a number of rather complicated XML file into SQL Server 2000 using VB in an ActiveX script executed through a DTS pack, but my knowlede of xml is limited and my VB isn't brilliant hence using some code that I found, I have had to do it this way due to the files being so large.
I only want the data from the transformedXML tag at the bottom, you can see some of the fields that I want referenced in the VB script
When the script is run, it ends successfully, though there is nothing in the table.
Any idea????
My Xml file is listed below
<?xml version="1.0"?>
<Inspection xmlns:xsd=" xmlns:xsi=" <FileName>S:\Schools data\MEG\280480.XML</FileName>
<InstitutionType>School</InstitutionType>
<InstitutionName>West Street</InstitutionName>
<InstitutionNumber>119174</InstitutionNumber>
<InspectionNumber>280480</InspectionNumber>
<Date>31/10/2005</Date>
<IndependentSchool>false</IndependentSchool>
<InspectionType>S5</InspectionType>
<Inspectors>
<OIN>29504</OIN>
<Name>Shirley</Name>
<LeadInspector>true</LeadInspector>
<AssistantInspector>false</AssistantInspector>
</Inspectors>
<Inspectors>
<OIN>18146</OIN>
<Name>Michael</Name>
<LeadInspector>false</LeadInspector>
<AssistantInspector>true</AssistantInspector>
</Inspectors>
<SchoolEfs>
<InspectorOin>18146 - Michael</InspectorOin>
<ObservationTime>30</ObservationTime>
<EfType>L</EfType>
<YearGroups>1</YearGroups>
<YearGroups />
<YearGroups />
<YearGroups />
<GroupingAbility>MC</GroupingAbility>
<GroupingGender>MI</GroupingGender>
<Present>18</Present>
<Nor>20</Nor>
<SubjectCode1>MA</SubjectCode1>
<SubjectCode2>NY</SubjectCode2>
<SenSupportCount>0</SenSupportCount>
<SenAssistantCount>1</SenAssistantCount>
<EalSupportCount>1</EalSupportCount>
<EalAssistantCount>0</EalAssistantCount>
<OthSupportCount>0</OthSupportCount>
<OthAssistantCount>1</OthAssistantCount>
<InspInitialWithEf>MO03</InspInitialWithEf>
<Focus />
<Context />
<Evaluation />
<Summary />
<Overall>2</Overall>
<Standards>3</Standards>
<Progress>2</Progress>
<PersonalDev>0</PersonalDev>
<Teaching>2</Teaching>
<Curriculum>2</Curriculum>
<Care>2</Care>
<Leadership>0</Leadership>
<CsiEval />
</SchoolEfs>
<SchoolEfs>
REPEATS AS ABOVE (A FEW OF THESE TAGS)
</SchoolEfs>
<SchoolKsYg xsi:type="xsd:string">Key Stage F</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Key Stage 1</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Key Stage 2</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group N</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group R</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 1</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 2</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 3</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 4</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 5</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 6</SchoolKsYg>
<InspectionReport>
<TransformedXml><?xml version="1.0" encoding="utf-16"?>
<InspectionReport xmlns=" xmlns:apd=" xmlns:core=" xmlnsdt=" <InspectionKeyData>
<InspectionNumber>280480</InspectionNumber>
<InspectionBeginningDate>2005-10-31</InspectionBeginningDate>
<InspectionEndDate>2005-11-01</InspectionEndDate>
<ReportingInspector>
<InspectorName>Shirley Herring</InspectorName>
<InspectorStatus />
</ReportingInspector>
<InspectionCategory />
<DateOfPreviousInspection>1900-01-01</DateOfPreviousInspection>
</InspectionKeyData>
<InspectionSetting>
<SettingName>West Street</SettingName>
<SettingAddress>
<apd:Line>West Street</apd:Line>
<apd:Line>C</apd:Line>
<apd:Line>Lanc</apd:Line>
<apd:Line>BBW</apd:Line>
</SettingAddress>
<TelephoneNumber>01282</TelephoneNumber>
<FaxNumber>01282</FaxNumber>
<School>
<UniqueReferenceNumber>119174</UniqueReferenceNumber>
<LEAName>Lan</LEAName>
<TypeOfSchool>primary</TypeOfSchool>
<SchoolCategory>community</SchoolCategory>
<PupilLowAge>3</PupilLowAge>
<PupilHighAge>11</PupilHighAge>
<PupilGender>mixed</PupilGender>
<NumberOnRoll>190</NumberOnRoll>
<AppropriateAuthority>The governing body</AppropriateAuthority>
<ChairOfGovernors>Ann</ChairOfGovernors>
<Headteacher>Mr Ron Peden</Headteacher>
</School>
</InspectionSetting>
<InspectionJudgements>
<JudgeOverallEffectiveness>
<MeetingNeeds>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</MeetingNeeds>
<PartnershipWorking>
<SchoolGrade>1</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</PartnershipWorking>
<QualityFoundation>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</QualityFoundation>
<SelfEvaluation>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SelfEvaluation>
<ImprovementCapacity>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</ImprovementCapacity>
<EffectiveSteps>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</EffectiveSteps>
</JudgeOverallEffectiveness>
<JudgeAchievementAndStandards>
<LearnersAchieve>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</LearnersAchieve>
<StandardsReached>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</StandardsReached>
<ProgressMade>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</ProgressMade>
<DifficultyDisability>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</DifficultyDisability>
</JudgeAchievementAndStandards>
<JudgePersonalDevelopment>
<OverallPersonal>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</OverallPersonal>
<SpiritualCultural>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SpiritualCultural>
<Behaviour>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Behaviour>
<Attendance>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Attendance>
<Enjoyment>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Enjoyment>
<SafePractice>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SafePractice>
<HealthyLifestyle>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</HealthyLifestyle>
<PositiveContribution>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</PositiveContribution>
<WorkplaceEconomic>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</WorkplaceEconomic>
</JudgePersonalDevelopment>
<JudgeQualityOfProvision>
<EffectiveFullRange>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EffectiveFullRange>
<CurriculumNeedsInterests>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</CurriculumNeedsInterests>
<CareGuidance>
<SchoolGrade>1</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</CareGuidance>
</JudgeQualityOfProvision>
<JudgeLeadershipAndManagement>
<RaisingSupporting>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</RaisingSupporting>
<DirectionQuality>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</DirectionQuality>
<MonitorReview>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</MonitorReview>
<EqualityDiscrimination>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EqualityDiscrimination>
<EffectivenessEfficiency>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EffectivenessEfficiency>
<GovernorsSupervision>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</GovernorsSupervision>
<AdequacySuitability>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</AdequacySuitability>
</JudgeLeadershipAndManagement>
<JudgeHealth>
<EatDrink>
<SchoolYesNo>yes</SchoolYesNo>
</EatDrink>
<Exercise>
<SchoolYesNo>yes</SchoolYesNo>
</Exercise>
<DiscourageAbuse>
<SchoolYesNo>yes</SchoolYesNo>
</DiscourageAbuse>
<SexualHealth>
<SchoolYesNo>yes</SchoolYesNo>
</SexualHealth>
</JudgeHealth>
<JudgeSafety>
<GovernmentRequirements>
<SchoolYesNo>yes</SchoolYesNo>
</GovernmentRequirements>
<RiskAssessment>
<SchoolYesNo>yes</SchoolYesNo>
</RiskAssessment>
<ReduceAntiSocial>
<SchoolYesNo>yes</SchoolYesNo>
</ReduceAntiSocial>
<AvoidKeyRisks>
<SchoolYesNo>yes</SchoolYesNo>
</AvoidKeyRisks>
</JudgeSafety>
<JudgePositive>
<Relationships>
<SchoolYesNo>yes</SchoolYesNo>
</Relationships>
<DecisionParticipate>
<SchoolYesNo>yes</SchoolYesNo>
</DecisionParticipate>
<ActivityCommunity>
<SchoolYesNo>yes</SchoolYesNo>
</ActivityCommunity>
</JudgePositive>
<JudgeEconomic>
<BasicSkills>
<SchoolYesNo>yes</SchoolYesNo>
</BasicSkills>
<Enterprise>
<SchoolYesNo>yes</SchoolYesNo>
</Enterprise>
<CareersGuidance>
<SchoolYesNo>key stage not present</SchoolYesNo>
</CareersGuidance>
<EmploymentEconomy>
<SchoolYesNo>key stage not present</SchoolYesNo>
</EmploymentEconomy>
</JudgeEconomic>
<SpecialMeasures>
<SchoolYesNo>no</SchoolYesNo>
</SpecialMeasures>
<NoticeImprove>
<SchoolYesNo>no</SchoolYesNo>
</NoticeImprove>
</InspectionJudgements>
</InspectionReport></TransformedXml>
<ImportedFileDetails>Filename: F:\doc
File date/time: 11 November 2005 15:49:38
Import date: 11 November 2005 15:54:26</ImportedFileDetails>
</InspectionReport>
</Inspection>
Function Main()
Dim objFSO
Dim objFolder
Dim objFilesColl
Dim iFilesCount
Dim objFile
Dim objXMLDOM
Dim objNodes
Dim objNodeItem
Dim objADORS
Dim objADOCnn
Dim strCurFileName
'Create and initialize (Open) ADO Connection
Set objADOCnn = CreateObject("ADODB.Connection")
objADOCnn.Open
"PROVIDER=SQLOLEDB;SERVER=Server;UID=UID;PWD=password;DATABASE=Database;"
'Create MSXML 4.0 DOM Object and initialize it
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.async = False
objXMLDOM.validateOnParse = False
'Get a list of files in the specified directory
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFilesPath)
Set objFilesColl = objFolder.Files
'Load each file in MSXML DOM and use ADO to insert data into the table
For Each objFile in objFilesColl
strCurFileName = strFilesPath & "\" & objFile.Name
'Load the XML file
'No error handling done
objXMLDOM.load strCurFileName
Set objNodes = objXMLDOM.selectNodes("/TransformedXML")
'Create and Open the recordset
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM DataSet WHERE 1 = 2", objADOCnn,
adOpenKeyset, adLockOptimistic
'Add records
For Each objNodeItem In objNodes
With objADORS
.AddNew
.fields("InspectionNumber") =
objNodeItem.selectSingleNode("InspectionNumber").nodeTypedValue
.fields("InspectionBeginningDate") =
objNodeItem.selectSingleNode("InspectionBeginningDate").nodeTypedValue
.fields("InspectionEndDate") =
objNodeItem.selectSingleNode("InspectionEndDate").nodeTypedValue
' .Update
End With
Next
objADORS.Close
'Message box for debugging purposes
'MsgBox "Copied data from " & strCurFileName & " into the database"
Next
objADOCnn.Close
Set objADORS = Nothing
Set objADOCnn = Nothing
Set objXMLDOM = Nothing
Set objFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
Thanks PD
This may not be the correct forum but if you could point me in the right direction it would be much appreciated. I am trying to import a number of rather complicated XML file into SQL Server 2000 using VB in an ActiveX script executed through a DTS pack, but my knowlede of xml is limited and my VB isn't brilliant hence using some code that I found, I have had to do it this way due to the files being so large.
I only want the data from the transformedXML tag at the bottom, you can see some of the fields that I want referenced in the VB script
When the script is run, it ends successfully, though there is nothing in the table.
Any idea????
My Xml file is listed below
<?xml version="1.0"?>
<Inspection xmlns:xsd=" xmlns:xsi=" <FileName>S:\Schools data\MEG\280480.XML</FileName>
<InstitutionType>School</InstitutionType>
<InstitutionName>West Street</InstitutionName>
<InstitutionNumber>119174</InstitutionNumber>
<InspectionNumber>280480</InspectionNumber>
<Date>31/10/2005</Date>
<IndependentSchool>false</IndependentSchool>
<InspectionType>S5</InspectionType>
<Inspectors>
<OIN>29504</OIN>
<Name>Shirley</Name>
<LeadInspector>true</LeadInspector>
<AssistantInspector>false</AssistantInspector>
</Inspectors>
<Inspectors>
<OIN>18146</OIN>
<Name>Michael</Name>
<LeadInspector>false</LeadInspector>
<AssistantInspector>true</AssistantInspector>
</Inspectors>
<SchoolEfs>
<InspectorOin>18146 - Michael</InspectorOin>
<ObservationTime>30</ObservationTime>
<EfType>L</EfType>
<YearGroups>1</YearGroups>
<YearGroups />
<YearGroups />
<YearGroups />
<GroupingAbility>MC</GroupingAbility>
<GroupingGender>MI</GroupingGender>
<Present>18</Present>
<Nor>20</Nor>
<SubjectCode1>MA</SubjectCode1>
<SubjectCode2>NY</SubjectCode2>
<SenSupportCount>0</SenSupportCount>
<SenAssistantCount>1</SenAssistantCount>
<EalSupportCount>1</EalSupportCount>
<EalAssistantCount>0</EalAssistantCount>
<OthSupportCount>0</OthSupportCount>
<OthAssistantCount>1</OthAssistantCount>
<InspInitialWithEf>MO03</InspInitialWithEf>
<Focus />
<Context />
<Evaluation />
<Summary />
<Overall>2</Overall>
<Standards>3</Standards>
<Progress>2</Progress>
<PersonalDev>0</PersonalDev>
<Teaching>2</Teaching>
<Curriculum>2</Curriculum>
<Care>2</Care>
<Leadership>0</Leadership>
<CsiEval />
</SchoolEfs>
<SchoolEfs>
REPEATS AS ABOVE (A FEW OF THESE TAGS)
</SchoolEfs>
<SchoolKsYg xsi:type="xsd:string">Key Stage F</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Key Stage 1</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Key Stage 2</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group N</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group R</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 1</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 2</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 3</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 4</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 5</SchoolKsYg>
<SchoolKsYg xsi:type="xsd:string">Year Group 6</SchoolKsYg>
<InspectionReport>
<TransformedXml><?xml version="1.0" encoding="utf-16"?>
<InspectionReport xmlns=" xmlns:apd=" xmlns:core=" xmlnsdt=" <InspectionKeyData>
<InspectionNumber>280480</InspectionNumber>
<InspectionBeginningDate>2005-10-31</InspectionBeginningDate>
<InspectionEndDate>2005-11-01</InspectionEndDate>
<ReportingInspector>
<InspectorName>Shirley Herring</InspectorName>
<InspectorStatus />
</ReportingInspector>
<InspectionCategory />
<DateOfPreviousInspection>1900-01-01</DateOfPreviousInspection>
</InspectionKeyData>
<InspectionSetting>
<SettingName>West Street</SettingName>
<SettingAddress>
<apd:Line>West Street</apd:Line>
<apd:Line>C</apd:Line>
<apd:Line>Lanc</apd:Line>
<apd:Line>BBW</apd:Line>
</SettingAddress>
<TelephoneNumber>01282</TelephoneNumber>
<FaxNumber>01282</FaxNumber>
<School>
<UniqueReferenceNumber>119174</UniqueReferenceNumber>
<LEAName>Lan</LEAName>
<TypeOfSchool>primary</TypeOfSchool>
<SchoolCategory>community</SchoolCategory>
<PupilLowAge>3</PupilLowAge>
<PupilHighAge>11</PupilHighAge>
<PupilGender>mixed</PupilGender>
<NumberOnRoll>190</NumberOnRoll>
<AppropriateAuthority>The governing body</AppropriateAuthority>
<ChairOfGovernors>Ann</ChairOfGovernors>
<Headteacher>Mr Ron Peden</Headteacher>
</School>
</InspectionSetting>
<InspectionJudgements>
<JudgeOverallEffectiveness>
<MeetingNeeds>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</MeetingNeeds>
<PartnershipWorking>
<SchoolGrade>1</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</PartnershipWorking>
<QualityFoundation>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</QualityFoundation>
<SelfEvaluation>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SelfEvaluation>
<ImprovementCapacity>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</ImprovementCapacity>
<EffectiveSteps>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</EffectiveSteps>
</JudgeOverallEffectiveness>
<JudgeAchievementAndStandards>
<LearnersAchieve>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</LearnersAchieve>
<StandardsReached>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</StandardsReached>
<ProgressMade>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</ProgressMade>
<DifficultyDisability>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</DifficultyDisability>
</JudgeAchievementAndStandards>
<JudgePersonalDevelopment>
<OverallPersonal>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</OverallPersonal>
<SpiritualCultural>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SpiritualCultural>
<Behaviour>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Behaviour>
<Attendance>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Attendance>
<Enjoyment>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</Enjoyment>
<SafePractice>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</SafePractice>
<HealthyLifestyle>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</HealthyLifestyle>
<PositiveContribution>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</PositiveContribution>
<WorkplaceEconomic>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</WorkplaceEconomic>
</JudgePersonalDevelopment>
<JudgeQualityOfProvision>
<EffectiveFullRange>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EffectiveFullRange>
<CurriculumNeedsInterests>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</CurriculumNeedsInterests>
<CareGuidance>
<SchoolGrade>1</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</CareGuidance>
</JudgeQualityOfProvision>
<JudgeLeadershipAndManagement>
<RaisingSupporting>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</RaisingSupporting>
<DirectionQuality>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</DirectionQuality>
<MonitorReview>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</MonitorReview>
<EqualityDiscrimination>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EqualityDiscrimination>
<EffectivenessEfficiency>
<SchoolGrade>2</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</EffectivenessEfficiency>
<GovernorsSupervision>
<SchoolGrade>3</SchoolGrade>
<SixthFormGrade>9</SixthFormGrade>
</GovernorsSupervision>
<AdequacySuitability>
<SchoolYesNo>yes</SchoolYesNo>
<SixthFormYesNo>key stage not present</SixthFormYesNo>
</AdequacySuitability>
</JudgeLeadershipAndManagement>
<JudgeHealth>
<EatDrink>
<SchoolYesNo>yes</SchoolYesNo>
</EatDrink>
<Exercise>
<SchoolYesNo>yes</SchoolYesNo>
</Exercise>
<DiscourageAbuse>
<SchoolYesNo>yes</SchoolYesNo>
</DiscourageAbuse>
<SexualHealth>
<SchoolYesNo>yes</SchoolYesNo>
</SexualHealth>
</JudgeHealth>
<JudgeSafety>
<GovernmentRequirements>
<SchoolYesNo>yes</SchoolYesNo>
</GovernmentRequirements>
<RiskAssessment>
<SchoolYesNo>yes</SchoolYesNo>
</RiskAssessment>
<ReduceAntiSocial>
<SchoolYesNo>yes</SchoolYesNo>
</ReduceAntiSocial>
<AvoidKeyRisks>
<SchoolYesNo>yes</SchoolYesNo>
</AvoidKeyRisks>
</JudgeSafety>
<JudgePositive>
<Relationships>
<SchoolYesNo>yes</SchoolYesNo>
</Relationships>
<DecisionParticipate>
<SchoolYesNo>yes</SchoolYesNo>
</DecisionParticipate>
<ActivityCommunity>
<SchoolYesNo>yes</SchoolYesNo>
</ActivityCommunity>
</JudgePositive>
<JudgeEconomic>
<BasicSkills>
<SchoolYesNo>yes</SchoolYesNo>
</BasicSkills>
<Enterprise>
<SchoolYesNo>yes</SchoolYesNo>
</Enterprise>
<CareersGuidance>
<SchoolYesNo>key stage not present</SchoolYesNo>
</CareersGuidance>
<EmploymentEconomy>
<SchoolYesNo>key stage not present</SchoolYesNo>
</EmploymentEconomy>
</JudgeEconomic>
<SpecialMeasures>
<SchoolYesNo>no</SchoolYesNo>
</SpecialMeasures>
<NoticeImprove>
<SchoolYesNo>no</SchoolYesNo>
</NoticeImprove>
</InspectionJudgements>
</InspectionReport></TransformedXml>
<ImportedFileDetails>Filename: F:\doc
File date/time: 11 November 2005 15:49:38
Import date: 11 November 2005 15:54:26</ImportedFileDetails>
</InspectionReport>
</Inspection>
Function Main()
Dim objFSO
Dim objFolder
Dim objFilesColl
Dim iFilesCount
Dim objFile
Dim objXMLDOM
Dim objNodes
Dim objNodeItem
Dim objADORS
Dim objADOCnn
Dim strCurFileName
'Create and initialize (Open) ADO Connection
Set objADOCnn = CreateObject("ADODB.Connection")
objADOCnn.Open
"PROVIDER=SQLOLEDB;SERVER=Server;UID=UID;PWD=password;DATABASE=Database;"
'Create MSXML 4.0 DOM Object and initialize it
Set objXMLDOM = CreateObject("MSXML2.DOMDocument.4.0")
objXMLDOM.async = False
objXMLDOM.validateOnParse = False
'Get a list of files in the specified directory
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFilesPath)
Set objFilesColl = objFolder.Files
'Load each file in MSXML DOM and use ADO to insert data into the table
For Each objFile in objFilesColl
strCurFileName = strFilesPath & "\" & objFile.Name
'Load the XML file
'No error handling done
objXMLDOM.load strCurFileName
Set objNodes = objXMLDOM.selectNodes("/TransformedXML")
'Create and Open the recordset
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM DataSet WHERE 1 = 2", objADOCnn,
adOpenKeyset, adLockOptimistic
'Add records
For Each objNodeItem In objNodes
With objADORS
.AddNew
.fields("InspectionNumber") =
objNodeItem.selectSingleNode("InspectionNumber").nodeTypedValue
.fields("InspectionBeginningDate") =
objNodeItem.selectSingleNode("InspectionBeginningDate").nodeTypedValue
.fields("InspectionEndDate") =
objNodeItem.selectSingleNode("InspectionEndDate").nodeTypedValue
' .Update
End With
Next
objADORS.Close
'Message box for debugging purposes
'MsgBox "Copied data from " & strCurFileName & " into the database"
Next
objADOCnn.Close
Set objADORS = Nothing
Set objADOCnn = Nothing
Set objXMLDOM = Nothing
Set objFSO = Nothing
Main = DTSTaskExecResult_Success
End Function
Thanks PD