Page 1 of 1

using the "document type assotiation"

Posted: Wed Mar 12, 2008 1:24 pm
by ronix
Hi folks,
i am trying to make an automatical assotiation of a xml with dtd. I have some xml documents with the same root node and different Public IDs. There is also a System ID, that i want to be ignored with the automatical assotiation

Code: Select all


<!DOCTYPE bhb PUBLIC "-//ID for DTD-1//EN" "dtd-1.dtd">
<bhb type="1">...</bhb>

<!DOCTYPE bhb PUBLIC "-//ID for DTD-2//EN" "dtd-2.dtd">
<bhb type="2">...</bhb>
There are my questions:
  • - Is it possible to use the root/@type as a distinguishing feature in the "document type assotiation"-menu, resp. what syntax is to be used
  • - Can I use the Public ID, if I dont want to remove the (wrong) System ID.
  • - How to fill out a Public ID in the input mask:

Code: Select all


'PUBLIC "-//ID for DTD-1//EN"'
'-//ID for DTD-1//EN'
  • Is there may be some other option I dont see?
Tanks!

Re: using the "document type assotiation"

Posted: Wed Mar 12, 2008 7:34 pm
by sorin_ristache
Hello,

If the PUBLIC IDs are different for your documents but the documents should be included in the same document type you should set only the Root local name column without the PUBLIC ID column in the table with the rules of association between the XML documents and the document type that you define in Options -> Preferences -> Document Type Association.

If you want to take into account also an attribute of the root element you can use a Java class to detect the documents of your document type and set the class name of this Java class in the Java class column of the table with association rules. There is an example of such a Java class in the User Manual.


Regards,
Sorin

Re: using the "document type assotiation"

Posted: Fri Mar 14, 2008 12:51 pm
by ronix
OK,
that with the java and the attributes is clear. :)

Buth there is something to clear up by the question with the PublicID: The PublicIDs are different and the DTD-s also.
My question is: Can I use the PublicID in Oxygen as a single distinguishing feature for associating the correct DTD?

Code: Select all


<!DOCTYPE bhb PUBLIC "-//ID for DTD-1//EN" "dtd-1.dtd">
<!DOCTYPE bhb PUBLIC "-//ID for DTD-2//EN" "dtd-2.dtd">
Thanks!

Re: using the "document type assotiation"

Posted: Fri Mar 14, 2008 1:21 pm
by sorin_ristache
Yes, you can specify only a public ID in the column Public ID of the table Rules which specifies the rules for matching the edited XML documents with document types defined in Preferences. If there is more than one public ID you have to add one row to the table Rules for each public ID. All edited documents that specify one of the public IDs that you use in your document type in the table Rules will be matched with this document type.


Regards,
Sorin

Re: using the "document type assotiation"

Posted: Fri Mar 14, 2008 2:32 pm
by ronix
OK, that was realy the first think i tryed, but oXygen/Xerces takes every time at first the SystemID. And my DTD-Path there is not the real one, because of the development environment.
It seems to me, that i have to try it with an java-Resolver, or with the catalog technique.

Regards

Ronix

Re: using the "document type assotiation"

Posted: Fri Mar 14, 2008 3:59 pm
by sorin_ristache
If you use different DTDs in the DOCTYPE declarations you should use the same URLs as system ID in all the XML documents and map the URLs to the appropriate local DTDs using an XML catalog on each computer where the document type is used. The URL does not need to point to a real DTD. For example if use one of the following DOCTYPE declarations in every XML document:

Code: Select all

<!DOCTYPE root1 PUBLIC "-//ID for DTD-1//EN" "http://dummy.host.com/folder/dtd-1.dtd">
and

Code: Select all

<!DOCTYPE root2 PUBLIC "-//ID for DTD-1//EN" "http://dummy.host.com/folder/dtd-2.dtd">
and in an XML catalog map the URL to a local DTD:

Code: Select all

<system systemId="http://dummy.host.com/folder/dtd-1.dtd" uri="path/to/dtd-1.dtd"/>
<system systemId="http://dummy.host.com/folder/dtd-2.dtd" uri="path/to/dtd-2.dtd"/>
In the document type defined in Preferences you have to add 2 rows with the two HTTP URLs for the system IDs.


Regards,
Sorin

Re: using the "document type assotiation"

Posted: Fri Mar 14, 2008 6:10 pm
by ronix
This works well :D

Thanks a lot!