WH06

Last modified by superadmin on 2018-01-12 20:29

HW06 - XML Canonization

Develop a Java class, with one static method, which receives two file names as absolute or relative pathnames (inFile and outFile) - and either outputs a parse error (if the inFile is not XML), or writes a canonized version of the inFile to the outFile. Both streams should be closed after the output is completed. XML documents with embedded DTDs (or referring to DTDs stored on disk) should be supported.

Note

A variant of Xerces sample class dom.Writer is not appropriate, since it deviates from the Canonic XML specification, as the implementation itself admits:

java -cp lib/xerces/xercesImpl.jar;lib/xerces/xercesSamples.jar dom.Writer -h
usage: java dom.Writer (options) uri ...

options: -p name Select parser by name. -n | -N Turn on/off namespace processing. -v | -V Turn on/off validation. -xd | -XD Turn on/off loading of external DTDs. NOTE: Always on when -v in use and not supported by all parsers. ... -c | -C Turn on/off Canonical XML output. NOTE: This is not W3C canonical output. -h This help screen.

Most likely that you cannot use the XML standard parsers, but have to use specialized libraries like Apache XML Security instead.

Bibliography

  1. http://www.ibm.com/developerworks/library/x-c14n/ - IBM article on XML canonization.
  2. Apache XML Security project
Tags:
Created by Kalvis Apsītis on 2007-10-20 11:16
    
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4 - Documentation