ooxml

Check-in [6f6ba1295a]
Login

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

Overview
Comment:revise xQuery xl_sheets
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | xquery
Files: files | file ages | folders
SHA3-256: 6f6ba1295a3537cec0c999b38c0964559e7e0bd85268d35d59e0540c626217d3
User & Date: alex 2019-11-08 12:32:13
Context
2019-11-08
13:08
revise xQuery xl_read Closed-Leaf check-in: b460a8bb8b user: alex tags: xquery
12:32
revise xQuery xl_sheets check-in: 6f6ba1295a user: alex tags: xquery
2019-11-05
21:58
merged from tcltest check-in: d7bececf50 user: alex tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ooxml.tcl.

772
773
774
775
776
777
778
779


780
781
782
783
784
785
786
787
788



789
790
791
792
793
794
795
796
797
798
799
800
801
802

  set rels 0
  if {![catch {open xlsx/xl/_rels/workbook.xml.rels r} fd]} {
    fconfigure $fd -encoding utf-8
    if {![catch {dom parse [read $fd]} rdoc]} {
      set rels 1
      set relsroot [$rdoc documentElement]
      $rdoc selectNodesNamespaces [list X [$relsroot namespaceURI]]


    }
    close $fd
  }

  if {![catch {open xlsx/xl/workbook.xml r} fd]} {
    fconfigure $fd -encoding utf-8
    if {![catch {dom parse [read $fd]} doc]} {
      set root [$doc documentElement]
      $doc selectNodesNamespaces [list X [$root namespaceURI]]



      set idx -1
      foreach node [$root selectNodes /X:workbook/X:sheets/X:sheet] {
	if {[$node hasAttribute sheetId] && [$node hasAttribute name]} {
	  set sheetId [$node @sheetId]
	  set name [$node @name]
	  set rid [$node @r:id]
	  foreach node [$relsroot selectNodes {/X:Relationships/X:Relationship[@Id=$rid]}] {
	    if {[$node hasAttribute Target]} {
	      lappend sheets [incr idx] [list sheetId $sheetId name $name rId $rid]
	    }
	  }
	}
      }
      $doc delete







|
>
>








|
>
>
>

|




|







772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807

  set rels 0
  if {![catch {open xlsx/xl/_rels/workbook.xml.rels r} fd]} {
    fconfigure $fd -encoding utf-8
    if {![catch {dom parse [read $fd]} rdoc]} {
      set rels 1
      set relsroot [$rdoc documentElement]
      $rdoc selectNodesNamespaces {
        G http://schemas.openxmlformats.org/package/2006/relationships
      }
    }
    close $fd
  }

  if {![catch {open xlsx/xl/workbook.xml r} fd]} {
    fconfigure $fd -encoding utf-8
    if {![catch {dom parse [read $fd]} doc]} {
      set root [$doc documentElement]
      $doc selectNodesNamespaces {
	G http://schemas.openxmlformats.org/spreadsheetml/2006/main
	r http://schemas.openxmlformats.org/officeDocument/2006/relationships
      }
      set idx -1
      foreach node [$root selectNodes /G:workbook/G:sheets/G:sheet] {
	if {[$node hasAttribute sheetId] && [$node hasAttribute name]} {
	  set sheetId [$node @sheetId]
	  set name [$node @name]
	  set rid [$node @r:id]
	  foreach node [$relsroot selectNodes {/G:Relationships/G:Relationship[@Id=$rid]}] {
	    if {[$node hasAttribute Target]} {
	      lappend sheets [incr idx] [list sheetId $sheetId name $name rId $rid]
	    }
	  }
	}
      }
      $doc delete