Exemple #1
0
 internal Unit(XbrlFragment fragment, INode UnitNode, INamespaceManager namespaceManager)
 {
     this.Fragment          = fragment;
     this.RegionInformation = null;
     thisUnitNode           = UnitNode;
     this.Id = thisUnitNode.Attributes["id"].Value;
     this.MeasureQualifiedNames = new List <QualifiedName>();
     this.Ratio = false;
     thisRatioNumeratorQualifiedNames   = new List <QualifiedName>();
     thisRatioDenominatorQualifiedNames = new List <QualifiedName>();
     this.namespaceManager = namespaceManager;
     foreach (INode CurrentChild in UnitNode.ChildNodes)
     {
         if (CurrentChild.LocalName.Equals("measure") == true)
         {
             this.MeasureQualifiedNames.Add(new QualifiedName(CurrentChild, namespaceManager));
         }
         else if (CurrentChild.LocalName.Equals("divide") == true)
         {
             ProcessDivideChildElement(CurrentChild);
             CheckForMeasuresCommonToNumeratorsAndDenominators();
             this.Ratio = true;
         }
     }
 }
Exemple #2
0
        public QueueFactory(INamespaceManager <T> namespaceManager,
                            ISerializationProvider serializationProvider,
                            ILogger <ClientBase <T> > logger,
                            IEnumerable <IMessageExtension <T> > extensions)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            if (serializationProvider == null)
            {
                throw new ArgumentNullException(nameof(serializationProvider));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            _namespaceManager      = namespaceManager;
            _serializationProvider = serializationProvider;
            _logger     = logger;
            _extensions = extensions;
        }
Exemple #3
0
        //-------------------------------------------------------------------------------
        //-------------------------------------------------------------------------------
        internal XbrlFragment(XbrlDocument ParentDocument, INamespaceManager namespaceManager, INode XbrlRootNode)
        {
            this.Document         = ParentDocument;
            this.NamespaceManager = namespaceManager;
            this.XbrlRootNode     = XbrlRootNode;
            this.Schemas          = new XbrlSchemaCollection();
            this.ValidationErrors = new List <ValidationError>();
            CreateNamespaceManager();
            //---------------------------------------------------------------------------
            // Load.
            //---------------------------------------------------------------------------
            ReadSchemaLocationAttributes();
            ReadTaxonomySchemaReferences();
            ReadRoleReferences();
            ReadArcroleReferences();
            ReadContexts();
            ReadUnits();
            ReadFacts();
            ReadFootnoteLinks();
            if (Loaded != null)
            {
                Loaded(this, null);
            }
            //---------------------------------------------------------------------------
            // Validate.
            //---------------------------------------------------------------------------
            var validator = new Xbrl2Dot1Validator();

            validator.Validate(this);
            if (Validated != null)
            {
                Validated(this, null);
            }
        }
Exemple #4
0
        public INode SelectSingleNode(string xPath, INamespaceManager namespaceManager)
        {
            var xmlNamespaceManager = (namespaceManager as NamespaceManager).XmlNamespaceManager;
            var xmlNode             = thisDocument.SelectSingleNode(xPath, xmlNamespaceManager);

            return(new Node(xmlNode));
        }
 public GenericServiceBusConfigurationFactory(IBusConfiguration configuration, IMessagingFactory messageFactory, INamespaceManager namespaceManager) {
     Guard.ArgumentNotNull(configuration, "configuration");
     Guard.ArgumentNotNull(messageFactory, "messageFactory");
     Guard.ArgumentNotNull(namespaceManager, "namespaceManager");
     this.configuration = configuration;
     this.MessageFactory = messageFactory;
     this.NamespaceManager = namespaceManager;
 }
Exemple #6
0
 internal QualifiedName(INode QnameNode, INamespaceManager namespaceManager)
 {
     InitializeLocalNameAndNamespace(QnameNode);
     if (this.Namespace.Length > 0)
     {
         InitializeNamespaceUri(QnameNode, namespaceManager);
     }
 }
        public void Setup()
        {
            var entitySerialier = A.Fake <IEntitySerializer>();

            this.writer     = new WriterSpy();
            this.mapper     = A.Fake <INamespaceManager>();
            this.serializer = new CompressingSerializerTestable(entitySerialier, this.writer, this.mapper);
        }
