예제 #1
0
        public static void Format(XmlDocument document)
        {
            XmlFileInfoDocument errorInfoDocument = document as XmlFileInfoDocument;

            if (errorInfoDocument != null)
            {
                XmlFormatter formatter = new XmlFormatter(errorInfoDocument);
                formatter.FormatLoop(errorInfoDocument);
            }
        }
예제 #2
0
        private string ConvertUriToFileName(XmlDocument xmlDocument)
        {
            string uri;
            XmlFileInfoDocument errorInfoDocument = xmlDocument as XmlFileInfoDocument;

            if (errorInfoDocument != null)
            {
                uri = errorInfoDocument.FileName;
            }
            else
            {
                uri = errorInfoDocument.BaseURI;
            }

            return(ConvertUriToFileName(uri));
        }
예제 #3
0
        private XmlNode CreateCloneInTargetDocument(XmlNode sourceNode)
        {
            XmlFileInfoDocument infoDocument = TargetDocument as XmlFileInfoDocument;
            XmlNode             clonedNode;

            if (infoDocument != null)
            {
                clonedNode = infoDocument.CloneNodeFromOtherDocument(sourceNode);
            }
            else
            {
                XmlReader reader = new XmlTextReader(new StringReader(sourceNode.OuterXml));
                clonedNode = TargetDocument.ReadNode(reader);
            }

            ScrubTransformAttributesAndNamespaces(clonedNode);

            return(clonedNode);
        }
예제 #4
0
 public XmlNodeException(string message, XmlNode node)
     : base(message)
 {
     this.lineInfo = node as IXmlLineInfo;
     this.document = node.OwnerDocument as XmlFileInfoDocument;
 }
예제 #5
0
 public XmlNodeException(Exception innerException, XmlNode node)
     : base(innerException.Message, innerException)
 {
     this.lineInfo = node as IXmlLineInfo;
     this.document = node.OwnerDocument as XmlFileInfoDocument;
 }
예제 #6
0
 private XmlFormatter(XmlFileInfoDocument document)
 {
     this.document         = document;
     this.originalFileName = document.FileName;
 }
 internal XmlFileInfoAttribute(string prefix, string localName, string namespaceUri, XmlFileInfoDocument document)
     : base(prefix, localName, namespaceUri, document)
 {
     lineNumber   = document.CurrentLineNumber;
     linePosition = document.CurrentLinePosition;
 }
            internal XmlFileInfoElement(string prefix, string localName, string namespaceUri, XmlFileInfoDocument document)
                : base(prefix, localName, namespaceUri, document)
            {
                lineNumber   = document.CurrentLineNumber;
                linePosition = document.CurrentLinePosition;
                isOriginal   = document.FirstLoad;

                if (document.PreservationProvider != null)
                {
                    preservationDict = document.PreservationProvider.GetDictAtPosition(lineNumber, linePosition - 1);
                }
                if (preservationDict == null)
                {
                    preservationDict = new XmlAttributePreservationDict();
                }
            }