Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
XML elements from DCR are saved alphabetically?
erkel
Hi all,
I am having a little difficulty on a project I'm working on.
I have made the DCT's and PT's, but now am having a little trouble with the generated XML code that comes from the DCT's. The problem is that all the elements under the root container are arranged alphabetically, rather than the way they were entered on the DCT form. Is there anyway to stop this?
Example, some simple XML that has been taken directly from the XML file generated by a DCT:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<body>
<title>heading1</title>
<subtitle>subheading1</subtitle>
<para><p><strong>bbbb</strong></p><p>&nbsp;</p><p><em>italics&nbsp;</em></p></para>
<graphic>
<caption>this is a flower.</caption>
<src>/tlc/images/sunflower.gif</src>
</graphic>
</body>
<head>
<abstract>This is a test chunk and this is the description</abstract>
<title>Test Chunk</title>
</head>
</root>
Note the body element comes BEFORE the head elements, whereas on the DCT it was the other way around. Also, on all other generated XML its doing the same thing, its arranging the children of root (no pun intended) alphabetically. Children on those elements body and head etc are ok though.
Is there a way to force the generated XML to be the correct order rather than alphabetically?
Thanks.
Find more posts tagged with
Comments
Adam Stoller
I'm not sure of the answer - but there is some additional information you need to provide in order for someone to be able to respond reasonably to your query:
What version of TeamSite (including SP and patch information)
What platform is TeamSite running on
How is the DCT defined in your templating.cfg file
Can you show the first 5 lines of the DCT (starting with the <? xml ...> element)
There may be additional questions to raise after seeing the answers to the above.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
erkel
Hi There thanks for the reply,
We are running Teamsite 6 (not sure of any other version numbers), running on Linux.
The DCT is defined in the templating.cfg file as follows:
<templating>
<category name="LMMS">
<locations>
<branch vpath-regex="/default/main/LMMS" />
</locations>
<data-type name="Chunk" dcr-type="xml">
<presentation>
<template name="default.tpl" extension="html">
<locations>
<branch vpath-regex=".*" preview-dir="/preview">
<directory dir-regex=".*" />
</branch>
</locations>
</template>
</presentation>
<viewoptions />
</data-type>
...etc for other DCTs
</category>
</templating>
heres the actual DCT:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-capture-requirements SYSTEM "datacapture6.0.dtd">
<data-capture-requirements>
<ruleset name="dct">
<root-container name="root" location="root">
<container location="head" name="head">
<label>Chunk</label>
<!-- no unitcode as a chunk will be independent of it -->
<item name="title" pathid="title">
<label>Title</label>
<text maxlength="60" required="t" size="60"/>
</item>
<item name="abstract" pathid="abstract">
<label>Short description of chunk</label>
<description>Enter a short description of what this chunk is about</description>
<textarea rows="5" cols="64" required="t" wrap="virtual">
<callout label="Open HTML Editor" url="/iw-bin/custom/une/prod/html_editor" window-features="width=550,height=400,scrollbars=yes,resizable=yes" />
</textarea>
</item>
</container>
<container location="body" name="body">
<label>Chunk Content</label>
<!-- subcontainer to allow multiple sections -->
<container location="" name="sect" min="0" max="20" default="0" combination="or">
<item name="title" pathid="title">
<label>Section Heading</label>
<description>This will be a main section heading. If you are after a smaller heading, use Sub Heading instead.</description>
<text maxlength="60" required="t" size="60"/>
</item>
<item name="subtitle" pathid="subtitle">
<label>Sub Heading</label>
<text required="t" />
</item>
<item name="para" pathid="para">
<label>Paragraph</label>
<textarea rows="10" cols="64" required="t" wrap="virtual">
<callout label="Open HTML Editor" url="/iw-bin/custom/une/prod/html_editor" window-features="width=550,height=400,scrollbars=yes,resizable=yes" />
</textarea>
</item>
<!-- subcontainer for media attachment -->
<container location="graphic" name="graphic">
<label>Image</label>
<item name="src" pathid="src">
<label>Path</label>
<description>Path to the image. Can either be within the CMS or you can upload a new file.</description>
<browser size="40" required="t" maxlength="256" initial-dir="/" ceiling-dir="" extns=".gif,.jpg,.jpeg">
<callout label="Import from Desktop" url="/iw-bin/custom_upload.ipl/photoFilenameFactory" window-features="height=400,width=600,scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,status=no" />
</browser>
</item>
<item name="caption" pathid="caption">
<label>Caption</label>
<description>Caption to be displayed under each Image. Required.</description>
<text maxlength="150" required="t" size="40"/>
</item>
</container>
</container>
</container>
</root-container>
</ruleset>
</data-capture-requirements>
and heres the generated XML:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<body>
<title>heading1</title>
<subtitle>subheading1</subtitle>
<para><p><strong>bbbb</strong></p><p>&nbsp;</p><p><em>italics&nbsp;</em></p></para>
<graphic>
<caption>this is a flower.</caption>
<src>/tlc/images/sunflower.gif</src>
</graphic>
</body>
<head>
<abstract>This is a test chunk and this is the description</abstract>
<title>Test Chunk</title>
</head>
</root>
note the body and head elements are in the wrong order. I've noticed in all my other XML files that the elements under the root container are all being stored alphabetically. Why is this? How can I change this?
Thanks
Edited by erkel on 11/15/05 06:34 PM (server time).
Adam Stoller
You should probably contact Support.
You might need to define your own DTD for this and use the DTD->DCT conversion utility to create a custom DTD (RTFM FormsPublisher Developers Guide)
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
erkel
Thanks. I've actually managed to get around it by creating a presentation template that takes the elements from the original XML, arranges them in the proper order and then spits out the "correct" XML. I can then take that XML and do my XSLT on it.
It seems very odd that this is required though, I don't see why the elements wouldn't append onto the end thus making the XML correct in the first place!
gzevin
I think it was a flaw, with arrangment of elements, when one defined an industry XML, as opposed to IWOV XML.. which I myself still tend to use....
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
JeremyH
We ran in to this problem on 6.0 on AIX. TeamSite would order the elements in strict alphabetical order within each level if a DTD was not specified. (The specification of the DTD was quite particular. It took some trial and error to get the path that TS would recognize all around.)
However, once that is overcome there are a few issues with TS and DTD order, where it will not strictly adhere to the DTD. (It would read the DTD, attempt to organize based on the DTD, and then throw an error that something was out of order - because it didn't put it in the correct order.) We had a few cases open, but never had a resolution, and ended up changing removing DTD validation and settling with alphabetical order.
In pre-6.0 TS this was not a problem as templates would save the XML in the order in the DCT.