Exemple #8
0
 public INode SelectSingleNode(string xPath, INamespaceManager namespaceManager)
 {
     /*
      * var xmlNamespaceManager = (namespaceManager as NamespaceManager).XmlNamespaceManager;
      * var xmlNode = thisDocument.SelectSingleNode(xPath, xmlNamespaceManager);
      * return new Node(xmlNode);
      */
     return(null);
 }
Exemple #9
0
 //------------------------------------------------------------------------------------
 //------------------------------------------------------------------------------------
 internal LinkbaseDocument(string ContainingDocumentUri, string DocumentPath)
 {
     thisLinkbasePath = GetFullLinkbasePath(ContainingDocumentUri, DocumentPath);
     thisXmlDocument  = Container.Resolve <IDocument>();
     thisXmlDocument.Load(thisLinkbasePath);
     thisNamespaceManager          = Container.Resolve <INamespaceManager>();
     thisNamespaceManager.Document = thisXmlDocument;
     thisNamespaceManager.AddNamespace("default", XbrlDocument.XbrlLinkbaseNamespaceUri);
     thisLinkbaseNode = thisXmlDocument.SelectSingleNode("//default:linkbase", thisNamespaceManager);
 }
Exemple #10
0
        public INode SelectSingleNode(string xPath, INamespaceManager namespaceManager)
        {
            var selectedElement = doc.XPathSelectElement(xPath, (namespaceManager as NamespaceManager).XmlNamespaceManager);

            if (selectedElement != null)
            {
                var newNode = new Node(selectedElement);
                return(newNode);
            }
            return(null);
        }
        public ICanSpecifyAzureServiceBusMessagingFactory <TMessage, TCommand, TEvent, TRequest, TResponse> WithNamespaceManager(INamespaceManager namespaceManager)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException("namespaceManager");
            }

            _namespaceManager = namespaceManager;

            return(this);
        }
Exemple #12
0
 //-------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------
 private void CreateNamespaceManager()
 {
     thisNamespaceManager = Container.Resolve <INamespaceManager>();
     thisNamespaceManager.AddNamespace("instance", this.XbrlRootNode.NamespaceURI);
     foreach (IAttribute CurrentAttribute in this.XbrlRootNode.Attributes)
     {
         if (CurrentAttribute.Prefix == "xmlns")
         {
             thisNamespaceManager.AddNamespace(CurrentAttribute.LocalName, CurrentAttribute.Value);
         }
     }
 }
Exemple #13
0
        public INodeList SelectNodes(string xpath, INamespaceManager namespaceManager)
        {
            var selectedElements = doc.XPathSelectElements(xpath, (namespaceManager as NamespaceManager).XmlNamespaceManager);
            var nodeList         = new NodeList();

            foreach (var currentElement in selectedElements)
            {
                var newNode = new Node(currentElement);
                nodeList.Add(newNode);
            }
            return(nodeList);
        }
Exemple #14
0
 internal SimpleType(INode SimpleTypeRootNode, INamespaceManager namespaceManager)
 {
     this.SimpleTypeNode = SimpleTypeRootNode;
     this.Name           = this.SimpleTypeNode.GetAttributeValue("name");
     foreach (INode CurrentChildNode in SimpleTypeNode.ChildNodes)
     {
         if (CurrentChildNode.LocalName.Equals("restriction") == true)
         {
             CreateRestrictionType(CurrentChildNode, namespaceManager);
         }
     }
 }
        /// <summary>
        /// Creates a new instance of the XPathManager class.
        /// </summary>
        /// <param name="namespaceManager">Namespace manager to use.</param>
        public XPathManager(INamespaceManager namespaceManager)
        {
            this.NamespaceManager = namespaceManager;

            Func<string, string, string> f = this.DeterminePrefix;
            this.prefixFunc = f.Memoize();

            Func<string, string, int, bool, string> g = this.DetermineXPath;
            this.xpathFunc = g.Memoize();

            Func<int, string> h = this.Index;
            this.indexFunc = h.Memoize();
        }
