vinertext xmldocumentを使用するときは、キャリッジリターンを取り外しますか?
質問
私はそれがそうであっても、その中にいくつかのテキストがそれに収益を持っていない理由を理解しようとしています。XMLDocumentを介してXPathingingを通過すると、キャリッジリターンまたはその他の文字をストリップします。おそらくそうではありませんが、この時点で私は何でも探しています。
解決
You haven't shown any code, so it's hard to know where the data came from. By default, insignificant whitespace is not preserved when loading an XmlDocument
. You might want to try setting XmlDocument.PreserveWhitespace
to true before loading.
If that doesn't help, please post a short but complete program which demonstrates the problem.
他のヒント
What's the xml:space
on the element? If you need to force it to be preserve whitespace other than significant whitespace, then you can set PreserveWhitespace
to true
before calling Load
or LoadXML
.
Be cautions with this though as in most cases the person writing the XML will expect the normal XML rules for whitespace to be followed. Even worse, if you get a "works for me" by using the non-standard rules that PreserveWhitespace
uses, there's no reason you should expect anyone else to parse it as you intend.