Skip to content

Commit

Permalink
Merge pull request dotnet#31 from sepidehMS/XmlWithCliInProgress
Browse files Browse the repository at this point in the history
Xml with cli in progress
  • Loading branch information
sepidehkh committed Jan 4, 2016
2 parents 85e7aa6 + 8d2a8c4 commit a85a390
Show file tree
Hide file tree
Showing 71 changed files with 180 additions and 579 deletions.
13 changes: 0 additions & 13 deletions XmlWithCli/src/XmlWithCli/System/Xml/Core/XmlReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Collections;
using System.Globalization;
using System.Xml.Schema;
using System.Runtime.Versioning;

#if SILVERLIGHT
using BufferBuilder=System.Xml.BufferBuilder;
Expand Down Expand Up @@ -1531,28 +1530,16 @@ private static XmlTextReaderImpl GetXmlTextReaderImpl(XmlReader reader) {
//

// Creates an XmlReader for parsing XML from the given Uri.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
public static XmlReader Create(string inputUri) {
return XmlReader.Create(inputUri, (XmlReaderSettings)null, (XmlParserContext)null);
}

// Creates an XmlReader according to the settings for parsing XML from the given Uri.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
public static XmlReader Create(string inputUri, XmlReaderSettings settings) {
return XmlReader.Create(inputUri, settings, (XmlParserContext)null);
}

// Creates an XmlReader according to the settings and parser context for parsing XML from the given Uri.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
public static XmlReader Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext) {
if (settings == null) {
settings = new XmlReaderSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Collections;
using System.Globalization;
using System.Xml.Schema;
using System.Runtime.Versioning;

using System.Threading.Tasks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.Xml.Schema;
using System.Xml.XmlConfiguration;
#endif
using System.Runtime.Versioning;

namespace System.Xml {

Expand Down Expand Up @@ -366,10 +365,6 @@ internal ValidationEventHandler GetEventHandler() {
#endif


#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
internal XmlReader CreateReader(String inputUri, XmlParserContext inputContext) {
if (inputUri == null) {
throw new ArgumentNullException("inputUri");
Expand Down
10 changes: 2 additions & 8 deletions XmlWithCli/src/XmlWithCli/System/Xml/Core/XmlTextReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
using System.Text;
using System.Xml.Schema;
using System.Collections;
using System.Security.Policy;
using System.Collections.Generic;
using System.Runtime.Versioning;

namespace System.Xml {

Expand Down Expand Up @@ -86,16 +84,12 @@ public XmlTextReader( string xmlFragment, XmlNodeType fragType, XmlParserContext
impl = new XmlTextReaderImpl( xmlFragment, fragType, context );
impl.OuterReader = this;
}

[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]

public XmlTextReader( string url ) {
impl = new XmlTextReaderImpl( url, new NameTable() );
impl.OuterReader = this;
}

[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]

public XmlTextReader( String url, XmlNameTable nt ) {
impl = new XmlTextReaderImpl( url, nt );
impl.OuterReader = this;
Expand Down
37 changes: 1 addition & 36 deletions XmlWithCli/src/XmlWithCli/System/Xml/Core/XmlTextReaderImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Globalization;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

#if SILVERLIGHT
using System.Reflection;
Expand Down Expand Up @@ -526,10 +525,6 @@ internal XmlTextReaderImpl( string url, TextReader input, XmlNameTable nt ) : th
// Initializes a new instance of XmlTextReaderImpl class for parsing fragments with the specified stream, fragment type and parser context
// This constructor is used when creating XmlTextReaderImpl for V1 XmlTextReader
// SxS: The method resolves URI but does not expose the resolved value up the stack hence Resource Exposure scope is None.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
internal XmlTextReaderImpl( Stream xmlFragment, XmlNodeType fragType, XmlParserContext context )
: this( ( context != null && context.NameTable != null ) ? context.NameTable : new NameTable() ) {

Expand Down Expand Up @@ -582,17 +577,9 @@ internal XmlTextReaderImpl( string xmlFragment, XmlParserContext context )

// Initializes a new instance of the XmlTextReaderImpl class with the specified url and XmlNameTable.
// This constructor is used when creating XmlTextReaderImpl for V1 XmlTextReader
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
public XmlTextReaderImpl( string url ) : this( url, new NameTable() ) {
}

#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
public XmlTextReaderImpl( string url, XmlNameTable nt ): this( nt ) {
if ( url == null ) {
throw new ArgumentNullException( "url" );
Expand Down Expand Up @@ -2197,10 +2184,6 @@ internal bool DtdParserProxy_V1CompatibilityMode {
internal Uri DtdParserProxy_BaseUri {
// SxS: ps.baseUri may be initialized in the constructor (public XmlTextReaderImpl( string url, XmlNameTable nt )) based on
// url provided by the user. Here the property returns ps.BaseUri - so it may expose a path.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
get {
if ( ps.baseUriStr.Length > 0 && ps.baseUri == null && xmlResolver != null ) {
ps.baseUri = xmlResolver.ResolveUri( null, ps.baseUriStr );
Expand Down Expand Up @@ -2383,10 +2366,6 @@ internal bool DtdParserProxy_PopEntity( out IDtdEntityInfo oldEntity, out int ne

// SxS: The caller did not provide any SxS sensitive name or resource. No resource is being exposed either.
// It is OK to suppress SxS warning.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
internal bool DtdParserProxy_PushExternalSubset( string systemId, string publicId ) {
Debug.Assert( parsingStatesStackTop == -1 );
Debug.Assert( ( systemId != null && systemId.Length > 0 ) || ( publicId != null && publicId.Length > 0 ) );
Expand Down Expand Up @@ -2809,9 +2788,7 @@ private void ProcessDtdFromParserContext(XmlParserContext context) {
}

#if !SILVERLIGHT // Needed only for XmlTextReader
// SxS: This method resolve Uri but does not expose it to the caller. It's OK to suppress the warning.
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
// SxS: This method resolve Uri but does not expose it to the caller. It's OK to suppress the warning.
private void OpenUrl() {
Debug.Assert( url != null && url.Length > 0 );
Debug.Assert( compressedStack != null );
Expand Down Expand Up @@ -7096,10 +7073,6 @@ private XmlNodeType GetTextNodeType( int orChars ) {

// This method resolves and opens an external DTD subset or an external entity based on its SYSTEM or PUBLIC ID.
// SxS: This method may expose a name if a resource in baseUri (ref) parameter.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
private void PushExternalEntityOrSubset( string publicId, string systemId, Uri baseUri, string entityName ) {
Uri uri;

Expand Down Expand Up @@ -7181,10 +7154,6 @@ private bool OpenAndPush( Uri uri ) {
// returns true if real entity has been pushed, false if fake entity (=empty content entity)
// SxS: The method neither takes any name of resource directly nor it exposes any resource to the caller.
// Entity info was created based on source document. It's OK to suppress the SxS warning
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
private bool PushExternalEntity( IDtdEntityInfo entity ) {
Debug.Assert( entity.IsExternal );

Expand Down Expand Up @@ -8463,10 +8432,6 @@ void InitBinHexDecoder() {
}

// SxS: URIs are resolved only to be compared. No resource exposure. It's OK to suppress the SxS warning.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
bool UriEqual( Uri uri1, string uri1Str, string uri2Str, XmlResolver resolver ) {
if (resolver == null) {
return uri1Str == uri2Str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Globalization;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;

using System.Threading.Tasks;

Expand Down Expand Up @@ -779,10 +778,6 @@ internal async Task< Tuple<int, bool> > DtdParserProxy_PushEntityAsync(IDtdEntit

// SxS: The caller did not provide any SxS sensitive name or resource. No resource is being exposed either.
// It is OK to suppress SxS warning.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
internal async Task< bool > DtdParserProxy_PushExternalSubsetAsync( string systemId, string publicId ) {
CheckAsyncCall();
Debug.Assert( parsingStatesStackTop == -1 );
Expand Down Expand Up @@ -4731,10 +4726,6 @@ private async Task< string > ParseEntityNameAsync() {

// This method resolves and opens an external DTD subset or an external entity based on its SYSTEM or PUBLIC ID.
// SxS: This method may expose a name if a resource in baseUri (ref) parameter.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif

private async Task PushExternalEntityOrSubsetAsync(string publicId, string systemId, Uri baseUri, string entityName) {

Expand Down Expand Up @@ -4825,10 +4816,6 @@ private async Task< bool > OpenAndPushAsync( Uri uri ) {
// returns true if real entity has been pushed, false if fake entity (=empty content entity)
// SxS: The method neither takes any name of resource directly nor it exposes any resource to the caller.
// Entity info was created based on source document. It's OK to suppress the SxS warning
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
#endif
private async Task< bool > PushExternalEntityAsync( IDtdEntityInfo entity ) {
Debug.Assert( entity.IsExternal );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using System.Runtime.Versioning;

#if SILVERLIGHT
using BufferBuilder=System.Xml.BufferBuilder;
Expand Down Expand Up @@ -194,10 +193,6 @@ IXmlNamespaceResolver IDtdParserAdapter.NamespaceResolver {
Uri IDtdParserAdapter.BaseUri {
// SxS: DtdParserProxy_BaseUri property on the reader may expose machine scope resources. This property
// is just returning the value of the other property, so it may expose machine scope resource as well.
#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
#endif
get { return reader.DtdParserProxy_BaseUri; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using System.Runtime.Versioning;

#if SILVERLIGHT
using BufferBuilder=System.Xml.BufferBuilder;
Expand Down
3 changes: 0 additions & 3 deletions XmlWithCli/src/XmlWithCli/System/Xml/Core/XmlTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using System.Text;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.Versioning;

namespace System.Xml {

Expand Down Expand Up @@ -272,8 +271,6 @@ public XmlTextWriter(Stream w, Encoding encoding) : this() {
}

// Creates an instance of the XmlTextWriter class using the specified file.
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
public XmlTextWriter(String filename, Encoding encoding)
: this(new FileStream(filename, FileMode.Create,
FileAccess.Write, FileShare.Read), encoding) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Security.Policy;
using System.Collections.Generic;
using System.Runtime.Versioning;

namespace System.Xml
{
Expand Down Expand Up @@ -150,8 +148,6 @@ internal XmlValidatingReaderImpl( XmlReader reader ) {
// Initializes a new instance of XmlValidatingReaderImpl class for parsing fragments with the specified string, fragment type and parser context
// This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader
// SxS: This method resolves an Uri but does not expose it to the caller. It's OK to suppress the SxS warning.
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
internal XmlValidatingReaderImpl( string xmlFragment, XmlNodeType fragType, XmlParserContext context )
: this( new XmlTextReader( xmlFragment, fragType, context ) )
{
Expand All @@ -168,8 +164,6 @@ internal XmlValidatingReaderImpl( string xmlFragment, XmlNodeType fragType, XmlP
// Initializes a new instance of XmlValidatingReaderImpl class for parsing fragments with the specified stream, fragment type and parser context
// This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader
// SxS: This method resolves an Uri but does not expose it to the caller. It's OK to suppress the SxS warning.
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
internal XmlValidatingReaderImpl( Stream xmlFragment, XmlNodeType fragType, XmlParserContext context )
: this( new XmlTextReader( xmlFragment, fragType, context ) )
{
Expand Down Expand Up @@ -882,8 +876,6 @@ private void ResolveEntityInternally() {
}

// SxS: This method resolves an Uri but does not expose it to caller. It's OK to suppress the SxS warning.
[ResourceConsumption(ResourceScope.Machine, ResourceScope.Machine)]
[ResourceExposure(ResourceScope.None)]
private void SetupValidation( ValidationType valType ) {
validator = BaseValidator.CreateInstance( valType, this, schemaCollection, eventHandling , processIdentityConstraints);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Security.Policy;
using System.Collections.Generic;
using System.Runtime.Versioning;

using System.Threading.Tasks;

Expand Down
5 changes: 0 additions & 5 deletions XmlWithCli/src/XmlWithCli/System/Xml/Core/XmlWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using System.Diagnostics;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Versioning;

namespace System.Xml {

Expand Down Expand Up @@ -594,15 +593,11 @@ private void WriteLocalNamespaces(XPathNavigator nsNav) {
//
#if !SILVERLIGHT
// Creates an XmlWriter for writing into the provided file.
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
public static XmlWriter Create(string outputFileName) {
return Create(outputFileName, null);
}

// Creates an XmlWriter for writing into the provided file with the specified settings.
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
public static XmlWriter Create(string outputFileName, XmlWriterSettings settings) {
if (settings == null) {
settings = new XmlWriterSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Diagnostics;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Versioning;

namespace System.Xml {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Runtime.Versioning;

#if !SILVERLIGHT
#if !HIDE_XSL
Expand Down Expand Up @@ -427,8 +426,6 @@ internal bool IsQuerySpecific {
#endif

#if !SILVERLIGHT
[ResourceConsumption(ResourceScope.Machine)]
[ResourceExposure(ResourceScope.Machine)]
internal XmlWriter CreateWriter(string outputFileName) {
if (outputFileName == null) {
throw new ArgumentNullException("outputFileName");
Expand All @@ -455,7 +452,7 @@ internal XmlWriter CreateWriter(string outputFileName) {
}
catch {
if (fs != null) {
fs.Close();
fs.Dispose();
}
throw;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using System.Diagnostics;
using System.Globalization;
using System.Collections;
using System.Security.Policy;

namespace System.Xml {

Expand Down
Loading

0 comments on commit a85a390

Please sign in to comment.