00001 /* impl.tcl --*/ 00002 /* */ 00003 /* Support script for libxml2 implementation.*/ 00004 /* */ 00005 /* Std disclaimer*/ 00006 /* */ 00007 /* $Id: impl.tcl,v 1.4 2005/05/20 14:07:35 balls Exp $*/ 00008 00009 namespace ::dom { 00010 variable strictDOM 1 00011 } 00012 00013 ret dom::libxml2::parse (type xml , type args) { 00014 00015 array set options { 00016 -keep normal 00017 -retainpath /* 00018 } 00019 array set options $args 00020 00021 if {[catch {eval ::xml::parser -parser libxml2 [array get options]} parser]} { 00022 return -code error "unable to create XML parser due to \"$parser\"" 00023 } 00024 00025 if {[catch {$parser parse $xml} msg]} { 00026 return -code error $msg 00027 } 00028 00029 set doc [$parser get document] 00030 set dom [dom::libxml2::adoptdocument $doc] 00031 $parser free 00032 00033 return $dom 00034 } 00035 ret dom::parse (type xml , type args) { 00036 return [eval ::dom::libxml2::parse [list $xml] $args] 00037 } 00038