ooxml

Artifact [b3043b3fd7]
Login

Artifact b3043b3fd776752630311d6a8e1de7101fab669c413232c232f7ff2e09b71f2e:

Wiki page [tools] by alex 2018-08-19 20:24:09.
D 2018-08-19T20:24:09.932
L tools
P cac013ef2d21d83829f555fcfce0a32fa9bfd2c184aa56e2f231804ca1f221fd
U alex
W 2297
<h3>demo.xml</h3>

<verbatim><?xml version="1.0" encoding="UTF-8"?>
<Demo>
  <!--comment block goes here-->
  <Node attribute="value">
    <SubNode>text data</SubNode>
  </Node>
  <?piTag the processing instructions goes here?>
  <Node><![CDATA[</this is malformed!</malformed</malformed & worse cDATA>]]></Node>
</Demo></verbatim>

<hr>

<h3>xmltotdom.tcl <file></h3>

<p>Will create a tcl source code to build a xml file as the original.<br>Example of demo.xml:</p>

<verbatim>package require tdom 0.9.0-
set encoding utf-8
dom setResultEncoding $encoding
set doc [dom createDocument Demo]
set root [$doc documentElement]
$root appendChild [$doc createComment {comment block goes here}]
$root appendChild [set node0 [$doc createElement Node]]
  $node0 setAttribute attribute value
  $node0 appendChild [set node1 [$doc createElement SubNode]]
    $node1 appendChild [$doc createTextNode {text data}]
$root appendChild [$doc createProcessingInstruction piTag {the processing instructions goes here}]
$root appendChild [set node0 [$doc createElement Node]]
  $node0 appendChild [$doc createTextNode {</this is malformed!</malformed</malformed & worse cDATA>}]
fconfigure stdout -encoding $encoding
puts [$root asXML -indent 2 -xmlDeclaration 1 -encString [string toupper $encoding]]</verbatim>

<hr>

<h3>xmltotdomnodecmd.tcl <file></h3>

<p>Will create a tcl source code using nodecmd to build a xml file as the original.<br>Example of demo.xml:</p>

<verbatim>package require tdom 0.9.0-
set encoding utf-8
dom setResultEncoding $encoding
dom createNodeCmd commentNode Comment
dom createNodeCmd piNode PInstr
dom createNodeCmd textNode Text
dom createNodeCmd -tagName Node elementNode Tag_Node
dom createNodeCmd -tagName SubNode elementNode Tag_SubNode
set doc [dom createDocument Demo]
set root [$doc documentElement]
$root appendFromScript {
  Comment {comment block goes here}
  Tag_Node attribute value {
    Tag_SubNode {
      Text text data
    }
  }
  PInstr piTag {the processing instructions goes here}
  Tag_Node {
    Text </this is malformed!</malformed</malformed & worse cDATA>
  }
}
fconfigure stdout -encoding $encoding
puts [$root asXML -indent 2 -xmlDeclaration 1 -encString [string toupper $encoding]]</verbatim>
Z c4e524bad885779bff9034f0fc0b3838