maintaining format with xmlwrite

3 ビュー (過去 30 日間)
Rebecca McDonald
Rebecca McDonald 2019 年 3 月 14 日
編集済み: Jan 2019 年 3 月 19 日
I am able to read an XML file, search for element by tag name, make my changes, but when I use xmlwrite my format changes. For example, all of the skipped lines are removed and the order of the tag names are flipped. For example, after a certain tag name, Number = "1" Name = "R", it will show Name = "R" Number = "1". Does anyone know how maintain the format of an XML file after changing some of the information in it?

採用された回答

Jan
Jan 2019 年 3 月 14 日
編集済み: Jan 2019 年 3 月 19 日
This is not the purpose of the XML format. The parser must have the power to reorder the tags. Matlab's parser orders them alphabetically.
If you really want to conserve the order of tags, you treat the file as a text file, not as an XML object. Then the best idea it to omit the power of the XML format and perform simple text operations with the file. This hurts the idea of XML massively, but if it is your intention, do it.
  1 件のコメント
Rebecca McDonald
Rebecca McDonald 2019 年 3 月 19 日
I don't know much about XML file type. Your response is so helpful. Thank you for taking the time to help me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructured Data and XML Documents についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by