Liquid XML Data Binder
Liquid XML Objects (C#, Visual Basic .Net) / Using the Generated Code / Using the generated Namespace Registration Function
In This Topic
    Using the generated Namespace Registration Function
    In This Topic

    If the '/GenerateNsRegistration' option is set then an extension function is generated that will populate the LxWriterSettings.NamespaceMap Property with all the namespaces registered within the source XSD schemas.

     

    Example of the generated code
    Copy Code
    namespace MyCompany.MySchema
    {
        public static class NamespaceRegistrationExtension
        {
            public static void AddDefaultNamespaces(this LiquidTechnologies.XmlObjects.LxWriterSettings settings)
            {
                settings.NamespaceMap["xsd"] = "http://www.w3.org/2001/XMLSchema";
                settings.NamespaceMap["fpml"] = "http://www.fpml.org/2005/FpML-4-2";
                settings.NamespaceMap["ds"] = "http://www.w3.org/2000/09/xmldsig#";
            }
        }
    }
    

    The function can be used as follows

    As an extension function
    Copy Code
    using MyCompany.MySchema;
    
    ...
    
    LxWriterSettings mySettings = new LxWriterSettings();
    mySettings.AddDefaultNamespaces();
    
    Or used directly
    Copy Code
    using MyCompany.MySchema;
    
    ...
    
    LxWriterSettings mySettings = new LxWriterSettings();
    MyCompany.MySchema.AddDefaultNamespaces(mySettings);
    

     

    See Also