Beispiel #1
0
        public static void Run()
        {
            var po = XRootNamespace
                     .Load("../../Data/po1.xml")
                     .purchaseOrder;

            po.billTo = po.shipTo;
            po.CompareWithBaseline("XsdPrimer");
        }
 public static XRootNamespace Load(string xmlFile, LoadOptions options)
 {
     var root = new XRootNamespace {
                               _doc = XDocument.Load(xmlFile, options)
                             };
       var typedRoot = XTypedServices.ToXTypedElement(root._doc.Root, LinqToXsdTypeManager.Instance);
       if ((typedRoot == null))
       {
     throw new LinqToXsdException("Invalid root element in xml document.");
       }
       root._rootObject = typedRoot;
       return root;
 }
Beispiel #3
0
    public static XRootNamespace Load(string xmlFile, LoadOptions options)
    {
        XRootNamespace root = new XRootNamespace();

        root.doc = XDocument.Load(xmlFile, options);
        XTypedElement typedRoot = XTypedServices.ToXTypedElement(root.doc.Root, LinqToXsdTypeManager.Instance);

        if ((typedRoot == null))
        {
            throw new LinqToXsdException("Invalid root element in xml document.");
        }
        root.rootObject = typedRoot;
        return(root);
    }
Beispiel #4
0
        public static void Run()
        {
            var root =
                new XRootNamespace(
                    new PurchaseOrder {
                CustId = "0815",
                Item   = new Item[] {
                    new Item {
                        ProdId   = "1234",
                        Price    = 37,
                        Quantity = 2
                    },
                    new Item {
                        ProdId   = "5678",
                        Price    = 1.5,
                        Quantity = 3
                    }
                }
            });

            root.XDocument.Root.CompareWithBaseline("New.xml");
        }
Beispiel #5
0
 public static XRootNamespace Parse(string text, LoadOptions options)
 {
     XRootNamespace root = new XRootNamespace();
     root.doc = XDocument.Parse(text, options);
     XTypedElement typedRoot = XTypedServices.ToXTypedElement(root.doc.Root, LinqToXsdTypeManager.Instance);
     if ((typedRoot == null)) {
         throw new LinqToXsdException("Invalid root element in xml document.");
     }
     root.rootObject = typedRoot;
     return root;
 }
Beispiel #6
0
 public static XRootNamespace Load(XmlReader xmlReader)
 {
     XRootNamespace root = new XRootNamespace();
     root.doc = XDocument.Load(xmlReader);
     XTypedElement typedRoot = XTypedServices.ToXTypedElement(root.doc.Root, LinqToXsdTypeManager.Instance);
     if ((typedRoot == null)) {
         throw new LinqToXsdException("Invalid root element in xml document.");
     }
     root.rootObject = typedRoot;
     return root;
 }
Beispiel #7
0
 public static void Run()
 {
     var root =
         new XRootNamespace(
             new PurchaseOrder {
                 CustId = "0815",
                 Item = new Item[] {
                     new Item {
                         ProdId = "1234",
                         Price = 37,
                         Quantity = 2 },
                     new Item {
                         ProdId = "5678",
                         Price = 1.5,
                         Quantity = 3 }}});
     root.XDocument.Root.CompareWithBaseline("New.xml");
 }
 public static XRootNamespace Load(TextReader textReader)
 {
     var root = new XRootNamespace
            {
              _xDocument = XDocument.Load(textReader)
            };
       var typedRoot = XTypedServices.ToXTypedElement(root._xDocument.Root, LinqToXsdTypeManager.Instance);
       if ((typedRoot == null))
       {
     throw new LinqToXsdException("Invalid root element in xml document.");
       }
       root._rootObject = typedRoot;
       return root;
 }