From: Cameron L. <cl...@st...> - 2001-06-12 20:26:37
|
to get TclDOM to create a document withOUT a <!DOCTYPE ...> ? |
From: Joe E. <jen...@fl...> - 2001-06-13 01:02:06
|
Cameron Laird wrote: > [is there a way] > to get TclDOM to create a document withOUT a > <!DOCTYPE ...> Serialize the document element node instead of the root node: package require dom set doc [dom::DOMImplementation create] dom::node appendChild $doc [dom::document createElement $doc FOO] # To include <!DOCTYPE ...> declaration: dom::DOMImplementation serialize $doc # To omit it: dom::DOMImplementation serialize \ [dom::document cget $doc -documentElement] I think that dom::c has a bug where [dom::DOMImplementation serialize] can end up writing out _two_ <!DOCTYPE ...> declarations under certain circumstances; I haven't looked into this yet. --Joe English jen...@fl... |
From: Cameron L. <cl...@st...> - 2001-06-13 17:15:04
|
From jen...@fl... Tue Jun 12 20:19:32 2001 . . . > [is there a way] > to get TclDOM to create a document withOUT a > <!DOCTYPE ...> Serialize the document element node instead of the root node: package require dom set doc [dom::DOMImplementation create] dom::node appendChild $doc [dom::document createElement $doc FOO] # To include <!DOCTYPE ...> declaration: dom::DOMImplementation serialize $doc # To omit it: dom::DOMImplementation serialize \ [dom::document cget $doc -documentElement] . . . Thank you, Joe. What I really need is more XML documentation. In fact, I've been doing the serialize-the-document trick, and thinking of it as a trick; apparently I wasn't so ori- ginal. What puzzles me, though, is that I see in the WSDL world, for example, <?xml version='1.0'> <!-- what happened to the DOCTYPE? --> <wsdl:definitions xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'> ... </wsdl:definitions> What is *that*? Is there some name for version-element-plus- serialized-document? Is there a clever way to generate it? Quite-unrelated question: has anyone written WSDL::pretty_print node to supplement WSDL::serialize node ? The former would, I imagine, indent elements proportionally to their depth, and perhaps prettify attribute punctuation, and so on. Would such a thing interest anyone else, if I write it? |
From: Steve B. <Ste...@zv...> - 2001-06-17 01:29:23
|
Cameron Laird wrote: > What puzzles me, though, is that I see in the WSDL world, > for example, > <?xml version='1.0'> > <!-- what happened to the DOCTYPE? --> > <wsdl:definitions xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'> > ... > </wsdl:definitions> > What is *that*? Is there some name for version-element-plus- > serialized-document? Is there a clever way to generate it? That's an XML Namespace declaration. DOM Level 2 supports XML Namespaces, and TclDOM v2.0 includes (partial) support for DOM Level 2. Support for XML Namespaces is part of TclDOM v2. BTW, the Document Type Declaration is not required (it's optional in XML anyway). XML Namespaces do not mix at all with DTDs so it's pretty pointless having a Doc Type Declaration when the document is using XML Namespaces. > Quite-unrelated question: has anyone written > WSDL::pretty_print node > to supplement > WSDL::serialize node > ? The former would, I imagine, indent elements proportionally > to their depth, and perhaps prettify attribute punctuation, and > so on. Would such a thing interest anyone else, if I write it? Again, see the '-indent' option of the serialize method. Cheers, Steve Ball -- Steve Ball | waX Me Lyrical XML Editor | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL 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 |
From: Steve B. <Ste...@zv...> - 2001-06-17 01:20:08
|
Cameron Laird wrote: > > to get TclDOM to create a document withOUT a > <!DOCTYPE ...> Try: dom::DOMImplementation serialize $doc -showdoctypedecl 0 Similarly, this method also accepts the -showxmldecl option too. Cheers, Steve Ball -- Steve Ball | waX Me Lyrical XML Editor | Training & Seminars Zveno Pty Ltd | Web Tcl Complete | XML XSL 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 |