Daniel Veillard schrieb am 06.03.2011 um 13:36 (+0800):
> On Sat, Mar 05, 2011 at 12:16:50PM -0500, Liam R E Quin wrote:
> > On Sat, 2011-03-05 at 14:52 +0100, Michael Ludwig wrote:
> > > Dan Quach schrieb am 01.03.2011 um 12:05 (-0800):

> > > > <ds:SignedInfo>
> > > > <ds:CanonicalizationMethod Algorithm='
> > > > http://www.w3.org/2001/10/xml-exc-c14n#'/>
> > > > […]
> > > > </ds:SignedInfo>
> > > 
> > > That document is not namespace-well-formed.

>   Another way which requires only modificating the beginning is to
> push an internal subset first with a defaulted xmlns:ds on the top
> element, the advantage would be that the tree don't need to be
> modified there after (well maybe except dropping the DTD).
> 
> paphio:~/XML -> cat tst.xml
> <!DOCTYPE ds:SignedInfo [
> <!ATTLIST  ds:SignedInfo
>            xmlns:ds CDATA     #FIXED 'foo'>
> ]>
> <ds:SignedInfo> […]

Hehe, unobtrusive namespaces. :-)

Works nicely using the push parser from Perl:

          \,,,/
          (o o)
------oOOo-(_)-oOOo------
use strict;
use warnings;
use XML::LibXML;
use File::Slurp;

my( $dtdfile, @xmlfiles ) = @ARGV;
die 'DTD, XML+' unless $dtdfile and @xmlfiles;

my $dtdchunk = read_file $dtdfile;
my $parser = XML::LibXML->new;

foreach ( @xmlfiles ) {
        my $xmlchunk = read_file $_;
        $parser->parse_chunk( $dtdchunk );
        my $doc = $parser->parse_chunk( $xmlchunk, 1 );
        print $doc->toString, "\n\n";
}
-------------------------

  perl nons.pl ns.dtd x.xml y.xml

But what about the question I raised? Is it possible to turn off
namespace awareness with libxml2 using any of the other parsers?

* using the DOM parser?
* using the SAX parser?
* using the pull parser (XML reader)?

Thanks!
-- 
Michael Ludwig
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to