Liquid XML Data Binder (C++, Java, VB6) / Reference / C++ / Reference / CSerializationContext / C++ GetNamespaceAliases - CSerializationContext
In This Topic
    C++ GetNamespaceAliases - CSerializationContext
    In This Topic
    CNamespaceAliasMap& GetNamespaceAliases();
    const CNamespaceAliasMap& GetNamespaceAliases() const;
      Property Description  
        Property Name NamespaceAliases  
        Property Type CNamespaceAliasMap  
        Accessors Read Only  
        Description Returns a CNamespaceAliasMap containing NamespaceAliasEntry items describing Alias, NamespaceUri and WriteInRootElement (defaults to true).  
        Remarks

    By default, these namespace declarations will be written at the root level in the document. Setting WriteInRootElement = false will write the namespace declaration at the point it is required.

    The sample shows what you get if an alias "MyAlias", and URI "http://sample" are added to the collection.

    Example XML
    Copy Code
    <?xml version="1.0"?>
    <MyAlias:Customer xmlns:MyAlias="http://sample" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" clubCardMember="false">
    
    API
    Copy Code
    class LTXMLLIB_API CNamespaceAliasMap
    {
    public:
        CNamespaceAliasMap();
        void Add(LPCTSTR lpctAlias, LPCTSTR lpctNamespace, bool writeInRootElement = true);
        void RemoveNamespace(LPCTSTR lpctNamespace);
        std::tstring GetNamespaceFromAlias(LPCTSTR lpctAlias) const;
        std::tstring GetAliasFromNamespace(LPCTSTR lpctNamespace) const;
        bool DoesNamespaceExist(LPCTSTR lpctNamespace) const;
        bool DoesAliasExist(LPCTSTR lpctAlias) const;
        int GetNamespaceCount() const;
        std::tstring GetNamespaceAt(int index) const;
        NamespaceAliasEntry GetEntryAt(int index) const;
    
        struct NamespaceAliasEntry
        {
            std::tstring Alias;
            std::tstring NamespaceUri;
            bool WriteInRootElement;
        };
    };