468,170 Members | 1,884 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,170 developers. It's quick & easy.

Programmatic Alteration of Internal DTD Subset

Hi All,

I have hundreds of small XML files of the form (extrabeous stuff removed):

<?xml version="1.0"?>
<!DOCTYPE page PUBLIC "-//LOCAL//DTD PAGE 0.1//EN" "page.dtd">
<page>
<graphic boardno="entityname1" />
<graphic boardno="entityname2" />
</page>

that I would like to process into this form:

<?xml version="1.0"?>
<!DOCTYPE page [
<!ENTITY entityname1 SYSTEM "entityname1.gif" NDATA gif>
<!ENTITY entityname2 SYSTEM "entityname2.gif" NDATA gif>
<!NOTATION gif SYSTEM "image/gif">
]>
<page>
<graphic boardno="entityname1" />
<graphic boardno="entityname2" />
</page>

That is, I'd like to load each file, find all the boardno attributes,
insert an ENTITY declaration, insert a NOTATION declaration, and write
the result to a file. The XML markup is unchanged, just the internal
DTD is altered. Finding the boardno attributes in a DOM is trivial, but
manipulating the internal DTD subset and getting it to file is eluding me.

Apart from doing the DTD manipulation as a text file, any suggested tool
sets/approaches. Perl, Python, Java, whatever.

Regards,
Chris W
Oct 10 '08 #1
2 1756
I explored the similar issue some time back.

You could look at my findings at,

http://gandhimukul.tripod.com/xml/xml.html

Please see, item no, 6.

Regards,
Mukul

On Oct 10, 10:56*am, Chris W <chrisw_j...@yahoo.com.auwrote:
Hi All,

I have hundreds of small XML files of the form (extrabeous stuff removed):

<?xml version="1.0"?>
<!DOCTYPE page PUBLIC "-//LOCAL//DTD PAGE 0.1//EN" "page.dtd">
<page>
* <graphic boardno="entityname1" />
* <graphic boardno="entityname2" />
</page>

that I would like to process into this form:

<?xml version="1.0"?>
<!DOCTYPE page [
* * * * <!ENTITY *entityname1 SYSTEM "entityname1.gif" NDATA gif>
* * * * <!ENTITY *entityname2 SYSTEM "entityname2.gif" NDATA gif>
* * * * <!NOTATION gif SYSTEM "image/gif">
]>
<page>
* <graphic boardno="entityname1" />
* <graphic boardno="entityname2" />
</page>

That is, I'd like to load each file, find all the boardno attributes,
insert an ENTITY declaration, insert a NOTATION declaration, and write
the result to a file. *The XML markup is unchanged, just the internal
DTD is altered. *Finding the boardno attributes in a DOM is trivial, but
manipulating the internal DTD subset and getting it to file is eluding me..

Apart from doing the DTD manipulation as a text file, any suggested tool
sets/approaches. *Perl, Python, Java, whatever.

Regards,
Chris W
Oct 11 '08 #2
Mukul Gandhi wrote:
I explored the similar issue some time back.

You could look at my findings at,

http://gandhimukul.tripod.com/xml/xml.html

Please see, item no, 6.

Regards,
Mukul
Thank you sir. Most helpful.

Chris W
Oct 11 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by les_ander | last post: by
29 posts views Thread by Chris Dutrow | last post: by
1 post views Thread by Razvan | last post: by
2 posts views Thread by Dave | last post: by
4 posts views Thread by Doug Johnston | last post: by
6 posts views Thread by Dave Boyd | last post: by
8 posts views Thread by Carlos J. Quintero | last post: by
19 posts views Thread by Bill Cohagan | last post: by
6 posts views Thread by Blaine Manyluk | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.