ISerializerFactoryEx::XsiForPrimaryNS Method

HRESULT XsiForPrimaryNS([out, retval] BSTR * uri);

The serializer factory keeps track of the current primary XSD namespace, which allows the serializer engine to serialize using the older XSD namespace. This allows a serializer to find out what the matching XSI [XML Schema Instance] namespace is for the current primary XSD Namespace (e.g. to generate xsi:type attributes)

 

Parameters

uri
BSTR *, [out, retval]: The XSI namespace that matches the primary XSD namespace

 

Return Values

A string containing the NamespaceURI of the XML Schema Instance for the current primary Schema Namespace

 

Sample Code

HRESULT CSerializerSimpleBase::WriteType(VARIANT * val, ISerializerContext * ctx, ISerializerOutput * dest ) 
{
	if ( m_type.Length() ) 
	{
		CComPtr sf ;
		ctx->get_SerializerFactory(&sf) ;
		CComBSTR xsi ;
		sf->XsiForPrimaryNS(&xsi) ;
		static CComBSTR type (OLESTR("type")) ;
		dest->QNameAttribute ( type, xsi, m_type, m_typeNS ) ;
	}
	return S_OK ;
}

 

See Also

The ISerializerFactoryEx Interface | 

 

 

Copyright

Copyright © Simon Fell, 2000-2004. All rights reserved.