From: <Ste...@zv...> - 2001-10-23 01:30:44
|
Dear Yong Chen, You wrote: > I'm trying your tclxml 2.1theata and tcldom-1.6 (I can't find the > place to download tcldom2.0, if it exists). TclDOM 2.0 is in development. You can get it from the CVS repository. > Basically these 2 packages are great, but I'm having a problem with > your dom package, can you please help? Your document uses XML Namespaces. Unfortunately, although TclXML v2.x does support XML Namespaces, TclDOM v1.6 does not support XML Namespaces at all. I've started adding support for XML Namespaces in v2.0, but it is by no means complete yet (serialisation is a major issue). That work is part of the effort to add DOM Level 2 support. Sorry I can't help further at this time, Steve Ball The rest of what you wrote: > under tclsh8.3 shell: > > %package require dom > 1.6 > %% proc readAndModifyEnvelope { args } { > set f [open "SessionManagement_SessionManager_createSession.xml"] > set all_lines [ read $f] > > set mydoc [dom::DOMImplementation parse $all_lines] > set rr [dom::DOMImplementation serialize $mydoc] > puts $rr > return $rr > } > > The previous proc simply reads in an XML file > "SessionManagement_SessionManager_createSession.xml", converts it into > dom doc, then serializes it back (and saves the result in rr) and > returns the result. > > The problem is, the value in 'rr' is different now from the file. Some > attributes of some elements such as Envelope, soapServiceHandler are > missing after conversion. For example, Envelope had an attribute named > xmlns:s, it doesn't show up after the conversion. > > Also <s:Body> becomes <Body>. > > Here is the original file: > SessionManagement_SessionManager_createSession.xml > > <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" > xmlns:xsd="http://www.w3.org/1999/XMLSchema" > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" > > s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> > <s:Body> > <soapServiceHandler xmlns="urn:MyService"> > <createEnableSession module="SessionManagement" > interface="SessionManager"> > <userName> > admin > </userName> > <password> > admin > </password> > <enablePassword> > enable > </enablePassword> > </createEnableSession> > </soapServiceHandler> > </s:Body> > </s:Envelope> > > the file is changed to following (result from puts $rr): > > <?xml version='1.0'?> > <!DOCTYPE Envelope> > <Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> > > <Body> > <soapServiceHandler> > <createEnableSession interface="SessionManager" > module="SessionManagement"> > <userName> > admin > </userName> > <password> > admin > </password> > <enablePassword> > enable > </enablePassword> > </createEnableSession> > </soapServiceHandler> > </Body> > </Envelope> > > thanks for your help > Yong Chen -- Steve Ball | XSLT Standard Library | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL Schemas http://www.zveno.com/ | TclXML TclDOM | Tcl, Web Development Ste...@zv... +---------------------------+--------------------- Ph. +61 2 6242 4099 | Mobile (0413) 594 462 | Fax +61 2 6242 4099 |