XLS架构另存为XML数据不正确的日期渲染

时间:2022-08-14 20:22:18

I have a xls full of data. I have created a schema to use that is working for everything, except the date column. The date column has dates like so: 5/11/2000 in it. When I save the XML I get 36657. Here is my schema:

我有一个xls充满数据。我创建了一个使用的模式,除日期列外,它适用于所有内容。日期栏的日期如下:2000年5月11日。当我保存XML时,我得到36657.这是我的架构:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<COLA>
  <Congress>
    <CongressTH>106th Congress (1999-2000)</CongressTH>
    <Subject>Designate certain national forest system lands within the boundaries of the state of VA as Wilderness area</Subject>
    <Committee>House Committee on Agriculture</Committee>
    <Witness>Jim Furnish</Witness>
    <Date>9/19/2011</Date>
    <Bill>HR 4646</Bill>
    <Link>2001_Testimony.pdf</Link>
  </Congress>
  <Congress>
    <CongressTH>106th Congress (1999-2000)</CongressTH>
    <Subject>Community Forest Restoration Act and Lake Tahoe Restoration Act</Subject>
    <Committee>House Committee on Agriculture</Committee>
    <Witness>Randle G. Phillips</Witness>
    <Date>5/11/2000</Date>
    <Bill>HR 3388 and S 1288</Bill>
    <Link>2000_Testimony.pdf</Link>
  </Congress>
</COLA>

I have changed the date schema to various different layouts (example):

我已将日期架构更改为各种不同的布局(示例):

<Date>5/11/2000</Date>

<Date>5.11.2000</Date>

<Date>May 11, 2000</Date>

<Date>5-11-2000</Date>

These all do the same. Returning 36657. I have cut and pasted from Excel and I have cut and pasted from Notepad to strip formatting. Both do the same.

这些都是一样的。返回36657.我已经从Excel剪切并粘贴,我已经从记事本剪切并粘贴到条带格式。两者都是一样的。

What do I need to change in the Schema to get this date to render correctly when saved?

在Schema中需要更改什么才能在保存时正确呈现此日期?

Thanks!

谢谢!

1 个解决方案

#1


1  

The format of your excel cell data, is probably in DATE format, I don't think this transfers as expected when doing XLS to XML Schema. Try setting that entire columns data format to TEXT, that should pass the string value of the cell which is what you are trying to get across.

您的Excel单元格数据的格式可能是DATE格式,我不认为这在XLS到XML Schema时按预期传输。尝试将整个列数据格式设置为TEXT,它应该传递您尝试通过的单元格的字符串值。

To do this;

去做这个;

  • highlight your entire column where your date data is in excel,
  • 突出显示您的日期数据在excel中的整个列,
  • right click the selected cells, up will pop a menu
  • 右键单击所选单元格,向上将弹出一个菜单
  • Click Format Cells...
  • 单击格式化细胞...
  • on the left hand side under Category: click text.
  • 在类别下的左侧:单击文本。
  • Then save your XML
  • 然后保存您的XML

Your date should come through as the actual 05/11/2000 string.

您的日期应该是实际的05/11/2000字符串。

#1


1  

The format of your excel cell data, is probably in DATE format, I don't think this transfers as expected when doing XLS to XML Schema. Try setting that entire columns data format to TEXT, that should pass the string value of the cell which is what you are trying to get across.

您的Excel单元格数据的格式可能是DATE格式,我不认为这在XLS到XML Schema时按预期传输。尝试将整个列数据格式设置为TEXT,它应该传递您尝试通过的单元格的字符串值。

To do this;

去做这个;

  • highlight your entire column where your date data is in excel,
  • 突出显示您的日期数据在excel中的整个列,
  • right click the selected cells, up will pop a menu
  • 右键单击所选单元格,向上将弹出一个菜单
  • Click Format Cells...
  • 单击格式化细胞...
  • on the left hand side under Category: click text.
  • 在类别下的左侧:单击文本。
  • Then save your XML
  • 然后保存您的XML

Your date should come through as the actual 05/11/2000 string.

您的日期应该是实际的05/11/2000字符串。