本文へ移動

@eightkk/vue-weave / core / fromMsProjectXml

Function: fromMsProjectXml() ​

fromMsProjectXml(xml, options?): MsProjectImport

Defined in: src/core/interchangeMsProject.ts:1152

Read a Microsoft Project XML (MSPDI) document, such as one written by Microsoft Project's "Save as XML" or by toMsProjectXml. Pure string parsing: no DOM, no network and no file access; a DOCTYPE is skipped and only the five predefined entities and character references are expanded. Namespaces are matched by local name.

The project name is Name when it is not blank, else Title, else empty. Each Task except the project summary task (UID 0) and empty rows (IsNull 1) becomes an MsProjectImportTask with its UID as id and Name, Start, Finish, OutlineLevel, PercentComplete, Milestone, Summary, Manual, Active, Duration, its constraint and its Baseline dates. Dates are wall-clock times at utcOffsetMinutes, as toMsProjectXml writes them, unless they carry a zone. Constraint types 2 and 4 to 7 become constraints as toMsProjectXml maps them, type 3 (Must Finish On) becomes finishNoEarlierThan and finishNoLaterThan at its date, and type 1 (As Late As Possible) becomes mode: 'alap'. PredecessorLink elements become dependencies with their type (FF 0, FS 1, SF 2, SS 3) and LinkLag (tenths of a minute) as elapsed milliseconds. Problems that the reader works around are listed in warnings (see MsProjectImportWarningCode) instead of thrown.

Calendars become calendars (MsProjectCalendar): the weekly working times (DayType 1 to 7) and the exceptions (DayType 0 entries and Exceptions) as one-off dates of a WorkWeek, with base calendars resolved so each week is complete. Each Exception is classified by its Type before any date is expanded. A daily exception every day (Type 1 or 7 with Period 1 or none), one without a Type or with Type 9, and a DayType 0 entry cover every date from FromDate to ToDate. These recurrences become their exact dates in that period: daily every N days (from FromDate), weekly every week on DaysOfWeek, monthly every month on day 1 to 28 or on the first to fourth or last Sunday to Saturday, and yearly on a day (not 29 February) or on such a position of a Month. With EnteredByOccurrences 1 (or Type 7) and a positive Occurrences, the first Occurrences dates from FromDate are taken instead of the dates up to ToDate. Other recurrences (weekly every two or more weeks, monthly every two or more months, days 29 to 31 or 29 February, positions of a day, weekday or weekend day, and Type 8) are left out with an unsupported-calendar warning, and an exception keeps at most 3,660 dates. The project CalendarUID becomes defaultCalendarId and a task's or resource's one calendarId. Resources (UID, Name, Type, IsCostResource, MaxUnits, CalendarUID) become resources, where IsCostResource 1 or Type 2 is a cost resource, and Assignments (TaskUID, ResourceUID, Units) become assignments; Units and MaxUnits stay fractions (1 is 100 %). Alternate work weeks are reported in warnings and left out. A working weekday without times is reported and left to the base calendar; an exception that is a working day without readable times is reported once, and its dates are days off.

Not imported: notes, custom fields, baseline work and cost, lags in percent, the working-time meaning of other lags, resource cost rates and availability tables, assignment work, dates and contours. Throws an Error for malformed XML (with the line and column) and for a document whose root element is not Project, and a RangeError for an invalid utcOffsetMinutes.

Parameters ​

xml ​

string

options? ​

MsProjectXmlOptions = {}

Returns ​

MsProjectImport

MIT ライセンスで公開しています。