Beispiel #1
0
        public static DomDocument LoadXmlFileWithCreateDocument(
            System.IO.Stream stream,
            DomDocument sourceDocument)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            XmlSerializer ser = DocumentSaver.GetDocumentXmlSerializer(
                sourceDocument == null ? typeof(DomDocument) : sourceDocument.GetType());

            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(stream);
            reader.Normalization = false;
            DomDocument document = ( DomDocument )ser.Deserialize(reader);

            if (string.Compare(document.EditorVersionString, "1.1") < 0)
            {
                // 修复ListSource
            }
            if (sourceDocument != null)
            {
                document.ServerObject = sourceDocument.ServerObject;
                document.Options      = sourceDocument.Options;
            }
            document.AfterLoad(FileFormat.XML);
            return(document);
        }
Beispiel #2
0
        public static DomDocument LoadXmlFileWithCreateDocument(
            System.Xml.XmlReader reader,
            DomDocument sourceDocument)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            XmlSerializer ser = DocumentSaver.GetDocumentXmlSerializer(
                sourceDocument == null ? typeof(DomDocument) : sourceDocument.GetType());

            if (reader is System.Xml.XmlTextReader)
            {
                ((System.Xml.XmlTextReader)reader).Normalization = false;
            }
            DomDocument document = (DomDocument)ser.Deserialize(reader);

            if (sourceDocument != null)
            {
                document.ServerObject = sourceDocument.ServerObject;
                document.Options      = sourceDocument.Options;
            }
            document.AfterLoad(FileFormat.XML);
            return(document);
        }
Beispiel #3
0
        internal static DomDocument FastLoadXMLFile(System.IO.Stream stream, Type documentType)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }
            XmlSerializer ser = DocumentSaver.GetDocumentXmlSerializer(documentType);

            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(stream);
            reader.Normalization = false;
            DomDocument document = (DomDocument)ser.Deserialize(reader);

            if (string.Compare(document.EditorVersionString, "1.1") < 0)
            {
                // 修复ListSource
            }
            return(document);
        }