Beispiel #1
0
 internal FhirXmlNode(XObject node, FhirXmlParsingSettings settings)
 {
     Current   = node;
     Location  = Name;
     _settings = settings?.Clone() ?? new FhirXmlParsingSettings();
     _atRoot   = true;
 }
Beispiel #2
0
 /// <summary>Clone constructor. Generates a new <see cref="FhirXmlParsingSettings"/> instance initialized from the state of the specified instance.</summary>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public FhirXmlParsingSettings(FhirXmlParsingSettings other)
 {
     if (other == null)
     {
         throw Error.ArgumentNull(nameof(other));
     }
     other.CopyTo(this);
 }
        public static ISourceNode Read(XmlReader reader, FhirXmlParsingSettings settings = null)
        {
            if (reader == null)
            {
                throw Error.ArgumentNull(nameof(reader));
            }

            var doc = SerializationUtil.XDocumentFromReader(reader, ignoreComments: false);

            return(new FhirXmlNode(doc.Root, settings));
        }
 /// <summary>Create a new <see cref="ConfigurableNavigatorStreamFactory"/> instance.</summary>
 /// <param name="permissiveParsing">Specify <c>true</c> to suppress raising exceptions for recoverable parsing errors.</param>
 public ConfigurableNavigatorStreamFactory(bool permissiveParsing)
 {
     XmlParsingSettings = new FhirXmlParsingSettings()
     {
         PermissiveParsing = permissiveParsing
     };
     JsonParsingSettings = new FhirJsonParsingSettings()
     {
         PermissiveParsing = permissiveParsing
     };
 }
        public static async Task <ISourceNode> ReadAsync(XmlReader reader, FhirXmlParsingSettings settings = null)
        {
            if (reader == null)
            {
                throw Error.ArgumentNull(nameof(reader));
            }

            var doc = await SerializationUtil.XDocumentFromReaderAsync(reader, ignoreComments : false).ConfigureAwait(false);

            return(new FhirXmlNode(doc.Root, settings));
        }
        public static ISourceNode Parse(string xml, FhirXmlParsingSettings settings = null)
        {
            if (xml == null)
            {
                throw Error.ArgumentNull(nameof(xml));
            }

            using (var reader = SerializationUtil.XmlReaderFromXmlText(xml, ignoreComments: false))
            {
                return(Read(reader, settings));
            }
        }
        public static async Task <ISourceNode> ParseAsync(string xml, FhirXmlParsingSettings settings = null)
        {
            if (xml == null)
            {
                throw Error.ArgumentNull(nameof(xml));
            }

            using (var reader = await SerializationUtil.XmlReaderFromXmlTextAsync(xml, ignoreComments: false))
            {
                return(await ReadAsync(reader, settings).ConfigureAwait(false));
            }
        }
Beispiel #8
0
        /// <summary>Copy all configuration settings to another instance.</summary>
        /// <param name="other">Another <see cref="FhirXmlParsingSettings"/> instance.</param>
        /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
        public void CopyTo(FhirXmlParsingSettings other)
        {
            if (other == null)
            {
                throw Error.ArgumentNull(nameof(other));
            }

            other.AllowedExternalNamespaces = (XNamespace[])AllowedExternalNamespaces?.Clone();
            other.DisallowSchemaLocation    = DisallowSchemaLocation;
            other.PermissiveParsing         = PermissiveParsing;

#if !NETSTANDARD1_1
            other.ValidateFhirXhtml = ValidateFhirXhtml;
#endif
        }
 public static ISourceNode Create(XDocument root, FhirXmlParsingSettings settings = null) => Create(root.Root, settings);
 public static ISourceNode Create(XElement root, FhirXmlParsingSettings settings = null) => new FhirXmlNode(root, settings);
 /// <summary>Create a new <see cref="ConfigurableNavigatorStreamFactory"/> instance for the specified parser configuration settings.</summary>
 /// <param name="xmlParsingSettings">Configuration settings that control the behavior of the internal XML parser.</param>
 /// <param name="jsonParsingSettings">Configuration settings that control the behavior of the internal JSON parser.</param>
 public ConfigurableNavigatorStreamFactory(FhirXmlParsingSettings xmlParsingSettings, FhirJsonParsingSettings jsonParsingSettings)
 {
     XmlParsingSettings  = xmlParsingSettings?.Clone() ?? FhirXmlParsingSettings.CreateDefault();
     JsonParsingSettings = jsonParsingSettings?.Clone() ?? FhirJsonParsingSettings.CreateDefault();
 }