Partager via


I'm back - and an XML Editor tip (by yag)

It's been way too long since I've blogged. I was off on a family trip in Europe for 3 weeks, and wrapped that with customer meetings the week before and after. It's taken a while to get back into the swing of things - but here I am.

I thought I'd start off with a little XML Editor tip that came up the other day. We got a question based on Ken's Channel9 video on the XML tools that asked why the XML Editor would reformat a Word doc that had been saved as XML.

The answer is that Word documents insert an xml:space="preserve" on the root level XML element. That setting makes all whitespace (including the lack thereof) significant - a change to the whitespace could break the semantics of the document. Our editor sees that and doesn't make the change that is needed to do the reformat.

If you are willing to do it (at your own risk), you can delete the xml:space="preserve" attribute. This may change the doc in Word, however, but if you're doing this just to learn more about XML and the tools in VS2005 (which this person was doing), it should be fine. Just don't save it back. <g>

One other note - to fine the xml:space="preserve" more easily, you can turn on word wrapping if you want by going to Tool/Options/TextEditor/XML in VS2005.