cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

xml mapping file

anabors-keating
4-Participant

xml mapping file

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?

4 REPLIES 4

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

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?

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"/>

Good 🙂

I stopped using custom properties files.

Instead, I use a custom xconf file with wt.properties as its target, like you did.

So you can take advantage of the properties auto reload mechanism.

Announcements

Top Tags