且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

excel:无法保存或导出xml数据。此工作簿中的xml映射不可导出

更新时间:2022-10-15 12:34:01

通常的原因是Excel不了解非常复杂的XML。 p>

办公室。 microsoft.com


如果映射的元素与其他元素的关系无法保留,则无法导出XML映射。由于以下原因,可能无法保留此关系:



映射元素的模式定义包含在具有以下属性的序列中:




  • maxoccurs属性不等于1

  • 该序列定义了多个直接子元素,或具有另一个合成器作为一个直接的孩子。

  • 具有相同重复父元素的非重复兄弟元素被映射到不同的XML表。

  • 将多个重复元素映射到相同的XML表,重复不由祖先元素定义。

  • 来自不同父类的子元素映射到同一个XML表。



另外,如果XML映射包含以下XML模式结构之一,则不能导出:



列表的列表




  • 一个项目列表包含一个



非标准化数据




  • XML表包含已在模式中定义的元素,以发生一次(maxoccurs属性设置为1)。当您将这样一个元素添加到XML表格中时,Excel会使用元素的多个实例填充表列。



选择




  • 映射元素是模式构造的一部分。



I come across a excel XML export problem. To simple the question, I do the next steps:

1.Data>>from XML data import.

Actually, I want to export it back to XML file again after some modification on data (those first line variables never change)

2.Then click Develop>> export. It shows " cannot save or export XML data.The XML maps in this workbook are not exportable". (even I do nothing modification on data). I watch several export tutorials video on *** already, but seems not cover my problem. I haven't find the problem yet.

The usual reason is the Excel doesn't understand very complicated XML.

From office.microsoft.com:

An XML mapping cannot be exported if the mapped element’s relationship with other elements cannot be preserved. This relationship may not be preserved for the following reasons:

The schema definition of a mapped element is contained within a sequence with the following attributes:

  • The maxoccurs attribute is not equal to 1.
  • The sequence has more than one direct child element defined, or has another compositor as a direct child.
  • Nonrepeating sibling elements with the same repeating parent element are mapped to different XML tables.
  • Multiple repeating elements are mapped to the same XML table, and the repetition is not defined by an ancestor element.
  • Child elements from different parents are mapped to the same XML table.

Additionally, the XML mapping cannot be exported if it contains one of the following XML schema constructs:

List of lists

  • One list of items contains a second list of items.

Denormalized data

  • An XML table contains an element that has been defined in the schema to occur once (the maxoccurs attribute is set to 1). When you add such an element to an XML table, Excel fills the table column with multiple instances of the element.

Choice

  • A mapped element is part of a schema construct.