When using the old stream classes (%Library.GlobalXXXXStream) you should never set a stream property A to the oref from another stream B, as the Location value of stream B will be copied into stream A. You should use CopyFrom to avoid this Location change.

Taking @Lorenzo Scalese  sample method add2(), it should be rewriiten as:

ClassMethod add2() As %Status
{
   Set = ..%New()
   Set st = ##class(%GlobalBinaryStream).%New()
   Do st.Write("azeruiop")
   //Set o.st = st
   Do o.st.CopyFrom(st)
   Quit o.%Save()
}
 

If you use the new stream classes %Stream,GlobalXXXX, the original code from method add2() will keep the Location from stream property:

ClassMethod add2() As %Status
{
Set = ..%New()
Set st = ##class(%Stream.GlobalBinary).%New()
Do st.Write("azeruiop")
Set o.st = st
Quit o.%Save()
}

 

It's not a pretty solution but you can achieve it using a terminal script (iristerm/cterm). The script will call your routine and when it ends it will throw a popup alert informing that your routine did finish. It will not bring the terminal to the foregroung but you get the alert.

Save this to a file:

send: d ^myRoutine<cr>
wait for: USER>
execute: mshta vbscript:Execute("msgbox ""Routine myRoutine finished processing."",48:close")

In terminal, press ALT+S and select the your script file and when the routine ends you will see a popup.
 

The code below does want you want.

    While textreader.Read() {
        If textreader.NodeType = "element"  {  
            Set elementName=textreader.Name  
        }
        ElseIf textreader.NodeType = "chars" {
            Set elementValue=textreader.Value
            Set practices=practices_elementName_":"_elementValue_" "
        }
    }
    Write practices
 


Hi Yuriy,

Currently there are no API's to convert XML to JSON but it can be done quite easily in different ways.

One approach you can use is if your XML has always the same structure, you can create a class(es) in HS that corresponds to this XML structure. With this class(es) you can now use %XML.Reader and method Correlate() to load the XML into the class(es). Here you can find more information about this:
http://docs.intersystems.com/ens20162/csp/docbook/DocBook.UI.Page.cls?KEY=GXML_import

After correlating the XML to your class you should then use method %WriteJSONStreamFromObject from class %ZEN.Auxiliary.jsonProvider to dump this object in JSON format into a stream. Documentation is here:
http://docs.intersystems.com/ens20162/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25ZEN.Auxiliary.jsonProvider#%WriteJSONStreamFromObject
There is also a string version of this method but your JSON will need to fit in up to 3.5MB.

This is the simplest approach but it relies on being able to represent your XMLs as a class (or classes) in HS.

Another approach is to use some external third-party library to convert XML to JSON. There are several open source libraries for Java, .Net, Python, and others.

I have my Windows configuredwith keyboard as "US International", this makes it very easy to get quite all of these accented and special letters.

I just type a single quote ' folowed by an e and get é. This is very usefull if you need to write in languages that have accented characters like all latin ones.

Of course there are some cons, like if I want a single quote I need to type ' followed by a space so I get it on screen and it does not get combined with another letter that can have accent variations.