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

            if (errorInfoDocument != null)
            {
                XmlFormatter formatter = new XmlFormatter(errorInfoDocument);
                formatter.FormatLoop(errorInfoDocument);
            }
        }
        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));
        }
        private XmlNode CreateCloneInTargetDocument(XmlNode sourceNode)
        {
            XmlFileInfoDocument infoDocument = TargetDocument as XmlFileInfoDocument;
            XmlNode             clonedNode;

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

            ScrubTransformAttributesAndNamespaces(clonedNode);

            return(clonedNode);
        }
Example #4
0
 private XmlFormatter(XmlFileInfoDocument document)
 {
     this.document         = document;
     this.originalFileName = document.FileName;
 }
Example #5
0
 internal XmlFileInfoAttribute(string prefix, string localName, string namespaceUri, XmlFileInfoDocument document)
     : base(prefix, localName, namespaceUri, document)
 {
     lineNumber   = document.CurrentLineNumber;
     linePosition = document.CurrentLinePosition;
 }
Example #6
0
            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();
                }
            }
Example #7
0
 public XmlNodeException(string message, XmlNode node)
     : base(message)
 {
     this.lineInfo = node as IXmlLineInfo;
     this.document = node.OwnerDocument as XmlFileInfoDocument;
 }
Example #8
0
 public XmlNodeException(Exception innerException, XmlNode node)
     : base(innerException.Message, innerException)
 {
     this.lineInfo = node as IXmlLineInfo;
     this.document = node.OwnerDocument as XmlFileInfoDocument;
 }