ooxml

Update of "tools"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: b3043b3fd776752630311d6a8e1de7101fab669c413232c232f7ff2e09b71f2e
Page Name:tools
Date: 2018-08-19 20:24:09
Original User: alex
Parent: cac013ef2d21d83829f555fcfce0a32fa9bfd2c184aa56e2f231804ca1f221fd (diff)
Next f93ef9ab273cbd3e5550e3715f8942bfdd26dee35b0dd3ea828da5ca15dc7d3b
Content

demo.xml

<?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>

xmltotdom.tcl <file>

Will create a tcl source code to build a xml file as the original.
Example of demo.xml:

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]]

xmltotdomnodecmd.tcl <file>

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

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]]