本文整理汇总了C#中System.Xml.XmlTextReaderImpl类的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReaderImpl类的具体用法?C# XmlTextReaderImpl怎么用?C# XmlTextReaderImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlTextReaderImpl类属于System.Xml命名空间,在下文中一共展示了XmlTextReaderImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInnerXmlReader
private XmlReader CreateInnerXmlReader(string xmlFragment, XmlNodeType nt, XmlParserContext context, XmlDocument doc)
{
XmlNodeType fragType = nt;
switch (fragType)
{
case XmlNodeType.Entity:
case XmlNodeType.EntityReference:
fragType = XmlNodeType.Element;
break;
}
XmlTextReaderImpl reader = new XmlTextReaderImpl(xmlFragment, fragType, context) {
XmlValidatingReaderCompatibilityMode = true
};
if (doc.HasSetResolver)
{
reader.XmlResolver = doc.GetResolver();
}
if (!doc.ActualLoadingStatus)
{
reader.DisableUndeclaredEntityCheck = true;
}
XmlDocumentType documentType = doc.DocumentType;
if (documentType != null)
{
reader.Namespaces = documentType.ParseWithNamespaces;
if (documentType.DtdSchemaInfo != null)
{
reader.SetDtdInfo(documentType.DtdSchemaInfo);
}
else
{
IDtdParser parser = DtdParser.Create();
XmlTextReaderImpl.DtdParserProxy adapter = new XmlTextReaderImpl.DtdParserProxy(reader);
IDtdInfo newDtdInfo = parser.ParseFreeFloatingDtd(context.BaseURI, context.DocTypeName, context.PublicId, context.SystemId, context.InternalSubset, adapter);
documentType.DtdSchemaInfo = newDtdInfo as SchemaInfo;
reader.SetDtdInfo(newDtdInfo);
}
}
if ((nt == XmlNodeType.Entity) || (nt == XmlNodeType.EntityReference))
{
reader.Read();
reader.ResolveEntity();
}
return reader;
}
示例2: CreateReader
public XmlReader CreateReader(Stream stream, string baseUri) {
XmlReader reader;
if (xmlReaderSettings != null) {
reader = XmlTextReader.Create(stream, xmlReaderSettings, baseUri);
} else {
XmlTextReaderImpl readerImpl = new XmlTextReaderImpl(baseUri, stream, xmlNameTable);
readerImpl.EntityHandling = entityHandling;
readerImpl.Namespaces = namespaces;
readerImpl.Normalization = normalization;
readerImpl.DtdProcessing = prohibitDtd ? DtdProcessing.Prohibit : DtdProcessing.Parse;
readerImpl.WhitespaceHandling = whitespaceHandling;
readerImpl.XmlResolver = xmlResolver;
reader = readerImpl;
}
if (validatingReader) {
#pragma warning disable 618
reader = new XmlValidatingReader(reader);
#pragma warning restore 618
}
return reader;
}
示例3: XmlTextReader
public XmlTextReader( string url, TextReader input ) {
impl = new XmlTextReaderImpl( url, input );
impl.OuterReader = this;
}
示例4: CreateSqlReader
internal static XmlReader CreateSqlReader(Stream input, XmlReaderSettings settings, XmlParserContext inputContext)
{
XmlReader reader;
int num2;
if (input == null)
{
throw new ArgumentNullException("input");
}
if (settings == null)
{
settings = new XmlReaderSettings();
}
byte[] buffer = new byte[CalcBufferSize(input)];
int offset = 0;
do
{
num2 = input.Read(buffer, offset, buffer.Length - offset);
offset += num2;
}
while ((num2 > 0) && (offset < 2));
if (((offset >= 2) && (buffer[0] == 0xdf)) && (buffer[1] == 0xff))
{
if (inputContext != null)
{
throw new ArgumentException(Res.GetString("XmlBinary_NoParserContext"), "inputContext");
}
reader = new XmlSqlBinaryReader(input, buffer, offset, string.Empty, settings.CloseInput, settings);
}
else
{
reader = new XmlTextReaderImpl(input, buffer, offset, settings, null, string.Empty, inputContext, settings.CloseInput);
}
if (settings.ValidationType != ValidationType.None)
{
reader = settings.AddValidation(reader);
}
return reader;
}
示例5: CreateSqlReader
// !!!!!!
// NOTE: This method is called via reflection from System.Data.dll and from Analysis Services in Yukon.
// Do not change its signature without notifying the appropriate teams!
// !!!!!!
internal static XmlReader CreateSqlReader(Stream input, XmlReaderSettings settings, XmlParserContext inputContext) {
if (input == null) {
throw new ArgumentNullException("input");
}
if (settings == null) {
settings = new XmlReaderSettings();
}
XmlReader reader;
// allocate byte buffer
byte[] bytes = new byte[CalcBufferSize(input)];
#if false
{
// catch the binary XML input and dump it into a local file (for debugging and testing purposes)
// create dump file name
string dumpFileNameBase = "~CreateSqlReaderInputDump";
string dumpFileName;
int i = 0;
do {
i++;
dumpFileName = Path.GetFullPath(string.Concat(dumpFileNameBase, i.ToString(), ".bmx"));
} while (File.Exists(dumpFileName));
// dump the input into the file
FileStream fs = new FileStream(dumpFileName, FileMode.Create, FileAccess.ReadWrite);
byte[] buffer = new byte[4096];
int bytesRead;
while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) {
fs.Write(buffer, 0, bytesRead);
}
fs.Seek(0, SeekOrigin.Begin);
// make sure it will get closed
if (settings.CloseInput) {
input.Close();
}
input = fs;
settings = settings.Clone();
settings.CloseInput = true;
}
#endif
int byteCount = 0;
int read;
do {
read = input.Read(bytes, byteCount, bytes.Length - byteCount);
byteCount += read;
} while (read > 0 && byteCount < 2);
// create text or binary XML reader depenting on the stream first 2 bytes
if (byteCount >= 2 && (bytes[0] == 0xdf && bytes[1] == 0xff)) {
if ( inputContext != null )
throw new ArgumentException(Res.GetString(Res.XmlBinary_NoParserContext), "inputContext");
reader = new XmlSqlBinaryReader(input, bytes, byteCount, string.Empty, settings.CloseInput, settings);
}
else {
reader = new XmlTextReaderImpl(input, bytes, byteCount, settings, null, string.Empty, inputContext, settings.CloseInput);
}
// wrap with validating reader
if ( settings.ValidationType != ValidationType.None ) {
reader = settings.AddValidation( reader );
}
if (settings.Async) {
reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
}
return reader;
}
示例6: CreateReader
internal XmlReader CreateReader(String inputUri, XmlParserContext inputContext)
{
if (inputUri == null)
{
throw new ArgumentNullException(nameof(inputUri));
}
if (inputUri.Length == 0)
{
throw new ArgumentException(SR.XmlConvert_BadUri, nameof(inputUri));
}
// resolve and open the url
XmlResolver tmpResolver = this.GetXmlResolver();
if (tmpResolver == null)
{
tmpResolver = CreateDefaultResolver();
}
// create text XML reader
XmlReader reader = new XmlTextReaderImpl(inputUri, this, inputContext, tmpResolver);
// wrap with validating reader
if (this.ValidationType != ValidationType.None)
{
reader = AddValidation(reader);
}
if (_useAsync)
{
reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
}
return reader;
}
示例7: LoadDocument
//
// Input documents management
//
internal static XPathDocument LoadDocument(XmlTextReaderImpl reader)
{
reader.EntityHandling = EntityHandling.ExpandEntities;
reader.XmlValidatingReaderCompatibilityMode = true;
try
{
return new XPathDocument(reader, XmlSpace.Preserve);
}
finally
{
reader.Close();
}
}
示例8: XmlValidatingReaderImpl
// Initializes a new instance of XmlValidatingReaderImpl class with the specified arguments.
// This constructor is used when creating XmlValidatingReaderImpl reader via "XmlReader.Create(..)"
internal XmlValidatingReaderImpl( XmlReader reader, ValidationEventHandler settingsEventHandler, bool processIdentityConstraints) {
XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader;
if (asyncCheckReader != null) {
reader = asyncCheckReader.CoreReader;
}
outerReader = this;
coreReader = reader;
coreReaderImpl = reader as XmlTextReaderImpl;
if ( coreReaderImpl == null ) {
XmlTextReader tr = reader as XmlTextReader;
if ( tr != null ) {
coreReaderImpl = tr.Impl;
}
}
if ( coreReaderImpl == null ) {
throw new ArgumentException( Res.GetString( Res.Arg_ExpectingXmlTextReader ), "reader" );
}
coreReaderImpl.XmlValidatingReaderCompatibilityMode = true;
coreReaderNSResolver = reader as IXmlNamespaceResolver;
this.processIdentityConstraints = processIdentityConstraints;
#pragma warning disable 618
schemaCollection = new XmlSchemaCollection( coreReader.NameTable );
#pragma warning restore 618
schemaCollection.XmlResolver = GetResolver();
eventHandling = new ValidationEventHandling(this);
if (settingsEventHandler != null) {
eventHandling.AddHandler(settingsEventHandler);
}
coreReaderImpl.ValidationEventHandling = eventHandling;
coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse);
validationType = ValidationType.DTD;
SetupValidation( ValidationType.DTD );
}
示例9: XmlTextReader
public XmlTextReader(string url, Stream input)
{
_impl = new XmlTextReaderImpl(url, input);
_impl.OuterReader = this;
}
示例10: XmlValidatingReaderImpl
//
// Constructors
//
// Initializes a new instance of XmlValidatingReaderImpl class with the specified XmlReader.
// This constructor is used when creating XmlValidatingReaderImpl for V1 XmlValidatingReader
internal XmlValidatingReaderImpl(XmlReader reader)
{
XmlAsyncCheckReader asyncCheckReader = reader as XmlAsyncCheckReader;
if (asyncCheckReader != null)
{
reader = asyncCheckReader.CoreReader;
}
_outerReader = this;
_coreReader = reader;
_coreReaderNSResolver = reader as IXmlNamespaceResolver;
_coreReaderImpl = reader as XmlTextReaderImpl;
if (_coreReaderImpl == null)
{
XmlTextReader tr = reader as XmlTextReader;
if (tr != null)
{
_coreReaderImpl = tr.Impl;
}
}
if (_coreReaderImpl == null)
{
throw new ArgumentException(SR.Arg_ExpectingXmlTextReader, nameof(reader));
}
_coreReaderImpl.EntityHandling = EntityHandling.ExpandEntities;
_coreReaderImpl.XmlValidatingReaderCompatibilityMode = true;
_processIdentityConstraints = true;
#pragma warning disable 618
_schemaCollection = new XmlSchemaCollection(_coreReader.NameTable);
_schemaCollection.XmlResolver = GetResolver();
_eventHandling = new ValidationEventHandling(this);
_coreReaderImpl.ValidationEventHandling = _eventHandling;
_coreReaderImpl.OnDefaultAttributeUse = new XmlTextReaderImpl.OnDefaultAttributeUseDelegate(ValidateDefaultAttributeOnUse);
_validationType = ValidationType.Auto;
SetupValidation(ValidationType.Auto);
#pragma warning restore 618
}
示例11: SetupReader
private XmlTextReaderImpl SetupReader(XmlTextReaderImpl reader)
{
reader.EntityHandling = EntityHandling.ExpandEntities;
reader.XmlValidatingReaderCompatibilityMode = true;
return reader;
}
示例12: Parse
static internal SchemaInfo Parse( XmlTextReaderImpl tr, string baseUri, string docTypeName, string publicId, string systemId, string internalSubset ) {
XmlTextReaderImpl.DtdParserProxy dtdParserProxy = new XmlTextReaderImpl.DtdParserProxy( baseUri, docTypeName, publicId, systemId, internalSubset, tr );
dtdParserProxy.Parse( false );
return dtdParserProxy.DtdSchemaInfo;
}
示例13: CreateReader
internal XmlReader CreateReader(Stream input, Uri baseUri, string baseUriString, XmlParserContext inputContext) {
if (input == null) {
throw new ArgumentNullException("input");
}
if (baseUriString == null) {
if (baseUri == null) {
baseUriString = string.Empty;
}
else {
baseUriString = baseUri.ToString();
}
}
// create text XML reader
XmlReader reader = new XmlTextReaderImpl(input, null, 0, this, baseUri, baseUriString, inputContext, closeInput);
#if !SILVERLIGHT
// wrap with validating reader
if (this.ValidationType != ValidationType.None) {
reader = AddValidation(reader);
}
#endif
#if ASYNC
if (useAsync) {
reader = XmlAsyncCheckReader.CreateAsyncCheckWrapper(reader);
}
#endif
return reader;
}
示例14: ValidateDefaultAttributeOnUse
internal void ValidateDefaultAttributeOnUse(IDtdDefaultAttributeInfo defaultAttribute, XmlTextReaderImpl coreReader) {
SchemaAttDef attdef = defaultAttribute as SchemaAttDef;
if (attdef == null) {
return;
}
if (!attdef.DefaultValueChecked) {
SchemaInfo schemaInfo = coreReader.DtdInfo as SchemaInfo;
if (schemaInfo == null) {
return;
}
DtdValidator.CheckDefaultValue(attdef, schemaInfo, eventHandling, coreReader.BaseURI);
}
}
示例15: CreateReaderImpl
private static XmlReader CreateReaderImpl(Stream input, XmlReaderSettings settings, Uri baseUri, string baseUriStr,
XmlParserContext inputContext, bool closeInput) {
if (input == null) {
throw new ArgumentNullException("input");
}
if (baseUriStr == null) {
Debug.Assert(baseUri == null);
baseUriStr = string.Empty;
}
// create text XML reader
XmlReader reader = new XmlTextReaderImpl(input, null, 0, settings, baseUri, baseUriStr, inputContext, closeInput);
// wrap with validating reader
if ( settings.ValidationType != ValidationType.None ) {
reader = AddValidation(reader, settings);
}
return reader;
}