DTD Modifications Issues

This should cover W3C XML Schema, Relax NG and DTD related problems.
jon
Posts: 7

DTD Modifications Issues

Mon May 19, 2014 7:23 pm

Hi,

I've been modifying my DTD and have two issues.

1) I want to allow @id attributes not to be unique anymore. For that, I replaced all the occurrences of the type of @id: from ID (i.e. a unique ID) to CDATA. I also made sure to replace those occurrences in dependent .dtd or .mod files. Still, it seems that a couple of @id won't be accepted as non-unique. I was wondering if there was a way to specify a single rule in the DTD to have all @id attributes to be CDATA.

2)I need to allow a table entry (marked up as <entry>) to have any kind of child element. The entry is declared as an entity, the following way:
<!ENTITY % tbl.entry.mdl "entity_values">
What I'd like is for the "entity_values" to have any content. I did a fair bit of research but wasn't able to find anything that enabled that. I found out about the "ANY" keyword for ELEMENT but that's not what I want. Right now, I hardcoded a few potential child tags (let's call them <value1>, <value2> etc...) for entity_values as a list ("value1 | value2 | ...") but that could potentially be very long.

Any input on one of those issues would be great!

Thanks,
Jonathan
adrian
Posts: 2336

Re: DTD Modifications Issues

Tue May 20, 2014 6:09 pm

Hi,

1. I don't see a way to have a single rule that does this.
May I ask why are you doing this (allowing non-unique IDs)?
If you have stylesheets that assumed the IDs are unique, you're going to have some trouble on the new model.

2.

Code: Select all

<!ELEMENT entry ANY>
would be the correct solution.

What you seem to want to do is hijack the internal parameter entity and replace it with something else:

Code: Select all

<!ENTITY % tbl.entry.mdl "entity_values">

You haven't mentioned how this entiry is used. In common DTDs I've seen it used like this:

Code: Select all

<!ELEMENT entry %tbl.entry.mdl;>

If that's the case, you can rewrite the internal parameter entity like this:

Code: Select all

<!ENTITY % tbl.entry.mdl "ANY">

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
jon
Posts: 7

Re: DTD Modifications Issues

Tue May 20, 2014 7:01 pm

Thank you Adrian!
<!ELEMENT entry ANY> did the trick for allowing any child element for <entry> tags. I was focusing on trying to change the existing entity but this solution is way more straightforward and makes more sense!
About the non-unicity of IDs, I actually have a table that has an indefinite number of rows and 4 columns. For a given row, the columns contain exactly the same markup but different content. A column entry is written as follows:
<value1 id=my_id">content[column i]</value1>.
It's not possible to change the markup, so the IDs will be the same for the four entries of a given row. I might actually be able to alter the ID if necessary, e.g. append a distinctive character at runtime and then remove it later, but ideally I would have liked to just overwrite the unicity of IDs.

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest