Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
DCR-TYPE="xml" rendering unordered xml
wchanaarf
Hi all,
I am defining my datacapture.cfg file as dcr-type="xml" in the templating.cfg file.
When I save my record it gives me an xml file but it is unordered, teamsite seems to be ordering the elements alphabetically. How do i get teamsite to save my XML elements in the order in which they are defined in the datacapture.cfg file?
for example in my datacapture.cfg i have
Find more posts tagged with
Comments
kvargas23
I have a sample DCT that has 3 containers in it with a single item in each and it saves in the correct order (Win2k3, 6.5). (as laid out in the DCT)...I just made sure the path and location attributes for each is specified as is required.
However, I notice in the templating docs on page 50 that the order of the nodes in an xml type DCR is "not guaranteed" ..so guess I'm lucky. The docs also lead one to believe that if you wanted to guarantee the order you would need to build a DTD.
Keith
Migrateduser
Anytime I use xml type DCRs, I create a DTD, and I have never experienced the problem described above. So, I'm inclined to say that is the right answer.
wchanaarf
I am using DTD definitions and am still having problems. My DCRs save in an unordered format and i trigger an error upon validation with my DTD. I am on Teamsite 6.0. What am I doing wrong? Notice that my sample XML is unordered.
my datacapture.cft
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd">
<data-capture-requirements dcr-validation="accept-invalid"
dtd-system-identifier="Y:/default/main/jto_test/WORKAREA/common/templatedata/CBTE/willtestdtd/simple.dtd" name="will-test">
<ruleset name="dct">
<root-container location="simple-example" name="simple-example">
<item name="message" pathid="message">
<label>Message</label>
<description/>
<text/>
</item>
<item name="zebra" pathid="zebra">
<label>Zebra</label>
<description/>
<text/>
</item>
<item name="address1" pathid="address1">
<label>Address1</label>
<description/>
<text/>
</item>
<item name="firstname" pathid="firstname">
<label>Firstname</label>
<description/>
<text/>
</item>
</root-container>
</ruleset>
</data-capture-requirements>
Sample DTD
<!-- This is a simple example DTD.
It is a "Hello, world!" type of DTD.
-->
<!ELEMENT simple-example (message,zebra,address1,firstname)>
<!ELEMENT message (#PCDATA)>
<!ELEMENT zebra (#PCDATA)>
<!ELEMENT address1 (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
Sample output
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE simple-example SYSTEM "Y:/default/main/jto_test/WORKAREA/common/templatedata/CBTE/willtestdtd/simple.dtd">
<simple-example><address1>3</address1><firstname>4</firstname><message>1</message><zebra>2</zebra></simple-example>
Migrateduser
Try placing your DTD on a webserver and loading it via url. I got the same error you did using your code, but when I changed it to our usual paradigm of storing the DTD under
/httpd/iw, it worked fine:
[HTML]
Message
Zebra
Address1
Firstname
[/HTML]
wchanaarf
Thank you all very very much for your help that worked like a charm
I would have considered writing an XSL transform or some kind of ugly perl hack if this didn't work.
mstradling
The doc. is quite correct (not often someone types that about Interwoven documentation!) - XML only needs to be structurally correct. All child elements of element X must be stored under element X, but the order of those children is irrelivant.
Provided you access your XML through a parser (SAX or DOM) it shouldn't be an issue.