Free Support Forum - aspose.com

XML Default Values

Hi,

I've been reviewing a MS Project XML Compatible file from another tool and have seen the following:

From the XML Schema: Tasks/Task/Finish ... Is an optional value...

The XML contains Start (start date) and Duration and DurationType for all Tasks and does not contain a Finish Date

The result is ... no finish dates are available from the Finish Property. There are some Baseline Start and Finish dates - however, these are not used to populate finish.

If the Finish date is not provided in the XML, and a Start date and Duration are provided, should the Finish date be calculated as it's default value during Load?

Also, is the value '65535' treated as '-1'?

Also, does Aspose.Tasks add a Task with UID = 0 when the file is saved? I've saved a very big MS Project XML file and it does not contain a task with UID = 0 (it has a resource with UID = 0)

Also, when saving, I'm getting <PredecessorLink> elements saved with a LagFormat = 21 which was not in the input XML ... even when there is no LinkLag. Is there any reason LinkLag = 21 (Month estimated) is being added as an element in when saved?

Thanks in advance! Any thoughts or pointers appreciated!!

Regards, Bruce

Hi Bruce,


1. MS Project and Aspose.Tasks always put task’s finish date when export data to XML. The finish date could not be calculated from other data in common case, see a sample screen shot attached. So it is a good practice to provide the data in the XML. I have created a new issue ‘Add method for task’s finish date calculation from its start date and duration.’ with ID = 16676 and linked it to this forum thread. But I think we can not implement it by default while loading project data from XML.

2. Aspose.Tasks does not convert 65535 to -1.

3. Task with UID = 0 is a project’s root task. It is added to all projects by MS Project by default and Aspose.Tasks does not add it.

4. We are using a default value for LagFormat when the value is missed in the input XML. The issue ‘Allow selecting project’s default setting from templates (xml, mpp, mpt).’ with ID = 14111 is linked to this thread. It is an old issue from your this thread but I can not provide you with the issue planning implementation date just now.

Sorry for inconvenience.

Hi Sergey,

phew... I'm starting to realise how many different interpretations a single (ish) XML Schema can have especially when most of the elements are optional.

Re: 1 ... The method would be great ... however, are you planning a true 'calculate' method that would (re-) calculate critical paths etc? This would handle the problem too. I'm still trying to understand why Finish Date was left out from source tool (non-aspose).

Re: 2 ... given the variety of values I've seen in fields that meet the schema; however, are different, I may do a transform before loading the file ... to validate some of the data and eliminate potential problems.

Re: 3 ... I'll check my notes ... however, I thought Aspose.Tasks did add missing Tasks or Resources when UID = 0 missing.

Re: 4 ... I raised this as Aspose.Tasks is adding a default LagFormat when there is not a LinkLag value. In a sense, this default value for LagFormat is not necessary until a LinkLag Value is added. In general, I have seen that when a LinkLag Value (other than 0) is added a corresponding LagFormat is added to qualify the value. So if a LinkLag Value is provided without a LagFormat - then a default LagFormat is required. ... also if no LinkLag value is provided, the default should be 0 and no LinkLag or LagFormat tags are necessary to be output. This is probably similar logic to reading the same parts of the MPP file. I think this one area highlights the importance of specifying the behaviour and default processing of almost every element. Maybe this should be documented in the Help documentation.

Just to emphasise the size of the problem around interpreting each element of the schema ... the UID element is the only required element for the Task element in the MS Project XML 2007 schema. All other elements are optional. so, theoretically, even the element needs a default or does not need to be output. It is relatively easy to make a new file if a template is used - however, reading other applications (non Aspose.Tasks) interpretation of the schema is proving to be a challenge. (As usual, MS Project appears to read anything thrown at it..)

Thanks very much for your help!!!

BTW: I'm looking forward to the fix for the problem.

Regards, Bruce

Hi Sergey,

I noticed that the XSD did not show 21 - however, I then went to the Aspose.Tasks help file and did see that the LagFormat was of type... TimeUnitType and did find 21.

I'm glad you are adding the values aligned to the schema and I hope this value will only be output when there is an associated LinkLag value.

Many thanks!!

Regards, Bruce

Hi Bruce,


Unfortunately there is not equivalence between the values from the XSD and TimeUnitType. When you read the data the absent XML LagFormats get TimeUnitType.Null values and the values are converted to ‘21’ when exported to XML back.

I have changed them to TimeUnitType.Undefined and not export the values back. The changes’ll take place in the next build.

Thank you a lot for correction.

The issues you have found earlier (filed as 16786) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi Bruce,


In our last Aspose.Tasks 3.1.0 we have added some public methods that could be helpful for your calculation:

1. A public class FilterResourceAssignByResource was added in Aspose.Tasks.Util namespace. It allows to find all assignments for resource specified. Works just as old FilterResourceAssignByTask does.
2. A new public method GetFinishDateByStartAndWork was added to Calendar class. It allows to calculate a finish date from start and working time duration. So you can use the method as a work around for ‘Add method for task’s finish date calculation from its start date and duration.’ issue.

Sorry for delay and waiting for your tests results.

Hi Sergey,

I've been looking again at the differences between the input source and the resultant xml output file. I now see that many of the items are boolean. I guess since the boolean value does not have a 'not defined' state ... the element will always be output.

Here are some additional examples ... in the task

<ActualWorkProtected>PT0H0M0S</ActualWorkProtected>

<ActualOvertimeWorkProtected>PT0H0M0S</ActualOvertimeWorkProtected>

<IsPublished>0</IsPublished>

<CommitmentType>0</CommitmentType>

These are not in the input xml and appear in the output.

BTW: For some reason, MS 2010 appears to be hiding the protected fields in the object model ... I haven't looked at the XSD for 2010 to see if they are in there too...

In general, there are a lot fewer items showing up in the output that were not in the input.

Regards, Bruce

Hi Bruce,


We are using an internal class NullableBool to define the unread boolean values, so if you can see the IsPublished element in the output when it was not in the input it is an issue. I am going to check the fields. May be we have to make the class public so the user can check was the element value really read from XML or it’s default value was used.

We can not use Nullable types here because of .Net 1.1 compatibility.

A new issue ‘Some unexpected elements in XML output.’ with ID = 18983 has been created and linked to this forum thread.

We are going to resolve the issue in our August/September releases. Sorry for inconvenience.

The MS Project 2010 XSD schema can contain a lot of elements which are really unused, just for backward compatibility.

The issues you have found earlier (filed as 16676) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as TASKS-18983) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.