public ValidationEngine(DocumentType dtd, IValidationClient client) { this.documentType=dtd; this.client=client; }
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; }
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); }
public QuickFixValidator(DocumentType dtd) { documentType=dtd; }
public QuickFixer(DocumentType documentType) { this.documentType=documentType; }
// ******************************************************************** // Methods -- utility // ******************************************************************** void initGlobals() { dtd = new DocumentType(); entityState = STATE_OUTSIDEDTD; readerStack = new Stack(); initReaderGlobals(); declaredElementTypes.Clear(); }