cancel
Showing results for 
Search instead for 
Did you mean: 

How do I reference extended attributes in the XML definition

Former Member
0 Kudos
111

I have an XSD model with a simple string extended attribute at the Element level and I'd like to update the XML Language definition to include the value of my extended attribute in the XML as a commented field.

What syntax do I need to use to access the extended attribute?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have found the resolution. Bridging pages 248-249 of the Customizing PowerDesigner guide, there is "Note: To access an extended attribute defined in another extension file attached to the model, prefix the name with the .D formatting option. For example: %.D:MyExtAtt%"

I can put the following code in the 'extendedAttributesDecl' to comment my Elements with the value of my extended attribute:

.if(%.D:oURI%)

  <!-- element UIR: %.D:oURI%-->

.endif(\n)

Bonus item was finding that './/' or '.comment' can be used to add inline comments to the GTL code that won't be output in the generated result.

Thanks!

Answers (1)

Answers (1)

GeorgeMcGeachie
Active Contributor
0 Kudos

I don't have any examples to share with you, but here are a couple of pointers. There's a likely-looking property in the XML Language definition:

Profile\Element\Templates\extendedAttributesDecl


Take a look at 'Customising and Extending PowerDesigner' on the Help menu - topic "Customising Generation with GTL". Looks like the "itemDecl" template may provide you with some good examples.

Former Member
0 Kudos

Unfortunately, this is the area where I found myself stumped.

I have an extended attribute for Elements which is a string that contains a resolvable URL to a published glossary, separate from the element definition which is set in the comment's section.

Under the "itemDecl" section for Element, I'm wanting to extend it, or possibly the "extendedAttributesDecl" to include this specific item in a comment in the XML output. I guess it's really a two part question, 1) How do I interrogate the extended attributes of an object with GTL and 2) what %variable% would display the results?

former_member200945
Contributor
0 Kudos

Could you upload a model sample so i can try?

Former Member
0 Kudos

I'm unable to upload a sample model (blocked by company policy), but I've been using a really simplified, generic model for testing. I have one complex type with two elements within it. I've added a "URI" extended attribute of type string to both complex element and element and populated it with the elementname + "URI" to just identify it in the output.