Exemple #1
0
        private static DomDataCollection AddDomDataCollection(DomDocument domDocument)
        {
            Contract.Requires(domDocument != null);

            // Add data collection node.
            var domDataCollection = domDocument.CreateAndAddNode(() => DomDataCollection.Create());

            return(domDataCollection);
        }
Exemple #2
0
        private static DomData AddDomData(DomDocument domDocument)
        {
            Contract.Requires(domDocument != null);

            // Add data node.
            var domData = domDocument.CreateAndAddNode(() => DomData.Create());

            return(domData);
        }
Exemple #3
0
        private static void ParseErrors(DomDocument domDocument, Document apiDocument)
        {
            Contract.Requires(domDocument != null);
            Contract.Requires(apiDocument != null);

            var errors = apiDocument.GetErrors();

            domDocument.CreateAndAddNode(() => DomReadOnlyErrors.Create(errors));
        }
Exemple #4
0
        private static void ParseDocumentLinks(DomDocument domDocument, Document apiDocument)
        {
            Contract.Requires(domDocument != null);
            Contract.Requires(apiDocument != null);

            if (apiDocument.HasLinks() == false)
            {
                return;
            }

            domDocument.CreateAndAddNode(() => DomReadOnlyLinks.Create(apiDocument));
        }
Exemple #5
0
        private static void ParseDocumentJsonApi(DomDocument domDocument, Document apiDocument)
        {
            Contract.Requires(domDocument != null);
            Contract.Requires(apiDocument != null);

            if (apiDocument.HasJsonApi() == false)
            {
                return;
            }

            domDocument.CreateAndAddNode(() => DomReadOnlyJsonApiVersion.Create(apiDocument));
        }
Exemple #6
0
        private static void ParseDocumentIncluded(DomDocument domDocument, Document apiDocument)
        {
            Contract.Requires(domDocument != null);
            Contract.Requires(apiDocument != null);

            if (apiDocument.IsIncludedNullOrEmpty())
            {
                return;
            }

            // Add included node.
            var domIncluded = domDocument.CreateAndAddNode(() => DomIncluded.Create());

            var includedResources = apiDocument.GetIncludedResources();

            foreach (var includedResource in includedResources)
            {
                var apiResource = includedResource;
                AddDomReadOnlyResource(domDocument, domIncluded, apiResource);
            }
        }