darshan

darshan

  • NA
  • 15
  • 0

Want solution on following question?

Nov 17 2006 7:11 AM
hi,
I have written the following lines of code to fetch the data from .xml file in C#.Net.
Contents of XML file are as follows:  <?xml version="1.0" ?>
- <Project xmlns="http://schemas.microsoft.com/project">
   <Name>Project1.xml</Name>
   <Company>CSL</Company>
   <Author>CSL\DarshanK</Author>
   <CreationDate>2006-11-17T17:26:00</CreationDate>
   <LastSaved>2006-11-17T17:28:00</LastSaved>
   <ScheduleFromStart>1</ScheduleFromStart>
   <StartDate>2006-11-17T08:00:00</StartDate>
   <FinishDate>2006-11-17T17:00:00</FinishDate>
   <FYStartDate>1</FYStartDate>
   <CriticalSlackLimit>0</CriticalSlackLimit>
   <CurrencyDigits>2</CurrencyDigits>
   <CurrencySymbol>$</CurrencySymbol>
   <CurrencySymbolPosition>0</CurrencySymbolPosition>
   <CalendarUID>1</CalendarUID>
   <DefaultStartTime>08:00:00</DefaultStartTime>
   <DefaultFinishTime>17:00:00</DefaultFinishTime>
   <MinutesPerDay>480</MinutesPerDay>
   <MinutesPerWeek>2400</MinutesPerWeek>
   <DaysPerMonth>20</DaysPerMonth>
   <DefaultTaskType>0</DefaultTaskType>
   <DefaultFixedCostAccrual>3</DefaultFixedCostAccrual>
   <DefaultStandardRate>0</DefaultStandardRate>
   <DefaultOvertimeRate>0</DefaultOvertimeRate>
   <DurationFormat>7</DurationFormat>
   <WorkFormat>2</WorkFormat>
   <EditableActualCosts>0</EditableActualCosts>
   <HonorConstraints>0</HonorConstraints>
   <InsertedProjectsLikeSummary>1</InsertedProjectsLikeSummary>
   <MultipleCriticalPaths>0</MultipleCriticalPaths>
   <NewTasksEffortDriven>1</NewTasksEffortDriven>
   <NewTasksEstimated>1</NewTasksEstimated>
   <SplitsInProgressTasks>1</SplitsInProgressTasks>
   <SpreadActualCost>0</SpreadActualCost>
   <SpreadPercentComplete>0</SpreadPercentComplete>
   <TaskUpdatesResource>1</TaskUpdatesResource>
   <FiscalYearStart>0</FiscalYearStart>
   <WeekStartDay>0</WeekStartDay>
   <MoveCompletedEndsBack>0</MoveCompletedEndsBack>
   <MoveRemainingStartsBack>0</MoveRemainingStartsBack>
   <MoveRemainingStartsForward>0</MoveRemainingStartsForward>
   <MoveCompletedEndsForward>0</MoveCompletedEndsForward>
   <BaselineForEarnedValue>0</BaselineForEarnedValue>
   <AutoAddNewResourcesAndTasks>1</AutoAddNewResourcesAndTasks>
   <CurrentDate>2006-11-17T08:00:00</CurrentDate>
   <MicrosoftProjectServerURL>1</MicrosoftProjectServerURL>
   <Autolink>1</Autolink>
   <NewTaskStartDate>0</NewTaskStartDate>
   <DefaultTaskEVMethod>0</DefaultTaskEVMethod>
   <ProjectExternallyEdited>0</ProjectExternallyEdited>
   <ExtendedCreationDate>1984-01-01T00:00:00</ExtendedCreationDate>
   <ActualsInSync>1</ActualsInSync>
   <RemoveFileProperties>0</RemoveFileProperties>
   <AdminProject>0</AdminProject>
   <OutlineCodes />
   <WBSMasks />
   <ExtendedAttributes />
 - <Calendars>
  - <Calendar>
     <UID>1</UID>
     <Name>Standard</Name>
     <IsBaseCalendar>1</IsBaseCalendar>
     <BaseCalendarUID>-1</BaseCalendarUID>
   - <WeekDays>
   - <WeekDay>
      <DayType>1</DayType>
      <DayWorking>0</DayWorking>
     </WeekDay>
   - <WeekDay>
      <DayType>2</DayType>
      <DayWorking>1</DayWorking>
   - <WorkingTimes>
   - <WorkingTime>
      <FromTime>08:00:00</FromTime>
      <ToTime>12:00:00</ToTime>
     </WorkingTime>
   - <WorkingTime>
      <FromTime>13:00:00</FromTime>
      <ToTime>17:00:00</ToTime>
     </WorkingTime>
     </WorkingTimes>
     </WeekDay>
   - <WeekDay>
      <DayType>3</DayType>
      <DayWorking>1</DayWorking>
   - <WorkingTimes>
   - <WorkingTime>
      <FromTime>08:00:00</FromTime>
      <ToTime>12:00:00</ToTime>
     </WorkingTime>
   - <WorkingTime>
      <FromTime>13:00:00</FromTime>
      <ToTime>17:00:00</ToTime>
     </WorkingTime>
     </WorkingTimes>
     </WeekDay>
   - <WeekDay>
      <DayType>4</DayType>
      <DayWorking>1</DayWorking>
   - <WorkingTimes>
   - <WorkingTime>
      <FromTime>08:00:00</FromTime>
      <ToTime>12:00:00</ToTime>
     </WorkingTime>
   - <WorkingTime>
      <FromTime>13:00:00</FromTime>
      <ToTime>17:00:00</ToTime>
     </WorkingTime>
     </WorkingTimes>
     </WeekDay>
   - <WeekDay>
      <DayType>5</DayType>
      <DayWorking>1</DayWorking>
   - <WorkingTimes>
   - <WorkingTime>
      <FromTime>08:00:00</FromTime>
      <ToTime>12:00:00</ToTime>
     </WorkingTime>
   - <WorkingTime>
      <FromTime>13:00:00</FromTime>
      <ToTime>17:00:00</ToTime>
     </WorkingTime>
     </WorkingTimes>
     </WeekDay>
   - <WeekDay>
      <DayType>6</DayType>
      <DayWorking>1</DayWorking>
   - <WorkingTimes>
   - <WorkingTime>
      <FromTime>08:00:00</FromTime>
      <ToTime>12:00:00</ToTime>
     </WorkingTime>
   - <WorkingTime>
      <FromTime>13:00:00</FromTime>
      <ToTime>17:00:00</ToTime>
     </WorkingTime>
     </WorkingTimes>
     </WeekDay>
   - <WeekDay>
      <DayType>7</DayType>
      <DayWorking>0</DayWorking>
     </WeekDay>
     </WeekDays>
     </Calendar>
   - <Calendar>
      <UID>3</UID>
      <Name>John</Name>
      <IsBaseCalendar>0</IsBaseCalendar>
      <BaseCalendarUID>1</BaseCalendarUID>
     </Calendar>
   </Calendars>
 - <Tasks>
  - <Task>
     <UID>0</UID>
     <ID>0</ID>
     <Type>1</Type>
     <IsNull>0</IsNull>
     <CreateDate>2006-11-17T17:26:00</CreateDate>
     <WBS>0</WBS>
     <OutlineNumber>0</OutlineNumber>
     <OutlineLevel>0</OutlineLevel>
     <Priority>500</Priority>
     <Start>2006-11-17T08:00:00</Start>
     <Finish>2006-11-17T17:00:00</Finish>
     <Duration>PT8H0M0S</Duration>
     <DurationFormat>21</DurationFormat>
     <Work>PT8H0M0S</Work>
     <ResumeValid>0</ResumeValid>
     <EffortDriven>0</EffortDriven>
     <Recurring>0</Recurring>
     <OverAllocated>0</OverAllocated>
     <Estimated>0</Estimated>
     <Milestone>0</Milestone>
     <Summary>1</Summary>
     <Critical>1</Critical>
     <IsSubproject>0</IsSubproject>
     <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
     <ExternalTask>0</ExternalTask>
     <EarlyStart>2006-11-17T08:00:00</EarlyStart>
     <EarlyFinish>2006-11-17T17:00:00</EarlyFinish>
     <LateStart>2006-11-17T08:00:00</LateStart>
     <LateFinish>2006-11-17T17:00:00</LateFinish>
     <StartVariance>0</StartVariance>
     <FinishVariance>0</FinishVariance>
     <WorkVariance>480000</WorkVariance>
     <FreeSlack>0</FreeSlack>
     <TotalSlack>0</TotalSlack>
     <FixedCost>0</FixedCost>
     <FixedCostAccrual>3</FixedCostAccrual>
     <PercentComplete>0</PercentComplete>
     <PercentWorkComplete>0</PercentWorkComplete>
     <Cost>0</Cost>
     <OvertimeCost>0</OvertimeCost>
     <OvertimeWork>PT0H0M0S</OvertimeWork>
     <ActualDuration>PT0H0M0S</ActualDuration>
     <ActualCost>0</ActualCost>
     <ActualOvertimeCost>0</ActualOvertimeCost>
     <ActualWork>PT0H0M0S</ActualWork>
     <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
     <RegularWork>PT8H0M0S</RegularWork>
     <RemainingDuration>PT8H0M0S</RemainingDuration>
     <RemainingCost>0</RemainingCost>
     <RemainingWork>PT8H0M0S</RemainingWork>
     <RemainingOvertimeCost>0</RemainingOvertimeCost>
     <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
     <ACWP>0</ACWP>
     <CV>0</CV>
     <ConstraintType>0</ConstraintType>
     <CalendarUID>-1</CalendarUID>
     <LevelAssignments>1</LevelAssignments>
     <LevelingCanSplit>1</LevelingCanSplit>
     <LevelingDelay>0</LevelingDelay>
     <LevelingDelayFormat>8</LevelingDelayFormat>
     <IgnoreResourceCalendar>0</IgnoreResourceCalendar>
     <HideBar>0</HideBar>
     <Rollup>0</Rollup>
     <BCWS>0</BCWS>
     <BCWP>0</BCWP>
     <PhysicalPercentComplete>0</PhysicalPercentComplete>
     <EarnedValueMethod>0</EarnedValueMethod>
     <ActualWorkProtected>PT0H0M0S</ActualWorkProtected>
     <ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>
    </Task>
  - <Task>
     <UID>1</UID>
     <ID>1</ID>
     <Name>Task1</Name>
     <Type>0</Type>
     <IsNull>0</IsNull>
     <CreateDate>2006-11-17T17:27:00</CreateDate>
     <WBS>1</WBS>
     <OutlineNumber>1</OutlineNumber>
     <OutlineLevel>1</OutlineLevel>
     <Priority>500</Priority>
     <Start>2006-11-17T08:00:00</Start>
     <Finish>2006-11-17T17:00:00</Finish>
     <Duration>PT8H0M0S</Duration>
     <DurationFormat>7</DurationFormat>
     <Work>PT8H0M0S</Work>
     <ResumeValid>0</ResumeValid>
     <EffortDriven>1</EffortDriven>
     <Recurring>0</Recurring>
     <OverAllocated>0</OverAllocated>
     <Estimated>0</Estimated>
     <Milestone>0</Milestone>
     <Summary>0</Summary>
     <Critical>1</Critical>
     <IsSubproject>0</IsSubproject>
     <IsSubprojectReadOnly>0</IsSubprojectReadOnly>
     <ExternalTask>0</ExternalTask>
     <EarlyStart>2006-11-17T08:00:00</EarlyStart>
     <EarlyFinish>2006-11-17T17:00:00</EarlyFinish>
     <LateStart>2006-11-17T08:00:00</LateStart>
     <LateFinish>2006-11-17T17:00:00</LateFinish>
     <StartVariance>0</StartVariance>
     <FinishVariance>0</FinishVariance>
     <WorkVariance>480000</WorkVariance>
     <FreeSlack>0</FreeSlack>
     <TotalSlack>0</TotalSlack>
     <FixedCost>0</FixedCost>
     <FixedCostAccrual>3</FixedCostAccrual>
     <PercentComplete>0</PercentComplete>
     <PercentWorkComplete>0</PercentWorkComplete>
     <Cost>0</Cost>
     <OvertimeCost>0</OvertimeCost>
     <OvertimeWork>PT0H0M0S</OvertimeWork>
     <ActualDuration>PT0H0M0S</ActualDuration>
     <ActualCost>0</ActualCost>
     <ActualOvertimeCost>0</ActualOvertimeCost>
     <ActualWork>PT0H0M0S</ActualWork>
     <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
     <RegularWork>PT8H0M0S</RegularWork>
     <RemainingDuration>PT8H0M0S</RemainingDuration>
     <RemainingCost>0</RemainingCost>
     <RemainingWork>PT8H0M0S</RemainingWork>
     <RemainingOvertimeCost>0</RemainingOvertimeCost>
     <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
     <ACWP>0</ACWP>
     <CV>0</CV>
     <ConstraintType>0</ConstraintType>
     <CalendarUID>-1</CalendarUID>
     <LevelAssignments>1</LevelAssignments>
     <LevelingCanSplit>1</LevelingCanSplit>
     <LevelingDelay>0</LevelingDelay>
     <LevelingDelayFormat>8</LevelingDelayFormat>
     <IgnoreResourceCalendar>0</IgnoreResourceCalendar>
     <HideBar>0</HideBar>
     <Rollup>0</Rollup>
     <BCWS>0</BCWS>
     <BCWP>0</BCWP>
     <PhysicalPercentComplete>0</PhysicalPercentComplete>
     <EarnedValueMethod>0</EarnedValueMethod>
     <ActualWorkProtected>PT0H0M0S</ActualWorkProtected>
     <ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>
    </Task>
   </Tasks>
 - <Resources>
  - <Resource>
    <UID>0</UID>
    <ID>0</ID>
    <Type>1</Type>
    <IsNull>0</IsNull>
    <WorkGroup>0</WorkGroup>
    <MaxUnits>1</MaxUnits>
    <PeakUnits>0</PeakUnits>
    <OverAllocated>0</OverAllocated>
    <CanLevel>1</CanLevel>
    <AccrueAt>3</AccrueAt>
    <Work>PT0H0M0S</Work>
    <RegularWork>PT0H0M0S</RegularWork>
    <OvertimeWork>PT0H0M0S</OvertimeWork>
    <ActualWork>PT0H0M0S</ActualWork>
    <RemainingWork>PT0H0M0S</RemainingWork>
    <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
    <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
    <PercentWorkComplete>0</PercentWorkComplete>
    <StandardRate>0</StandardRate>
    <StandardRateFormat>2</StandardRateFormat>
    <Cost>0</Cost>
    <OvertimeRate>0</OvertimeRate>
    <OvertimeRateFormat>2</OvertimeRateFormat>
    <OvertimeCost>0</OvertimeCost>
    <CostPerUse>0</CostPerUse>
    <ActualCost>0</ActualCost>
    <ActualOvertimeCost>0</ActualOvertimeCost>
    <RemainingCost>0</RemainingCost>
    <RemainingOvertimeCost>0</RemainingOvertimeCost>
    <WorkVariance>0</WorkVariance>
    <CostVariance>0</CostVariance>
    <SV>0</SV>
    <CV>0</CV>
    <ACWP>0</ACWP>
    <CalendarUID>2</CalendarUID>
    <BCWS>0</BCWS>
    <BCWP>0</BCWP>
    <IsGeneric>0</IsGeneric>
    <IsInactive>0</IsInactive>
    <IsEnterprise>0</IsEnterprise>
    <BookingType>0</BookingType>
    <ActualWorkProtected>PT0H0M0S</ActualWorkProtected>
    <ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>
    <CreationDate>2006-11-17T17:26:00</CreationDate>
    </Resource>
  - <Resource>
     <UID>1</UID>
     <ID>1</ID>
     <Name>John</Name>
     <Type>1</Type>
     <IsNull>0</IsNull>
     <Initials>J</Initials>
     <WorkGroup>0</WorkGroup>
     <MaxUnits>1</MaxUnits>
     <PeakUnits>1</PeakUnits>
     <OverAllocated>0</OverAllocated>
     <CanLevel>1</CanLevel>
     <AccrueAt>3</AccrueAt>
     <Work>PT8H0M0S</Work>
     <RegularWork>PT8H0M0S</RegularWork>
     <OvertimeWork>PT0H0M0S</OvertimeWork>
     <ActualWork>PT0H0M0S</ActualWork>
     <RemainingWork>PT8H0M0S</RemainingWork>
     <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
     <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
     <PercentWorkComplete>0</PercentWorkComplete>
     <StandardRate>0</StandardRate>
     <StandardRateFormat>2</StandardRateFormat>
     <Cost>0</Cost>
     <OvertimeRate>0</OvertimeRate>
     <OvertimeRateFormat>2</OvertimeRateFormat>
     <OvertimeCost>0</OvertimeCost>
     <CostPerUse>0</CostPerUse>
     <ActualCost>0</ActualCost>
     <ActualOvertimeCost>0</ActualOvertimeCost>
     <RemainingCost>0</RemainingCost>
     <RemainingOvertimeCost>0</RemainingOvertimeCost>
     <WorkVariance>480000</WorkVariance>
     <CostVariance>0</CostVariance>
     <SV>0</SV>
     <CV>0</CV>
     <ACWP>0</ACWP>
     <CalendarUID>3</CalendarUID>
     <BCWS>0</BCWS>
     <BCWP>0</BCWP>
     <IsGeneric>0</IsGeneric>
     <IsInactive>0</IsInactive>
     <IsEnterprise>0</IsEnterprise>
     <BookingType>0</BookingType>
     <ActualWorkProtected>PT0H0M0S</ActualWorkProtected>
     <ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>
     <CreationDate>2006-11-17T17:27:00</CreationDate>
    </Resource>
   </Resources>
 - <Assignments>
  - <Assignment>
     <UID>1</UID>
     <TaskUID>1</TaskUID>
     <ResourceUID>1</ResourceUID>
     <PercentWorkComplete>0</PercentWorkComplete>
     <ActualCost>0</ActualCost>
     <ActualOvertimeCost>0</ActualOvertimeCost>
     <ActualOvertimeWork>PT0H0M0S</ActualOvertimeWork>
     <ActualWork>PT0H0M0S</ActualWork>
     <ACWP>0</ACWP>
     <Confirmed>0</Confirmed>
     <Cost>0</Cost>
     <CostRateTable>0</CostRateTable>
     <CostVariance>0</CostVariance>
     <CV>0</CV>
     <Delay>0</Delay>
     <Finish>2006-11-17T17:00:00</Finish>
     <FinishVariance>0</FinishVariance>
     <WorkVariance>480000</WorkVariance>
     <HasFixedRateUnits>1</HasFixedRateUnits>
     <FixedMaterial>0</FixedMaterial>
     <LevelingDelay>0</LevelingDelay>
     <LevelingDelayFormat>7</LevelingDelayFormat>
     <LinkedFields>0</LinkedFields>
     <Milestone>0</Milestone>
     <Overallocated>0</Overallocated>
     <OvertimeCost>0</OvertimeCost>
     <OvertimeWork>PT0H0M0S</OvertimeWork>
     <RegularWork>PT8H0M0S</RegularWork>
     <RemainingCost>0</RemainingCost>
     <RemainingOvertimeCost>0</RemainingOvertimeCost>
     <RemainingOvertimeWork>PT0H0M0S</RemainingOvertimeWork>
     <RemainingWork>PT8H0M0S</RemainingWork>
     <ResponsePending>0</ResponsePending>
     <Start>2006-11-17T08:00:00</Start>
     <Stop>2006-11-17T08:00:00</Stop>
     <Resume>2006-11-17T08:00:00</Resume>
     <StartVariance>0</StartVariance>
     <Units>1</Units>
     <UpdateNeeded>0</UpdateNeeded>
     <VAC>0</VAC>
     <Work>PT8H0M0S</Work>
     <WorkContour>0</WorkContour>
     <BCWS>0</BCWS>
     <BCWP>0</BCWP>
     <BookingType>0</BookingType>
     <ActualWorkProtected>PT0H0M0S</ActualWorkProtected>
     <ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>
     <CreationDate>2006-11-17T17:27:00</CreationDate>
   - <TimephasedData>
      <Type>1</Type>
      <UID>1</UID>
      <Start>2006-11-17T08:00:00</Start>
      <Finish>2006-11-17T17:00:00</Finish>
      <Unit>2</Unit>
      <Value>PT8H0M0S</Value>
     </TimephasedData>
    </Assignment>
   </Assignments>
  </Project>

====================================================================

And for Fetching this Data from this file I have written code lines as below in C#.Net.
Problem is with XQUERY.I tried out all sort of query to fetch the data of Task assigned to perticular Resource.I just need that XQUERY for XPATH.
So will anybody help me to fetch the data?

Dataset objDS=new Dataset();
XmlDataDocument objXMLDoc = new XmlDataDocument(objDS);

//PRoblem lies in XQUERY
XmlNodeList objXMLNodeList = objXMLDoc.DocumentElement.SelectNodes("*");

DataRow dataRow;
stringBuilder.AppendLine(
"");
foreach (XmlNode xmlNode in objXMLNodeList)
{
dataRow = objXMLDoc.GetRowFromElement((
XmlElement)xmlNode);
if (dataRow != null)
{
string str = objXMLNodeList[0].OuterXml;
stringBuilder.Append(str);
}
}
You can reply me on [email protected],[email protected]

Answers (1)