Информация об изменениях

Сообщение Re[15]: API и слоёные архитектуры от 14.09.2016 17:33

Изменено 14.09.2016 18:18 Arsen.Shnurkov

S> XmlDocument.PreserveWhitespace = true; + XmlWhitespace и IXmlLineInfo для форматирования новых тегов / атрибутов.

Там же написано, что в точности всё равно не получается, потому что расположение атрибутов относительно элемента может быть изменено.

Mind that PreserveWhitespace preserves only elements indentation. If you have attributes in new lines or multiline values they will be reformatted.


Ещё есть SaveOptions.DisableFormatting, надо попробовать...

Но говорят, что надо переписать XmlWriter:

I believe that LoadOptions.PreserveWhitespace and SaveOptions.DisableFormatting only instruct XDocument on how to handle whitespace in terms of indentation and the content of text nodes. It would still normalize the attributes, etc.
You may wish to use an overload where you specify an XmlWriter that is configured to do what you want, and if you can't find a configuration that works with the default XmlTextWriter, you could always create your own XmlWriter.


http://rsdn.org/Forum/NewMsg.aspx?mid=6550021
Автор: marcopolo
Дата: 12.09.16


XDocument.Save has a SaveOptions argument which can be set to disable formatting. This has the same effect as putting the XmlWriterSettings "Indent" property to "false"




У меня мысль была — раз рослин служит для создания редакторов разных синтаксисов,
то научиться описывать синтсаксис .csproj для Roslyn как платформы.
Re[15]: API и слоёные архитектуры
S> XmlDocument.PreserveWhitespace = true; + XmlWhitespace и IXmlLineInfo для форматирования новых тегов / атрибутов.

Там же написано, что в точности всё равно не получается, потому что расположение атрибутов относительно элемента может быть изменено.

Mind that PreserveWhitespace preserves only elements indentation. If you have attributes in new lines or multiline values they will be reformatted.


Ещё есть SaveOptions.DisableFormatting, надо попробовать...

Но говорят, что надо переписать XmlWriter:

I believe that LoadOptions.PreserveWhitespace and SaveOptions.DisableFormatting only instruct XDocument on how to handle whitespace in terms of indentation and the content of text nodes. It would still normalize the attributes, etc.
You may wish to use an overload where you specify an XmlWriter that is configured to do what you want, and if you can't find a configuration that works with the default XmlTextWriter, you could always create your own XmlWriter.


http://www.codeproject.com/Articles/73083/Common-Pitfalls-in-System-Xml

XDocument.Save has a SaveOptions argument which can be set to disable formatting. This has the same effect as putting the XmlWriterSettings "Indent" property to "false"




У меня мысль была — раз рослин служит для создания редакторов разных синтаксисов,
то научиться описывать синтсаксис .csproj для Roslyn как платформы.