我创建“笔记应用程序”,我希望有能力格式化笔记的内容。我决定用我自己的格式来使用XML:
<note>
<block>
<text>
some text _some text_ **some text**
</text>
</block>
<block>
<image path="XXXXX_XXX_XXX.png"/>
</block>
</note>
我想在某个地方保留一个版本的格式。例如,在新版本的格式中,我可以将block
重命名为element
,然后将formatVersion
从1.0
更改为1.1
。我必须把版本字符串放在哪里?
它必须是note的属性吗?
<note formatVersion="1.1">
<note/>
或者我应该把它排除在XML之外?例如,在Note对象中
-----------------------
| Note |
-----------------------
|- noteXml: String |
|- formatVersion: int |
-----------------------
发布于 2016-07-17 15:04:38
版本的去向取决于你想要的灵活性。这里有一些想法。
'one note per file
Dim note As XElement
note = <note formatVersion="1.1">
<block>
<text>some text _some text_ **some text**</text>
</block>
<block>
<image path="XXXXX_XXX_XXX.png"/>
</block>
</note>
'multiple notes per file
Dim notes As XElement
notes = <notes formatVersion="1.1">
<note noteName="one">
<block>
<text>some text _some text_ **some text**</text>
</block>
<block>
<image path="XXXXX_XXX_XXX.png"/>
</block>
</note>
<note noteName="two">
<block>
<text>some text _some text_ **some text**</text>
</block>
<block>
<image path="XXXXX_XXX_XXX.png"/>
</block>
</note>
</notes>
在多笔记示例中,您可以向每个笔记添加版本控制。
https://stackoverflow.com/questions/38422094
复制相似问题