Exemple #16
0
        public INodeList SelectNodes(string xpath, INamespaceManager namespaceManager)
        {
            var xmlNamespaceManager = (namespaceManager as NamespaceManager).XmlNamespaceManager;
            var xmlNodeList         = thisNode.SelectNodes(xpath, xmlNamespaceManager);
            var listToReturn        = new NodeList();

            foreach (XmlNode foundNode in xmlNodeList)
            {
                var newNode = new Node(foundNode);
                listToReturn.Add(newNode);
            }
            return(listToReturn);
        }
        /// <summary>
        /// Create a new instance of the LinqXPathManager class.
        /// </summary>
        /// <param name="namespaceManager">Namespace manager to use.</param>
        /// <param name="memoize">Whether to memoize (cache) the results.</param>
        public LinqXPathManager(INamespaceManager namespaceManager, bool memoize)
        {
            this.NamespaceManager = namespaceManager;

            Func<string, string, string> f = this.DetermineNamespace;
            this.calculateNamespace = memoize ? f.Memoize() : f;

            Func<string, string, string> g = this.DetermineXPath;
            this.calculateXPath = memoize ? g.Memoize() : g;

            Func<string, string> h = QualifyNamespace;
            this.nsQualFunc = memoize ? h.Memoize() : h;
        }
