Ejemplo n.º 1
0
 public ValidationEngine(DocumentType dtd, IValidationClient client)
 {
     this.documentType=dtd;
     this.client=client;
 }
Ejemplo n.º 2
0
        public void Detach()
        {
            if ( document == null )
                return;

            document.NodeChanging-=new XmlNodeChangedEventHandler(NodeChanging);
            document.NodeChanged-=new XmlNodeChangedEventHandler(NodeChanged);
            document.NodeInserted-=new XmlNodeChangedEventHandler(NodeInserted);
            document.NodeRemoved-=new XmlNodeChangedEventHandler(NodeRemoved);

            documentType=null;
            quickFixer=null;
            nodeInfo=new InvalidNodeInfo();
            idTracker=new IdTracker();
            validationEngine=null;
        }
Ejemplo n.º 3
0
        public void Attach(XmlDocument doc, Uri baseUri)
        {
            Detach();
            this.document=doc;
            if ( doc.DocumentType == null )
                return;

            DTDParser dtp=new DTDParser();

            bool hasInternalSubset=doc.DocumentType.InternalSubset != null;
            bool internalSubsetOnly=doc.DocumentType.SystemId == null;

            if ( baseUri == null && !doc.BaseURI.Equals("") )
                baseUri=new Uri(doc.BaseURI);

            // TODO: H: shouldn't this use the doc's resolver?
            CustomXmlResolver cxr=new CustomXmlResolver(baseUri);
            dtp.XmlResolver=cxr;

            if ( hasInternalSubset )
            {
                InputSource ii=new InputSource(doc.DocumentType.InternalSubset);
                documentType=dtp.parseInternalSubset(ii, internalSubsetOnly);
            }

            if ( !internalSubsetOnly )
            {
                Uri doctypeUri=cxr.ResolveUri(baseUri, doc.DocumentType.SystemId);
                InputSource i=new InputSource(doctypeUri);
                if ( hasInternalSubset )
                    documentType=dtp.parseExternalSubset(i);
                else
                    documentType=dtp.parseExternalSubset(i, true);
            }

            validationEngine=new ValidationEngine(documentType, this);
            quickFixer=new QuickFixer(documentType);

            GetAllIdAndIdRefs();
            ValidateAllIdAndIdRefs();

            document.NodeChanging+=new XmlNodeChangedEventHandler(NodeChanging);
            document.NodeChanged+=new XmlNodeChangedEventHandler(NodeChanged);
            document.NodeInserted+=new XmlNodeChangedEventHandler(NodeInserted);
            document.NodeRemoved+=new XmlNodeChangedEventHandler(NodeRemoved);
        }
Ejemplo n.º 4
0
 public QuickFixValidator(DocumentType dtd)
 {
     documentType=dtd;
 }
Ejemplo n.º 5
0
 public QuickFixer(DocumentType documentType)
 {
     this.documentType=documentType;
 }
Ejemplo n.º 6
0
 // ********************************************************************
 // Methods -- utility
 // ********************************************************************
 void initGlobals()
 {
     dtd = new DocumentType();
     entityState = STATE_OUTSIDEDTD;
     readerStack = new Stack();
     initReaderGlobals();
     declaredElementTypes.Clear();
 }