Esempio n. 1
0
        private void Visit( XmlElement e )
        {
            int name = Schema.GetNameCode( e.NamespaceURI, e.LocalName );
            AttributesSet atts = new AttributesSet();
            atts.Reset(Schema,e);
            CurrentState = CurrentState.StartElement( name, atts, State.emptySet );
            if( CurrentState==State.emptySet )
                throw new DomValidationException( e, "unexpected start element" );

            ValidationContext context = new XmlElementContext(e);

            StringBuilder builder = new StringBuilder();
            foreach( XmlNode n in e.ChildNodes ) {
                if( n is XmlText || n is XmlCDataSection || n is XmlWhitespace) {
                    builder.Append( n.Value );
                    continue;
                }
                if( n is XmlElement ) {
                    ProcessText( builder, context, e, atts );
                    Visit( (XmlElement)n );
                }
            }

            ProcessText( builder, context, e, atts );

            CurrentState = CurrentState.EndElement(atts, State.emptySet );
            if( CurrentState==State.emptySet )
                throw new DomValidationException( e, "unexpected end element" );
        }