Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Programmatic Alteration of Internal DTD Subset

From: Chris W <chrisw_junk@-----.---.-->
To: NULL
Date: 10/10/2008 3:57:00 PM

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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent