What is best practice for setting an xmlns attribute using SAX?

LoMaX

New Member
I'm using Xalan-C++ to create an XML document. My code is based on the DocumentBuilder sample, so I'm using SAX to create the document. It's mostly working, but I'm unsure how an xmlns attribute should be set. Do I simply use \[code\]addAttribute()\[/code\] or is there some other way to do it?This is what I'm trying:\[code\]XalanDOMString theUri = XALAN_STATIC_UCODE_STRING("urn:ibm:names:ITFIM:1.0:stsuuser");XalanDOMString thePrefix = XALAN_STATIC_UCODE_STRING("stsuuser");XalanDOMString theAttributeName = XALAN_STATIC_UCODE_STRING("xmlns:stsuuser");const XalanDOMString theAttributeType("CDATA");XalanDOMString theAttributeValue = http://stackoverflow.com/questions/12684858/theUritheAttributes.addAttribute(c_wstr(theAttributeName), c_wstr(theAttributeType), c_wstr(theAttributeValue));XalanDOMString theElementName = XALAN_STATIC_UCODE_STRING("STSUniversalUser");XalanDOMString theQName = XALAN_STATIC_UCODE_STRING("stsuuser:STSUniversalUser");theContentHandler->startPrefixMapping(c_wstr(thePrefix), c_wstr(theUri));theContentHandler->startElement(c_wstr(theUri), c_wstr(theElementName), c_wstr(theQName), theAttributes);...\[/code\]However, when I attempt to transform the document using XSLT the namespace does not appear to be recognised ... or something.
 
Back
Top