-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more whitespace sensitive ISource types knowing about the XML spec
see #39
- Loading branch information
Showing
9 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/net-core/Input/XmlElementContentWhitespaceStrippedSource.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
This file is licensed to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
using Org.XmlUnit.Util; | ||
|
||
namespace Org.XmlUnit.Input { | ||
|
||
/// <summary> | ||
/// A source that is obtained from a different source by removing all | ||
/// text nodes that only contain whitespace. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// Unlike <see cref="ElementContentWhitespaceStrippedSource"/> | ||
/// this class uses XML's idea of whitespace rather than the more | ||
/// extensive set considered whitespace by Unicode. | ||
/// </para> | ||
/// <para> | ||
/// since XMLUnit 2.10.0 | ||
/// </para> | ||
/// </remarks> | ||
public class XmlElementContentWhitespaceStrippedSource : DOMSource { | ||
/// <summary> | ||
/// Creates a new source that consists of the given source with all | ||
/// text nodes that only contain whitespace stripped. | ||
/// </summary> | ||
/// <param name="originalSource">source with the original content</param> | ||
public XmlElementContentWhitespaceStrippedSource(ISource originalSource) : | ||
base(Nodes.StripXmlElementContentWhitespace(originalSource.ToDocument())) { | ||
SystemId = originalSource.SystemId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
This file is licensed to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
using Org.XmlUnit.Util; | ||
|
||
namespace Org.XmlUnit.Input { | ||
|
||
/// <summary> | ||
/// A source that is obtained from a different source by removing | ||
/// all empty text nodes and normalizing the non-empty ones. | ||
/// </summary> | ||
/// <remarks> | ||
/// <para> | ||
/// "normalized" in this context means all XML whitespace | ||
/// characters are replaced by space characters and | ||
/// consecutive XML whitespace characters are collapsed. | ||
/// </para> | ||
/// <para> | ||
/// This class is similiar to <see cref="XmlWhitespaceStrippedSource"/> | ||
/// but in addition "normalizes" XML whitespace. | ||
/// </para> | ||
/// <para> | ||
/// Unlike <see cref="WhitespaceNormalizedSource"/> this uses XML's idea | ||
/// of whitespace rather than the more extensive set considered | ||
/// whitespace by Unicode. | ||
/// </para> | ||
/// <para> | ||
/// since XMLUnit 2.10.0 | ||
/// </para> | ||
/// </remarks> | ||
public class XmlWhitespaceNormalizedSource : DOMSource { | ||
/// <summary> | ||
/// Creates a new Source with the same content as another source normalizing XML whitespace in Text nodes. | ||
/// </summary> | ||
/// <param name="originalSource">source with the original content</param> | ||
public XmlWhitespaceNormalizedSource(ISource originalSource) : | ||
base(Nodes.NormalizeXmlWhitespace(originalSource.ToDocument())) | ||
{ | ||
SystemId = originalSource.SystemId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters