我有以下 XML 文件。如何从中删除不必要的空格?我尝试使用 XDocument.Save 并删除格式,但它不起作用。尝试解析文件时出现异常。本质上,我想规范化文本,使其不包含那些空格。我应该求助于正则表达式吗?
< ? xmlversion = "1 . 0" 编码 = "utf - 1 6" ?>
< n s 0 : C D I S c h e m a E r r o r x m l n s : n s 0 = " h t t p : / / M i c r o s o f t . I T . R e l a t i o n s h i p M a n a g e m e n t . S c h e m a s . P a r t n e r F u n d S u m m a r y S c h e m a E r r o r / V 1 " >
< E r r o r I n f o r m a t i o n > T h e r e w a s a f a i l u r e e x e c u t i n g t h e r e c e i v e p i p e l i n e : " s d f g t w . I T . R e l a t i o n s h i p M a n a g e m e n t . P i p e l i n e s . N o n C a s h P a y m e n t R e s p o n s e V 1 C S V T o X m l F i l e C o n v e r s i o n , t b f a e . I T . R e l a t i o n s h i p M a n a g e m e n t . P i p e l i n e s U R I : " D : \ t e s t u r l f o l d e r \ S u b S y s t e m \ S t a g i n g \ V I R P \ * . c s v " R e a s o n : T h e d o c u m e n t f a i l e d t o v a l i d a t e b e c a u s e o f t h e f o l l o w i n g e r r o r : " T h e ' R e f e r e n c e N u m b e r ' e l e m e n t h a s a n i n v a l i d v a l u e a c c o r d i n g t o i t s d a t a t y p e . " . < / E r r o r I n f o r m a t i o n >
< O r i g i n a l M e s s a g e > > Id,StatusCode,ReferenceNumber,DateTime,ErrorMessage
41977,0,12344,2011-08-29T15:16:06.120,blackety blah </ O riginal M essage > </ ns 0 : CDIS chema E rror >