From: <bo...@us...> - 2009-05-11 08:49:14
|
Revision: 312 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=312&view=rev Author: bodewig Date: 2009-05-11 08:49:05 +0000 (Mon, 11 May 2009) Log Message: ----------- Add classes corresponding to Java's Source implementations where ReaderSource corresponds to StAXSource Modified Paths: -------------- trunk/xmlunit/src/main/net-core/ISource.cs trunk/xmlunit/src/main/net-core/builder/Input.cs Added Paths: ----------- trunk/xmlunit/src/main/net-core/input/ trunk/xmlunit/src/main/net-core/input/AbstractSource.cs trunk/xmlunit/src/main/net-core/input/DOMSource.cs trunk/xmlunit/src/main/net-core/input/ReaderSource.cs trunk/xmlunit/src/main/net-core/input/StreamSource.cs Modified: trunk/xmlunit/src/main/net-core/ISource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/ISource.cs 2009-05-04 15:43:53 UTC (rev 311) +++ trunk/xmlunit/src/main/net-core/ISource.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -1,7 +1,4 @@ /* - Licensed to the XMLUnit developers under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. 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 Modified: trunk/xmlunit/src/main/net-core/builder/Input.cs =================================================================== --- trunk/xmlunit/src/main/net-core/builder/Input.cs 2009-05-04 15:43:53 UTC (rev 311) +++ trunk/xmlunit/src/main/net-core/builder/Input.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -1,7 +1,4 @@ /* - Licensed to the XMLUnit developers under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. 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 @@ -14,22 +11,11 @@ See the License for the specific language governing permissions and limitations under the License. */ +using net.sf.xmlunit.input; using System.Xml; namespace net.sf.xmlunit.builder { public static class Input { - internal class Source : ISource { - private readonly XmlReader reader; - internal Source(XmlReader r) { - reader = r; - } - public XmlReader Reader { - get { - return reader; - } - } - } - public interface IBuilder { ISource Build(); } @@ -37,7 +23,7 @@ internal class DOMBuilder : IBuilder { private readonly ISource source; internal DOMBuilder(XmlDocument d) { - source = new Source(new XmlNodeReader(d)); + source = new DOMSource(d); } public ISource Build() { return source; Added: trunk/xmlunit/src/main/net-core/input/AbstractSource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/input/AbstractSource.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/input/AbstractSource.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -0,0 +1,28 @@ +/* + 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 System.Xml; + +namespace net.sf.xmlunit.input { + public abstract class AbstractSource : ISource { + private readonly XmlReader reader; + protected AbstractSource(XmlReader r) { + reader = r; + } + public XmlReader Reader { + get { + return reader; + } + } + } +} Added: trunk/xmlunit/src/main/net-core/input/DOMSource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/input/DOMSource.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/input/DOMSource.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -0,0 +1,22 @@ +/* + 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 System.Xml; + +namespace net.sf.xmlunit.input { + public class DOMSource : AbstractSource { + public DOMSource(XmlNode node) + : base(new XmlNodeReader(node)) { + } + } +} Added: trunk/xmlunit/src/main/net-core/input/ReaderSource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/input/ReaderSource.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/input/ReaderSource.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -0,0 +1,22 @@ +/* + 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 System.Xml; + +namespace net.sf.xmlunit.input { + public class ReaderSource : AbstractSource { + public ReaderSource(XmlReader rdr) + : base(rdr) { + } + } +} Added: trunk/xmlunit/src/main/net-core/input/StreamSource.cs =================================================================== --- trunk/xmlunit/src/main/net-core/input/StreamSource.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/input/StreamSource.cs 2009-05-11 08:49:05 UTC (rev 312) @@ -0,0 +1,31 @@ +/* + 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 System.IO; +using System.Xml; + +namespace net.sf.xmlunit.input { + public class StreamSource : AbstractSource { + public StreamSource(TextReader rdr) + : base(XmlReader.Create(rdr)) { + } + + public StreamSource(Stream stream) + : base(XmlReader.Create(stream)) { + } + + public StreamSource(string uri) + : base(XmlReader.Create(uri)) { + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |