External xml as DCR

Hi,
I want to use my external xml file as a DCR.

This can be treated as a too general question but let me elborate.

I have a data packed big xml file to be filtered and displayed on my front end.
So the approach im following is : convert the xml file into a DCR then link it to ContentXML section of component and write an xslt over it to display selected values.

Since an external file cannot be consumed as a DCR, we need to change its properties compatible to a standard DCR using iwextattr command.

So my first question is whether this approach is logically correct.
Second, i need the syntax of the iwextattr commmand to do the conversion or the actual wayout for this.

Thanks
Gurjot

Comments


  • So my first question is whether this approach is logically correct.
    Second, i need the syntax of the iwextattr commmand to do the conversion or the actual wayout for this.

    Thanks
    Gurjot
    I see no issues in your approach and it's very typical implementation. General execution over clt is
    iwextattr -s TeamSite/Templating/DCR/Type=your-dcr-type vpath-to-your-file
    If you want to set the external attributes in your external class file after you create the file (CSSimpleFile)
    [html]CSSimpleFile myFile = null;
    CSExtendedAttribute[] extAtt = { new CSExtendedAttribute("TeamSite/Templating/DCR/Type", "your-dcr-type")};
    myFile.setExtendedAttributes(extAtt);[/html]
  • Thanks a lot
  • I see no issues in your approach and it's very typical implementation.
    What? No it isn't. There's no sense converting something into a DCR if it's not going to be edited through FormsPub. Simply tacking on the EA and putting it in the right folder structure is a terrible idea.

    If your XML is produced/edited by something external and you simply need to make it accessible to components, you should use a Java External to read the file and append it to the component-fed XML. If it needs to be a user-configurable selection, use a File datum instead of a DCR datum.
  • What? No it isn't. There's no sense converting something into a DCR if it's not going to be edited through FormsPub. Simply tacking on the EA and putting it in the right folder structure is a terrible idea.
    It was just my assumption that any point of time an editor may come to TeamSite and change some of the data using the DCR, I have seen this kind of implementations just to have a final upper hand over the automated content publishing.
  • While there can be some truth in your premise, whenever it happens, there is a 99.44% chance that the XML will be changed before the input. Typically new fields are added, moved, changed, etc. So that you be done before you just copy XML and slap EAs on the XML
  • We would have accomplished this differently. Why not just read the XML directly in the XSL using

    <xsl:variable name="CONTENT" select="document(path/to/the/file.xml)"/>

    Then use the xPath $CONTENT/... to access the content.
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs