Exemplo n.º 1
0
 internal ElementMetadata(
     ReadOnlyArray <AttributeMetadata> attributes,
     ReadOnlyArray <IValidator> validators,
     ReadOnlyArray <IValidator> constraints,
     FileFormatVersions version,
     OpenXmlSchema schema,
     CompiledParticle particle,
     Lazy <ElementLookup> lookup)
 {
     Attributes   = attributes;
     Validators   = validators;
     Constraints  = constraints;
     Availability = version;
     Schema       = schema;
     Particle     = particle;
     _children    = lookup;
 }
Exemplo n.º 2
0
        public OpenXmlElement?Create(OpenXmlSchema schema)
        {
            if (_data.Length == 0)
            {
                return(null);
            }

            // This is on a hot-path and using a dictionary adds substantial time to the lookup. Most child lists are small, so using a sorted
            // list to store them with a binary search improves overall performance.
            var idx = Array.BinarySearch(_data, new ElementChild(null, schema), ElementChildNameComparer.Instance);

            if (idx < 0)
            {
                return(null);
            }

            return(_data[idx].Create());
        }
Exemplo n.º 3
0
 private ActivatorElementChild(Type child, OpenXmlSchema schema)
     : base(child, schema.NamespaceId, schema.Tag)
 {
 }
Exemplo n.º 4
0
 public ElementChild(Type?type, OpenXmlSchema schema)
 {
     Type   = type;
     Schema = schema;
 }