JFLib

diagram_io/src/data.rs#

Source: lib/diagram_io/src/data.rs

data -- (JD18) the external data parts of a VSDX package and diagram_core's data::DataSets
(DF-12)

  load(doc, limits)        after reading (vsdx::read): connections.xml, recordsets.xml and the
                           recordset parts they name become doc.data; the parts and the
                           relationships from recordsets.xml leave doc.parts / doc.rels.  When
                           one of them is not understood, all stay parts as before (kept as
                           bytes, written back unchanged).
  with_parts(doc)          for writing (vsdx::write): a copy of the document with doc.data as
                           parts again (None when there is no data: nothing to add)
  ado(rs) / read_ado(..)   a recordset's rows as an ADO persisted recordset ("ADO classic XML",
                           what Visio's DataRecordset.DataAsXML gives and AddFromXML takes)

The parts ([MS-VSDX] 2.3.3.2, 2.3.3.10; desktop Visio):
  /visio/data/connections.xml    DataConnections (NextID) > DataConnection (ID, FileName,
                                 ConnectionString, Command, FriendlyName, Timeout,
                                 AlwaysUseConnectionFile); the main part names it
                                 (…/visio/2010/relationships/connections)
  /visio/data/recordsets.xml     DataRecordSets (NextID, ActiveRecordsetID, DataWindowOrder)
                                 > DataRecordSet (attributes in data.rs) > Rel r:id,
                                 DataColumns > DataColumn, PrimaryKey > RowKeyValue, RowMap,
                                 RefreshConflict, AutoLinkComparison; named by the main part
                                 (…/recordsets)
  /visio/data/recordsetN.xml     one per DataRecordSet, named by its Rel r:id from
                                 recordsets.xml (…/recordset): the cached rows as an ADO
                                 persisted recordset: <xml> s:Schema > s:ElementType >
                                 s:AttributeType (name, rs:name, s:datatype dt:type) and
                                 rs:data > z:row with one attribute per column
Row IDs: the column "_Visio_RowID_" (Visio 16 writes it first in the data of a recordset it
made itself; DataAsXML calls it "Visio_RowID"), else the RowKeyValue of the row's key (when
the key values name every row once), else the RowIDs of the key values in their order (Visio
saves rows it has not loaded with stale key values, the RowIDs in row order), else the
position (from 1).  Written with "_Visio_RowID_" first, as Visio writes its own.
What Visio 16 does otherwise (the Visio check of 2026-11-27): LangID='de-DE' (a culture name,
not the number the schema names), no XML declaration in the data part, a column's name as
the attribute when it is a plain name (else cN with rs:name), hex character references;
it keeps a data part it has not loaded as it was.

Everything is untrusted: the parts are bounded by the ZIP limits (part size), the XML by the
reader's depth and attribute limits; nothing recurses, and IDs, columns, keys and part names
are looked up in maps (no search through all of them for each one).
  • fn ado(rs: &Recordset) -> String a recordset's rows as an ADO persisted recordset (ADO classic XML): one AttributeType per column (c1, c2 ... with rs:name = the column's source name; types from DataType: string, float, boolean, dateTime, currency), rs:data with one z:row per row, empty values left out

Source: docs/API.md in the JFLib repository.