you should look at XSLT, it can help transform xml as you need

ClassMethod SplitXML() 
{

    for item="market","product" {
        set params("path")="/doc/"_item
        
        Set tSource=##class(%Dictionary.CompiledXData).%OpenId(..%ClassName(1)_"||XML").Data
        
        Set tXSL=##class(%Dictionary.CompiledXData).%OpenId(..%ClassName(1)_"||XSL").Data

        // Transform the source according to the XSL
        Set tSC=##class(%XML.XSLT.Transformer).TransformStream(tSource,tXSL,.tOutput,,.params)
        If $$$ISERR(tSC) Quit
        
        write !!
        // Output the result to the screen
        Set tSC=tOutput.OutputToDevice()
    }
}

XData XML
{
<?xml version="1.0"?>
<doc>
<header></header>
<product><test>1</test></product>
<market><test2>2</test2></market>
</doc>
}

XData XSL
{
<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:param name="path"></xsl:param>

<xsl:output method="xml" indent="no"/>
 
<xsl:template match="/">
    <xsl:copy-of select="$path"/>
</xsl:template>
    
</xsl:stylesheet>
}

will output like below

USER>d ##class(Test).SplitXML()


<?xml version="1.0" encoding="UTF-8"?><market><test2>2</test2></market>

<?xml version="1.0" encoding="UTF-8"?><product><test>1</test></product>

you can do it with ccontrol tool

Syntax:
    ccontrol create <instance name> <parameters>
Description:
    Create an instance's entry in the Cache registry.
Parameters:
    directory=<installation directory name>
    versionid=<version identifier>
Example:
    ccontrol create mystuff directory=/usr/cachesys versionid=2008.2.0.357.0

%-variables, stored in local memory of the current process.

Process-private globals, implicitly stored in database CACHETEMP. 

It means, that when you use %-variables, you limited by the memory of your process, (which can be increased programmatically by the way). While Process-private global works exactly as simple global and limited only by free size on the disk. 

And also you should remember that you can not store objects in global variables, even if it is Process-private one.

Access to process-private variables also could be a bit slower than %-variables.