コード例 #1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <remarks> 
 /// Note that we are re-using the token reader, so we'll swap out the XamlParser that
 /// the token reader uses with ourself.  Then restore it when we're done parsing. 
 /// </remarks> 
 internal TemplateXamlParser(
     XamlTreeBuilder  treeBuilder, 
     XamlReaderHelper       tokenReader,
     ParserContext    parserContext) : this(tokenReader, parserContext)
 {
     _treeBuilder      = treeBuilder; 
 }
コード例 #2
0
ファイル: XamlSerializer.cs プロジェクト: JianwenSun/cc
        /// <summary>
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information.
        /// </summary>
#if !PBTCOMPILER
        //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif        
        internal virtual void ConvertXamlToBaml (
            XamlReaderHelper          tokenReader,
            ParserContext       context,
            XamlNode            xamlNode,
            BamlRecordWriter    bamlWriter)
        {
            throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
        }
コード例 #3
0
ファイル: XamlSerializer.cs プロジェクト: yk2012985/wpf
        /// <summary>
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information.
        /// </summary>
#if !PBTCOMPILER
        //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif
        internal virtual void ConvertXamlToBaml(
            XamlReaderHelper tokenReader,
            ParserContext context,
            XamlNode xamlNode,
            BamlRecordWriter bamlWriter)
        {
            throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
        }
コード例 #4
0
ファイル: XamlSerializer.cs プロジェクト: zsd4yr/wpf
 /// <summary>
 ///   Convert from Xaml read by a token reader into a live
 ///   object tree.  The context gives mapping information.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertXamlToObject(
     XamlReaderHelper tokenReader,
     ReadWriteStreamManager streamManager,
     ParserContext context,
     XamlNode xamlNode,
     BamlRecordReader reader)
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
コード例 #5
0
ファイル: XamlSerializer.cs プロジェクト: JianwenSun/cc
 /// <summary>
 ///   Convert from Xaml read by a token reader into a live
 ///   object tree.  The context gives mapping information.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertXamlToObject (
     XamlReaderHelper             tokenReader,
     ReadWriteStreamManager streamManager,
     ParserContext          context,
     XamlNode               xamlNode,
     BamlRecordReader       reader)
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
コード例 #6
0
        /// <summary> 
        /// Constructor.
        /// </summary>
        /// <remarks>
        /// Note that we are re-using the token reader, so we'll swap out the XamlParser that 
        /// the token reader uses with ourself.  Then restore it when we're done parsing.
        /// </remarks> 
        internal TemplateXamlParser( 
            XamlReaderHelper      tokenReader,
            ParserContext   parserContext) 
        {
            TokenReader       = tokenReader;
            ParserContext     = parserContext;
 
            _previousXamlParser = TokenReader.ControllingXamlParser;
            TokenReader.ControllingXamlParser = this; 
            _startingDepth = TokenReader.XmlReader.Depth; 
        }
コード例 #7
0
        /// <summary>
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information.
        /// </summary>
        internal override void ConvertXamlToBaml (
            XamlReaderHelper             tokenReader,
            ParserContext          context,
            XamlNode               xamlNode,
            BamlRecordWriter       bamlWriter)
        {

            TemplateXamlParser templateParser = new TemplateXamlParser(tokenReader, context);
            templateParser.ParserHooks = _parserHooks;
            templateParser.BamlRecordWriter = bamlWriter;

            // Process the xamlNode that is passed in so that the <Template> element is written to baml
            templateParser.WriteElementStart((XamlElementStartNode)xamlNode);

            // Parse the entire Template section now, writing everything out directly to BAML.
            templateParser.Parse();
       }
コード例 #8
0
        /// <summary>
        ///   Convert from Xaml read by a token reader into baml being written
        ///   out by a record writer.  The context gives mapping information.
        /// </summary>
        internal override void ConvertXamlToBaml(
            XamlReaderHelper tokenReader,
            ParserContext context,
            XamlNode xamlNode,
            BamlRecordWriter bamlWriter)
        {
            TemplateXamlParser templateParser = new TemplateXamlParser(tokenReader, context);

            templateParser.ParserHooks      = _parserHooks;
            templateParser.BamlRecordWriter = bamlWriter;

            // Process the xamlNode that is passed in so that the <Template> element is written to baml
            templateParser.WriteElementStart((XamlElementStartNode)xamlNode);

            // Parse the entire Template section now, writing everything out directly to BAML.
            templateParser.Parse();
        }
コード例 #9
0
ファイル: XamlParser.cs プロジェクト: JianwenSun/cc
        protected XamlParser(
            ParserContext parserContext,
            BamlRecordWriter bamlWriter,
            XmlTextReader textReader) : this(parserContext, bamlWriter)
        {

            // When the XML 1.0 specification was authored, security was not a top concern, and as a result DTDs have the
            // unfortunate capability of severe Denial of Service (DoS) attacks, typically through the use of an internal
            // entity expansion technique. In System.Xml V2.0, in order to provide protection against DTD DoS attacks there
            // is the capability of turning off DTD parsing through the use of the ProhibitDtd property.

            textReader.ProhibitDtd = true;

            XmlCompatibilityReader xcr = new XmlCompatibilityReader(textReader,
                                                                    new IsXmlNamespaceSupportedCallback(IsXmlNamespaceSupported),
                                                                    _predefinedNamespaces );

            TokenReader = new XamlReaderHelper(this,parserContext,xcr);
        }