Exemple #18
0
 //--------------------------------------------------------------------------------------------------------
 // This constructor is used to construct user-defined complex types defined in XBRL schemas.
 //--------------------------------------------------------------------------------------------------------
 internal ComplexType(INode ComplexTypeNode, INamespaceManager namespaceManager)
 {
     thisAttributeGroup    = null;
     thisComplexTypeNode   = ComplexTypeNode;
     thisName              = ComplexTypeNode.GetAttributeValue("name");
     thisSimpleContentType = null;
     foreach (INode CurrentChildNode in ComplexTypeNode.ChildNodes)
     {
         if (CurrentChildNode.LocalName.Equals("simpleContent") == true)
         {
             thisSimpleContentType = new SimpleType(CurrentChildNode, namespaceManager);
         }
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NancyRdfStartup"/> class.
        /// </summary>
        public NancyRdfStartup(INamespaceManager mapper, IWikibusConfiguration config)
        {
            mapper.SetBaseUri(new Uri(config.BaseResourceNamespace));

            mapper.AddNamespace(Dc.Prefix, new Uri(Dc.BaseUri));
            mapper.AddNamespace(Dcterms.Prefix, new Uri(Dcterms.BaseUri));
            mapper.AddNamespace(Schema.Prefix, new Uri(Schema.BaseUri));
            mapper.AddNamespace(Vocab.Hydra.Prefix, new Uri(Vocab.Hydra.BaseUri));
            mapper.AddNamespace(Rdf.Prefix, new Uri(Rdf.BaseUri));
            mapper.AddNamespace(Rdfs.Prefix, new Uri(Rdfs.BaseUri));
            mapper.AddNamespace(Bibo.Prefix, new Uri(Bibo.BaseUri));
            mapper.AddNamespace(Opus.Prefix, new Uri(Opus.BaseUri));
            mapper.AddNamespace("lexvo", new Uri(Lexvo.iso639_1));
            mapper.AddNamespace(Wbo.Prefix, new Uri(Wbo.BaseUri));
        }
Exemple #20
0
 public INodeList SelectNodes(string xpath, INamespaceManager namespaceManager)
 {
     /*
      * var xmlNamespaceManager = (namespaceManager as NamespaceManager).XmlNamespaceManager;
      * var xmlNodeList = thisNode.SelectNodes(xpath, xmlNamespaceManager);
      * var listToReturn = new NodeList();
      * foreach (XmlNode foundNode in xmlNodeList)
      * {
      *  var newNode = new Node(foundNode);
      *  listToReturn.Add(newNode);
      * }
      * return listToReturn;
      */
     throw new System.NotImplementedException();
 }
Exemple #21
0
 public INodeList SelectNodes(string xpath, INamespaceManager namespaceManager)
 {
     /*
      * var xmlNamespaceManager = (namespaceManager as NamespaceManager).XmlNamespaceManager;
      * var xmlNodeList = thisDocument.SelectNodes(xpath, xmlNamespaceManager);
      * var listToReturn = new NodeList();
      * foreach(XmlNode foundNode in xmlNodeList)
      * {
      *  var newNode = new Node(foundNode);
      *  listToReturn.Add(newNode);
      * }
      * return listToReturn;
      */
     return(null);
 }
Exemple #22
0
        public SubscriptionClient(INamespaceManager <T> namespaceManager,
                                  ISerializationProvider serializationProvider,
                                  ILogger <ClientBase <T> > logger)
            : base(serializationProvider, logger)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            _client = new AwaitableLazy <AzureClient>(async() =>
            {
                await namespaceManager.ProvisionSubscriptionAsync();
                return(namespaceManager.CreateSubscriptionClient());
            });
        }
        /// <summary>
        /// Creates a new instance of the XPathManager class.
        /// </summary>
        /// <param name="namespaceManager">Namespace manager to use.</param>
        public XPathManager(INamespaceManager namespaceManager)
        {
            this.NamespaceManager = namespaceManager;

            Func <string, string, string> f = this.DeterminePrefix;

            this.prefixFunc = f.Memoize();

            Func <string, string, int, bool, string> g = this.DetermineXPath;

            this.xpathFunc = g.Memoize();

            Func <int, string> h = this.Index;

            this.indexFunc = h.Memoize();
        }
        /// <summary>
        /// Create a new instance of the LinqXPathManager class.
        /// </summary>
        /// <param name="namespaceManager">Namespace manager to use.</param>
        /// <param name="memoize">Whether to memoize (cache) the results.</param>
        public LinqXPathManager(INamespaceManager namespaceManager, bool memoize)
        {
            this.NamespaceManager = namespaceManager;

            Func <string, string, string> f = this.DetermineNamespace;

            this.calculateNamespace = memoize ? f.Memoize() : f;

            Func <string, string, string> g = this.DetermineXPath;

            this.calculateXPath = memoize ? g.Memoize() : g;

            Func <string, string> h = QualifyNamespace;

            this.nsQualFunc = memoize ? h.Memoize() : h;
        }
 internal NamespaceQualifiedValue(INamespaceManager NamespaceManager, string FullyQualifiedValue)
 {
     thisFullyQualifiedValue           = FullyQualifiedValue;
     thisFullyQualifiedValueComponents = thisFullyQualifiedValue.Split(':');
     if (thisFullyQualifiedValueComponents.Length == 1)
     {
         this.LocalName    = thisFullyQualifiedValueComponents[0];
         this.Namespace    = string.Empty;
         this.NamespaceUri = string.Empty;
     }
     else
     {
         this.LocalName    = thisFullyQualifiedValueComponents[1];
         this.Namespace    = thisFullyQualifiedValueComponents[0];
         this.NamespaceUri = NamespaceManager.LookupNamespace(this.Namespace);
     }
 }
Exemple #26
0
        private void CreateRestrictionType(INode CurrentChildNode, INamespaceManager namespaceManager)
        {
            string BaseValue = CurrentChildNode.Attributes["base"].Value;
            var    BaseValueAsQualifiedName = Container.Resolve <IQualifiedName>();

            BaseValueAsQualifiedName.FullyQualifiedName = BaseValue;
            //var NamespaceUri = string.Empty;
            //if (string.IsNullOrEmpty(BaseValueAsQualifiedName.Namespace) == false)
            //    NamespaceUri = namespaceManager.LookupNamespace(BaseValueAsQualifiedName.Namespace);
            thisRestrictionType = AnyType.CreateType(BaseValueAsQualifiedName.Name, CurrentChildNode);
            if (thisRestrictionType == null)
            {
                string        MessageFormat  = AssemblyResources.GetName("UnsupportedRestrictionBaseSimpleType");
                StringBuilder MessageBuilder = new StringBuilder();
                MessageBuilder.AppendFormat(MessageFormat, BaseValue);
                //throw new XbrlException(MessageBuilder.ToString());
            }
        }
Exemple #27
0
        private void InitializeNamespaceUri(INode QnameNode, INamespaceManager namespaceManager)
        {
            if (this.Namespace.Length == 0)
            {
                this.NamespaceUri = string.Empty;
                return;
            }
            string AttributeName = "xmlns:" + this.Namespace;
            var    currentNode   = QnameNode;

            while ((currentNode != null) && (string.IsNullOrEmpty(this.NamespaceUri) == true))
            {
                this.NamespaceUri = currentNode.GetAttributeValue(AttributeName);
                currentNode       = currentNode.ParentNode;
            }
            if (string.IsNullOrEmpty(this.NamespaceUri) == true)
            {
                this.NamespaceUri = namespaceManager.LookupNamespace(this.Namespace);
            }
        }
Exemple #28
0
        private void CreateRestrictionType(INode restrictionNode, INamespaceManager namespaceManager)
        {
            string BaseValue = restrictionNode.Attributes["base"].Value;
            var    BaseValueAsQualifiedName = Container.Resolve <IQualifiedName>();

            BaseValueAsQualifiedName.FullyQualifiedName = BaseValue;
            thisRestrictionType = AnyType.CreateType(BaseValueAsQualifiedName.Name, restrictionNode);
            if (thisRestrictionType == null)
            {
                string        MessageFormat  = AssemblyResources.GetName("UnsupportedRestrictionBaseSimpleType");
                StringBuilder MessageBuilder = new StringBuilder();
                MessageBuilder.AppendFormat(MessageFormat, BaseValue);
            }
            foreach (INode childNode in restrictionNode.ChildNodes)
            {
                if (childNode.LocalName.Equals("attribute") == true)
                {
                    ProcessRestrictionAttribute(childNode);
                }
            }
        }
Exemple #29
0
        async Task <bool> ExistsAsync(string topicPath, INamespaceManager namespaceClient, bool removeCacheEntry = false)
        {
            var key = GenerateTopicKey(topicPath, namespaceClient);

            logger.InfoFormat("Checking existence cache for '{0}' in namespace '{1}'.", topicPath, namespaceClient.Address);

            if (removeCacheEntry)
            {
                Task <bool> dummy;
                rememberExistence.TryRemove(key, out dummy);
            }

            var exists = await rememberExistence.GetOrAdd(key, notFoundTopicPath =>
            {
                logger.InfoFormat("Checking namespace for existence of the topic '{0}' in namespace '{1}'.", topicPath, namespaceClient.Address);
                return(namespaceClient.TopicExists(topicPath));
            }).ConfigureAwait(false);

            logger.InfoFormat("Determined, from cache, that the topic '{0}' in namespace '{2}' {1}.", topicPath, exists ? "exists" : "does not exist", namespaceClient.Address);

            return(exists);
        }
        async Task <bool> ExistsAsync(INamespaceManager namespaceClient, string queuePath, bool removeCacheEntry = false)
        {
            var key = GenerateQueueKey(namespaceClient, queuePath);

            logger.InfoFormat("Checking existence cache for '{0}' in namespace '{1}'.", queuePath, namespaceClient.Address.Host);

            if (removeCacheEntry)
            {
                Task <bool> dummy;
                rememberExistence.TryRemove(key, out dummy);
            }

            var exists = await rememberExistence.GetOrAdd(key, s =>
            {
                logger.InfoFormat("Checking namespace for existence of the queue '{0}' in namespace '{1}'.", queuePath, namespaceClient.Address.Host);
                return(namespaceClient.QueueExists(queuePath));
            }).ConfigureAwait(false);

            logger.InfoFormat("Determined, from cache, that the queue '{0}' in namespace '{2}' {1}.", queuePath, exists ? "exists" : "does not exist", namespaceClient.Address.Host);

            return(exists);
        }
Exemple #31
0
        public SubscriptionFactory(INamespaceManager <T> namespaceManager,
                                   ISerializationProvider serializationProvider,
                                   ILogger <ClientBase <T> > logger)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            if (serializationProvider == null)
            {
                throw new ArgumentNullException(nameof(serializationProvider));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _namespaceManager      = namespaceManager;
            _serializationProvider = serializationProvider;
            _logger = logger;
        }
Exemple #32
0
        public TopicClient(INamespaceManager <T> namespaceManager,
                           ISerializationProvider serializationProvider,
                           ILogger <ClientBase <T> > logger,
                           IEnumerable <IMessageExtension <T> > extensions)
            : base(serializationProvider, logger)
        {
            if (namespaceManager == null)
            {
                throw new ArgumentNullException(nameof(namespaceManager));
            }

            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            _extensions = extensions.ToArray();
            _client     = new AwaitableLazy <AzureClient>(async() =>
            {
                await namespaceManager.ProvisionTopicAsync();
                return(namespaceManager.CreateTopicClient());
            });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TurtleSerializer"/> class.
 /// </summary>
 public TurtleSerializer(IEntitySerializer entitySerializer, INamespaceManager prefixMapper)
     : base(RdfSerialization.Turtle, entitySerializer, prefixMapper)
 {
 }
 public void Initialize()
 {
     this.NamespaceManager = this.CreateNamespaceManager();
     this.NamespaceManager.RegisterNamespace("a", "http://www.a.com");
     this.NamespaceManager.RegisterNamespace("b", "http://www.b.com");
 }
 /// <summary>
 /// Create a new instance of the LinqXPathManager class.
 /// </summary>
 /// <param name="namespaceManager">Namespace manager to use.</param>
 public LinqXPathManager(INamespaceManager namespaceManager)
     : this(namespaceManager, false)
 {
 }