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)
Problems with repeating XML elements from DCT
MarkWh
Hi,
Does anyone have an example DCT that I could use that produces some xml with an element that occurs several times but without using replicants. I have tried the example in the forms publisher guide but that does not work either. I am trying to achieve the following:
<top>
<a>
<key>1</key><value>first</value>
</a>
<a>
<key>2</key><value>second</value>
</a>
<a>
<key>3</key><value>third</value>
</a>
</top>
If I don't use replicants I get a DCT as follows:
<?xml version="1.0" encoding = "UTF-8" standalone="no"?>
<!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd">
<data-capture-requirements type="content" name="title">
<ruleset name="Press Release">
<root-container name="top" location="top">
<container name="a" location="a">
<item name="key" pathid="key">
<label>key1</label>
<text></text>
</item>
<item name="value" pathid="value">
<label>value1</label>
<text></text>
</item>
</container>
<container name="a" location="a">
<item name="key" pathid="key">
<label>key2</label>
<text></text>
</item>
<item name="value" pathid="value">
<label>value2</label>
<text></text>
</item>
</container>
<container name="a" location="a">
<item name="key" pathid="key">
<label>key3</label>
<text></text>
</item>
<item name="value" pathid="value">
<label>value3</label>
<text></text>
</item>
</container>
</root-container>
</ruleset>
</data-capture-requirements>
This prompts for the values ok, but when I try to edit the xml again using the DCT, all the keys appear with the value 1, and all the values with the value first. Any ideas how I can get around this? The reason I cannot use replicants is that in reality the key values are fixed and are actually readonly as follows:
<?xml version="1.0" encoding = "UTF-8" standalone="no"?>
<!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd">
<data-capture-requirements type="content" name="title">
<ruleset name="Press Release">
<root-container name="top" location="top">
<container name="a" location="a">
<item name="key" pathid="key">
<label>key1</label>
<readonly><default>1</default></readonly>
</item>
<item name="value" pathid="value">
<label>value1</label>
<text></text>
</item>
</container>
<container name="a" location="a">
<item name="key" pathid="key">
<label>key2</label>
<readonly><default>2</default></readonly>
</item>
<item name="value" pathid="value">
<label>value2</label>
<text></text>
</item>
</container>
<container name="a" location="a">
<item name="key" pathid="key">
<label>key3</label>
<readonly><default>3</default></readonly>
</item>
<item name="value" pathid="value">
<label>value3</label>
<text></text>
</item>
</container>
</root-container>
</ruleset>
</data-capture-requirements>
Find more posts tagged with
Comments
Adam Stoller
Can you explain why you don't want to use replicants?
Do you want to use "iwov" style DCTs or are you looking to use your own custom DTD with "xml" style DCTs?
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
MarkWh
Hi,
Thanks for getting back to me. In answer to your questions......
Do you want to use "iwov" style DCTs or are you looking to use your own custom DTD with "xml" style DCTs?
I am looking to use my own custom DTD with xml style DCTs. The DCT would then just produce an xml file directly which could be used by another application.
Can you explain why you don't want to use replicants? My plans are not to use replicants because the "key"s are set so I would have a DCT that listed the "key" value and contained a prompt for the "value" value (sorry doubled up on terms a bit there). Therefore the DCT was prompting for 5 key value pairs it would be hard coded with ten prompts and the "key" values would be hard coded. The second set of code in my original posting is an attempt at this. I cannot see a way that I can use replicants and preset the "key" values.
Adam Stoller
I haven't done any custom-DTD templating - but I believe there are some instructions in the manuals for how to do this. Right now - you are expressing your desire for a custom DTD in terms of "iwov" style DTD - and that gets to be very confusing.
The DTD you're talking about is something like:
<!ELEMENT top (a+)>
<!ELEMENT a (key,value)>
<!ELEMTNT key (#PCDATA)>
<!ELEMENT value (#PCDATA)>
I suggest you do a bit of RTFM'ing regarding creating DCTs for custom DTDs ...
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
MarkWh
Thanks for your reply. Apologies if I have asked a stupid question! I have RTFM'd but got more than a little frustrated because the example in the manual just doesn't seem to work either! Hence I thought I'd asked the forum. I have found several issues with the manual and what the software claims to do. I am not saying this falls into that category, but I thought I'd check whether anyone else has managed it, before banging my head against it some more.
If I have understood you correctly the DTD you are referring to is the dtd-system-identifier attribute. I have tried setting this but this does not seem to help. If I understand correctly this DTD only checks on save, and does nothing for reading in. Reading in is the problem. Saving works ok, and the file comes out in the format expected. Reading back in is what goes wrong.
Mark