Skip to main content
Participating Frequently
April 25, 2008
Question

Switching off validation when reading XML

  • April 25, 2008
  • 8 replies
  • 905 views
Is it possible to switch off the validation of an XML file when opening it in FrameMaker?

I removed the public and system identifier from the Doctype declaration in the file (tried also removing the whole doctype declaration too) - and removed any reference to the DTD in the structured application definition. But when opening such an XML file, FrameMaker always displays a message dialog saying "Unable to validate because no DTD or Schema was specified in the XML file. Continue reading the file?". Is it possible to suppress this warning - I don't want it?

Thanks for any suggestions.
This topic has been closed for replies.

8 replies

Inspiring
April 27, 2008
Franz,

There should be no write-access issues. You do not need to use an external DTD. For example, if your original XML document is:


<document>

  <title>My summer vacation</title>

  <paragraph purpose="summary">I had fun.</paragraph>
</document>


instead of changing it to:

<!DOCTYPE document SYSTEM "onthefly.dtd">
<document>

  <title>My summer vacation</title>

  <paragraph purpose="summary">I had fun.</paragraph>
</document>

generate:


<!DOCTYPE document SYSTEM [

<!ELEMENT document ANY>

<!ELEMENT title ANY>

<!ELEMENT paragraph ANY>>

<!ATTLIST paragraph>

  purpose CDATA #IMPLIED>

]>
<document>

  <title>My summer vacation</title>

  <paragraph purpose="summary">I had fun.</paragraph>
</document>

_fackel_Author
Participating Frequently
April 26, 2008
The "DTD at run-time" idea is indeed clever. Yet I think it would put some additional constraints on the environment/setup of the application which I don't wont to bother with at the current time (e.g. write access to the place where the DTD is written, deletion of the DTD when it isn't needed any more, setup of the structapps...). But who knows, maybe one can use it when time comes.

Knowing that validation cannot be switched off, I plan to automatically generate a dummy DTD from the original DTD using the ANY stuff Russ proposed. It's the easiest way (given that I already have access to a DTD parser) to get the possible elements and to add additional elements required only for the formatting in FrameMaker.

Russ, Lynne, thanks for the light you shed on this topic.

Franz
Legend
April 26, 2008
Very clever idea.
Inspiring
April 25, 2008
Franz,


You could use XSLT to create a DTD on the fly that defines all (and only) the elements and attributes that appear in that particular document.


--Lynne
Legend
April 25, 2008
Franz, I hear you. I suppose you could just make one element definition that has every possible attribute defined for it, then duplicate it as many times as necessary for each element. It wouldn't hurt to have too much markup defined in this instance, I don't think.

Russ
_fackel_Author
Participating Frequently
April 25, 2008
Russ,

sad to here, that FM doesn't have such a feature. So I'll have to do the DTD thing. Though ANY is supported in XML DTDs, writing an "accept-everything-I-give-you" DTD is not that easy, as all elements occuring in an XML instance must be defined in the DTD (at least as far as I understand it), and there's no ANY with regard to attributes. But never the less I'll manage in some way to make some DTD hack to keep FM validating happily.

Thanks for your assistence.

Franz
Legend
April 25, 2008
fackel,

I don't think so. This is a common complaint with FM/XML import, the inability to avoid interactive messaging. Your best bet might be to write a very simple DTD that allows everything everywhere, just to keep the parser happy. If you are familiar with DTDs, that should only take a few minutes. Especially if XML DTDs support the [ANY] general rule, which I don't know off the top of my head.

Russ
_fackel_Author
Participating Frequently
April 25, 2008
Forgot to tell: I'm talking about FrameMaker 8.0.