Skip to main content
1-Visitor
June 6, 2017
Question

xml mapping file

  • June 6, 2017
  • 1 reply
  • 2625 views

If I want to maintain an xml file (which is used for some attributes comparison between windchill and a third party system), where is the right place to keep that file?

1 reply

15-Moonstone
June 7, 2017

Hi,

There is no real rule for such requirement.

What I would recommand is to keep things open 🙂

By open, I mean no absolute path to the file, and easy to change.

What I do in such case is to add a property to wt.properties, and use a custom folder under $WT_HOME :

<Property default="$(wt.home)$(dir.sep)MyCustomApplication$(dir.sep)configuration$(dir.sep)Mapping.xml"
  name="ext.customapp.MappingFile"
  targetFile="codebase/wt.properties"/>

( This notation is not the one used in site.xconf : Another best practice is to include an xconf file to declaration.xconf with xconfmanager -i

This custom xconf file handles all the custom properties.   )

To read the property

wt.util.WTProperties.getLocalProperties().getProperty("ext.customapp.MappingFile")

regards

1-Visitor
June 8, 2017

I have followed as you described in the second way to have a custom.properties

When I propagate my custom.properties file, the value directly going there.

<Property name="myproject.custom.MappingFile" default="$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml"/>

and I am trying to read the value through

MyProjectPropertyFileReader fileRead = MyProjectPropertyFileReader.newMyProjectPropertyFileReader();

strValue         = fileRead.getProperty("myproject.custom.MappingFile");

this is returning as below,

$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml"

but I want the it as,

"E:\ptc\Windchill\myproject\configuration\Mapping.xml" so that I can read the mapping file.

Could you please let me know what am I missing here?

1-Visitor
June 8, 2017

Hello Olivier,

When I place targetFile as wt.properties and read as you mentioned, it works. Thanks a lot for your help.

<Property name="myproject.custom.MappingFile" default="$(wt.home)$(dir.sep)myproject$(dir.sep)configuration$(dir.sep)Mapping.xml" targetFile="codebase/wt.properties"/>