File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed
OpenStackNetAnalyzers/OpenStackNetAnalyzers Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -177,15 +177,30 @@ private static bool IsUnnecessaryParaElement(XmlElementSyntax elementSyntax)
177177 if ( ! IsParaElement ( elementSyntax ) )
178178 return false ;
179179
180- if ( elementSyntax . Content . Count != 1 )
181- return false ;
182-
183- if ( ! IsParaElement ( elementSyntax . Content [ 0 ] as XmlElementSyntax ) )
180+ if ( HasLooseContent ( elementSyntax . Content ) )
184181 return false ;
185182
186183 return true ;
187184 }
188185
186+ private static bool HasLooseContent ( SyntaxList < XmlNodeSyntax > content )
187+ {
188+ foreach ( XmlNodeSyntax node in content )
189+ {
190+ XmlTextSyntax textSyntax = node as XmlTextSyntax ;
191+ if ( textSyntax != null )
192+ {
193+ if ( textSyntax . TextTokens . Any ( token => ! string . IsNullOrWhiteSpace ( token . ValueText ) ) )
194+ return true ;
195+ }
196+
197+ if ( node is XmlCDataSectionSyntax )
198+ return true ;
199+ }
200+
201+ return false ;
202+ }
203+
189204 private static bool HasAttributes ( XmlElementSyntax syntax )
190205 {
191206 return syntax . StartTag ? . Attributes . Count > 0 ;
You can’t perform that action at this time.
0 commit comments