  
  [1X2 [33X[0;0Y[5XOpenMath[105X[101X[1X functionality in [5XGAP[105X[101X[1X[133X[101X
  
  
  [1X2.1 [33X[0;0YViewing [5XOpenMath[105X[101X[1X representation of an object[133X[101X
  
  [1X2.1-1 OMPrint[101X
  
  [33X[1;0Y[29X[2XOMPrint[102X( [3Xobj[103X ) [32X function[133X
  
  [33X[0;0YOMPrint  writes  the  default XML [5XOpenMath[105X encoding of [5XGAP[105X object [3Xobj[103X to the
  standard output.[133X
  
  [33X[0;0YOne can try it with different [5XGAP[105X objects to see if they can be converted to
  [5XOpenMath[105X  and  learn  how  their [5XOpenMath[105X representation looks like. Here we
  show the encoding for lists of integers and rationals:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( [ 1, 1/2 ] );     [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="list1" name="list"/>[128X[104X
    [4X[28X		<OMI>1</OMI>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="nums1" name="rational"/>[128X[104X
    [4X[28X			<OMI>1</OMI>[128X[104X
    [4X[28X			<OMI>2</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YStrings are encoded using [10X<OMSTR>[110X tags:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( "This is a string" );[127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMSTR>This is a string</OMSTR>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YCyclotomics   may   be  encoded  in  different  ways  dependently  on  their
  properties:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( 1-2*E(4) );      [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="complex1" name="complex_cartesian"/>[128X[104X
    [4X[28X		<OMI>1</OMI>[128X[104X
    [4X[28X		<OMI>-2</OMI>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[25Xgap>[125X [27XOMPrint(E(3));       [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="arith1" name="plus"/>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="arith1" name="times"/>[128X[104X
    [4X[28X			<OMI>1</OMI>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="algnums" name="NthRootOfUnity"/>[128X[104X
    [4X[28X				<OMI>3</OMI>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YVarious encodings may be used for various types of groups:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( Group( (1,2) ) );[127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="permgp1" name="group"/>[128X[104X
    [4X[28X		<OMS cd="permutation1" name="right_compose"/>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="permut1" name="permutation"/>[128X[104X
    [4X[28X			<OMI>2</OMI>[128X[104X
    [4X[28X			<OMI>1</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( Group( [ [ [ 1, 2 ],[ 0, 1 ] ] ] ) );[127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="group1" name="group_by_generators"/>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="linalg2" name="matrix"/>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="linalg2" name="matrixrow"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>2</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="linalg2" name="matrixrow"/>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[25Xgap>[125X [27XOMPrint( FreeGroup( 2 ) );                      [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="fpgroup1" name="free_groupn"/>[128X[104X
    [4X[28X		<OMI>2</OMI>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YProducing [5XOpenMath[105X representation of polynomials, one may get a warning:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xx:=Indeterminate(Rationals,"x");; y:=Indeterminate(Rationals,"y");;[127X[104X
    [4X[25Xgap>[125X [27XOMPrint(x^2+y);[127X[104X
    [4X[28X#I  Warning : polynomial will be printed using its default ring [128X[104X
    [4X[28X#I  because the default OpenMath polynomial ring is not specified [128X[104X
    [4X[28X#I  or it is not contained in the default OpenMath polynomial ring.[128X[104X
    [4X[28X#I  You may ignore this or call SetOpenMathDefaultPolynomialRing to fix it.[128X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="polyd1" name="DMP"/>[128X[104X
    [4X[28X		<OMA id="polyring9qiY2oOaiITWUORb" >[128X[104X
    [4X[28X			<OMS cd="polyd1" name="poly_ring_d"/>[128X[104X
    [4X[28X			<OMS cd="setname1" name="Q"/>[128X[104X
    [4X[28X			<OMI>2</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="polyd1" name="SDMP"/>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>2</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YIndeed,  now  when  another  polynomial will be printed, it will belong to a
  ring  with  a  different  identifier  (despite  [5XGAP[105X  will be able to perform
  arithmetical  operations  on  these polynomials like when they belong to the
  same ground ring):[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XOMPrint(x+1);[127X[104X
    [4X[28X#I  Warning : polynomial will be printed using its default ring [128X[104X
    [4X[28X#I  because the default OpenMath polynomial ring is not specified [128X[104X
    [4X[28X#I  or it is not contained in the default OpenMath polynomial ring.[128X[104X
    [4X[28X#I  You may ignore this or call SetOpenMathDefaultPolynomialRing to fix it.[128X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="polyd1" name="DMP"/>[128X[104X
    [4X[28X		<OMA id="polyring0LqlkhnCyLldcoBl" >[128X[104X
    [4X[28X			<OMS cd="polyd1" name="poly_ring_d_named"/>[128X[104X
    [4X[28X			<OMS cd="setname1" name="Q"/>[128X[104X
    [4X[28X			<OMV name="x"/>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="polyd1" name="SDMP"/>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThus,  the  warning means that it is not guaranteed that the polynomial ring
  will  have  the same identifier [10X<OMA id="polyring..." >[110X when another or same
  polynomial  from this ring will be printed next time. If this may constitute
  a  problem,  for  example,  if  a list of polynomial is being exchanged with
  another  system  and  it is crucial that all of them will belong to the same
  ring,    then    such   ring   must   be   created   explicitly   and   then
  [10XSetOpenMathDefaultPolynomialRing[110X must be called:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xx:=Indeterminate(Rationals,"x");; y:=Indeterminate(Rationals,"y");;[127X[104X
    [4X[25Xgap>[125X [27XR:=PolynomialRing(Rationals,[x,y]);;[127X[104X
    [4X[25Xgap>[125X [27XSetOpenMathDefaultPolynomialRing(R);[127X[104X
    [4X[25Xgap>[125X [27XOMPrint(x^2+y);[127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="polyd1" name="DMP"/>[128X[104X
    [4X[28X		<OMA id="polyring9eNcBGFHXkjl2kWh" >[128X[104X
    [4X[28X			<OMS cd="polyd1" name="poly_ring_d"/>[128X[104X
    [4X[28X			<OMS cd="setname1" name="Q"/>[128X[104X
    [4X[28X			<OMI>2</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="polyd1" name="SDMP"/>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
  [4X[32X[104X
  
  [33X[0;0YNow  we  can  see  that  both  polynomials  belong to the ring with the same
  identifier,  and  the [5XOpenMath[105X representation of the 2nd polynomial properly
  reflects that it belongs to a polynomial ring with two variables.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XOMPrint(x+1);  [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="polyd1" name="DMP"/>[128X[104X
    [4X[28X		<OMR href="#polyring9eNcBGFHXkjl2kWh" />[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="polyd1" name="SDMP"/>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X			<OMA>[128X[104X
    [4X[28X				<OMS cd="polyd1" name="term"/>[128X[104X
    [4X[28X				<OMI>1</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X				<OMI>0</OMI>[128X[104X
    [4X[28X			</OMA>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ> [128X[104X
  [4X[32X[104X
  
  [1X2.1-2 OMString[101X
  
  [33X[1;0Y[29X[2XOMString[102X( [3Xobj[103X ) [32X function[133X
  
  [33X[0;0YOMString  returns  a  string  with  the default XML [5XOpenMath[105X encoding of [5XGAP[105X
  object  [3Xobj[103X. If used with the [9Xnoomobj[109X option, then initial and final <OMOBJ>
  tags will be omitted.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMString(42);[127X[104X
    [4X[28X"<OMOBJ xmlns=\"http://www.openmath.org/OpenMath\" version=\"2.0\"> <OMI>42</OMI> </OMOBJ>"[128X[104X
    [4X[25Xgap>[125X [27XOMString([1,2]:noomobj);    [127X[104X
    [4X[28X"<OMA> <OMS cd=\"list1\" name=\"list\"/> <OMI>1</OMI> <OMI>2</OMI> </OMA>"[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.2 [33X[0;0YReading [5XOpenMath[105X[101X[1X code from streams and strings[133X[101X
  
  [1X2.2-1 OMGetObject[101X
  
  [33X[1;0Y[29X[2XOMGetObject[102X( [3Xstream[103X ) [32X function[133X
  
  [33X[0;0Y[3Xstream[103X  is  an  input  stream (see [2XInputTextFile[102X ([14XReference: InputTextFile[114X),
  [2XInputTextUser[102X   ([14XReference:   InputTextUser[114X),   [2XInputTextString[102X  ([14XReference:
  InputTextString[114X),             [2XInputOutputLocalProcess[102X            ([14XReference:
  InputOutputLocalProcess[114X),  [2XInputOutputTCPStream[102X  ([14XInputOutputTCPStream,  for
  client???[114X), [2XInputOutputTCPStream[102X ([14XInputOutputTCPStream, for server???[114X)) with
  an  [5XOpenMath[105X object on it. [2XOMGetObject[102X takes precisely one object off [3Xstream[103X
  and  returns  it  as a GAP object. Both XML and binary [5XOpenMath[105X encoding are
  supported: autodetection is used.[133X
  
  [33X[0;0YThis  may  be used to retrieve objects from a file. In the following example
  we  demonsrate  reading the same content in binary and XML formats using the
  test files supplied with the package (the package autodetects whether binary
  or XML encoding is used):[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xtxml:=Filename(DirectoriesPackageLibrary("openmath","tst"),"test3.omt");;   [127X[104X
    [4X[25Xgap>[125X [27Xtbin:=Filename(DirectoriesPackageLibrary("openmath","tst"),"test3.bin");;   [127X[104X
    [4X[25Xgap>[125X [27Xxstream := InputTextFile( txml );; bstream := InputTextFile( tbin );;   [127X[104X
    [4X[25Xgap>[125X [27Xx:=OMGetObject(xstream); y:=OMGetObject(bstream);[127X[104X
    [4X[28X912873912381273891[128X[104X
    [4X[28X912873912381273891[128X[104X
    [4X[25Xgap>[125X [27Xx:=OMGetObject(xstream); y:=OMGetObject(bstream);[127X[104X
    [4X[28XE(4)[128X[104X
    [4X[28XE(4)[128X[104X
    [4X[25Xgap>[125X [27XCloseStream(xstream);CloseStream(bstream);[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YTo  paste  an  [5XOpenMath[105X  object  directly  into  standard  input execute the
  following command in GAP:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xs:= InputTextUser();; g := OMGetObject(s); CloseStream(s);[127X[104X
    [4X[25Xgap>[125X [27X[127X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YFor  XML  [5XOpenMath[105X,  this  function  requires that the [5XGAP[105X package [5XGAPDoc[105X is
  available.[133X
  
  [1X2.2-2 EvalOMString[101X
  
  [33X[1;0Y[29X[2XEvalOMString[102X( [3Xomstr[103X ) [32X function[133X
  
  [33X[0;0YThis  function  is  an  analog  of  [2XEvalString[102X  ([14XReference: EvalString[114X). Its
  argument  [3Xomstr[103X  must  be  a  string  containing  a  single [5XOpenMath[105X object.
  [2XEvalOMString[102X will return the [5XGAP[105X object represented by [3Xomstr[103X.[133X
  
  [33X[0;0YIf [3Xomstr[103X contains more [5XOpenMath[105X objects, the rest will be ignored.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xs:="<OMOBJ><OMS cd=\"setname1\" name=\"Z\"/></OMOBJ>";;[127X[104X
    [4X[25Xgap>[125X [27XEvalOMString(s);[127X[104X
    [4X[28XIntegers[128X[104X
    [4X[25Xgap>[125X [27XG:=SL(2,5);; G=EvalOMString(OMString(G));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.3 [33X[0;0YWriting [5XOpenMath[105X[101X[1X code to streams[133X[101X
  
  [33X[0;0YWhile  it  is possible to read [5XOpenMath[105X code directly from a stream, writing
  [5XOpenMath[105X  to  streams  uses  a  different setup. It requires special objects
  called  [5XOpenMath[105X  [13Xwriters[113X,  which  encapsulate  streams and may be viewed as
  transducers accepting [5XGAP[105X objects and writing them to a stream in the XML or
  binary [5XOpenMath[105X[133X
  
  [33X[0;0YSuch  setup  makes it possible to re-use the same stream for both binary and
  XML  [5XOpenMath[105X  communication,  using different [5XOpenMath[105X writers in different
  calls.  It  also  allows  to  re-use  most of the high-level code for [5XGAP[105X to
  [5XOpenMath[105X  conversion,  having separate methods for generating binary and XML
  [5XOpenMath[105X  only  for low-level output ([5XOpenMath[105X tags and basic objects). This
  makes  easier adding support to new mathematical objects and private content
  dictionaries  as  described  in Chapter [14X3[114X since it does not require changing
  the low-level functionality.[133X
  
  [1X2.3-1 IsOpenMathWriter[101X
  
  [33X[1;0Y[29X[2XIsOpenMathWriter[102X [32X Category[133X
  [33X[1;0Y[29X[2XIsOpenMathXMLWriter[102X [32X Category[133X
  [33X[1;0Y[29X[2XIsOpenMathBinaryWriter[102X [32X Category[133X
  
  [33X[0;0Y[2XIsOpenMathWriter[102Xis   a   category   for   [5XOpenMath[105X   writers.   It  has  two
  subcategories: [2XIsOpenMathXMLWriter[102X and [2XIsOpenMathBinaryWriter[102X.[133X
  
  [1X2.3-2 OpenMathXMLWriter[101X
  
  [33X[1;0Y[29X[2XOpenMathXMLWriter[102X( [3Xs[103X ) [32X function[133X
  
  [33X[0;0Yfor  a  stream  [3Xs[103X,  returns  an  object  in the category [2XIsOpenMathXMLWriter[102X
  ([14X2.3-1[114X).[133X
  
  [1X2.3-3 OpenMathBinaryWriter[101X
  
  [33X[1;0Y[29X[2XOpenMathBinaryWriter[102X( [3Xs[103X ) [32X function[133X
  
  [33X[0;0Yfor a stream [3Xs[103X, returns an object in the category [2XOpenMathBinaryWriter[102X.[133X
  
  [1X2.3-4 OMPutObject[101X
  
  [33X[1;0Y[29X[2XOMPutObject[102X( [3Xstream[103X, [3Xobj[103X ) [32X function[133X
  [33X[1;0Y[29X[2XOMPutObjectNoOMOBJtags[102X( [3Xstream[103X, [3Xobj[103X ) [32X function[133X
  
  [33X[0;0Y[2XOMPutObject[102X writes (appends) the XML [5XOpenMath[105X encoding of the [5XGAP[105X object [3Xobj[103X
  to  output  stream  [3Xstream[103X  (see  [2XInputTextFile[102X  ([14XReference: InputTextFile[114X),
  [2XOutputTextUser[102X  ([14XReference:  OutputTextUser[114X),  [2XOutputTextString[102X  ([14XReference:
  OutputTextString[114X),     [2XInputOutputTCPStream[102X    ([14XInputOutputTCPStream,    for
  client???[114X), [2XInputOutputTCPStream[102X ([14XInputOutputTCPStream, for server???[114X)).[133X
  
  [33X[0;0YThe  second  version  does  the  same  but without <OMOBJ> tags, what may be
  useful for assembling complex [5XOpenMath[105X objects.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xg := [[1,2],[1,0]];;[127X[104X
    [4X[25Xgap>[125X [27Xt := "";[127X[104X
    [4X[28X""[128X[104X
    [4X[25Xgap>[125X [27Xs := OutputTextString(t, true);;[127X[104X
    [4X[25Xgap>[125X [27Xw:=OpenMathXMLWriter( s );[127X[104X
    [4X[28X<OpenMath XML writer to OutputTextString(0)>[128X[104X
    [4X[25Xgap>[125X [27XOMPutObject(w, g);[127X[104X
    [4X[25Xgap>[125X [27XCloseStream(s);[127X[104X
    [4X[25Xgap>[125X [27XPrint(t);[127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMA>[128X[104X
    [4X[28X		<OMS cd="linalg2" name="matrix"/>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="linalg2" name="matrixrow"/>[128X[104X
    [4X[28X			<OMI>1</OMI>[128X[104X
    [4X[28X			<OMI>2</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X		<OMA>[128X[104X
    [4X[28X			<OMS cd="linalg2" name="matrixrow"/>[128X[104X
    [4X[28X			<OMI>1</OMI>[128X[104X
    [4X[28X			<OMI>0</OMI>[128X[104X
    [4X[28X		</OMA>[128X[104X
    [4X[28X	</OMA>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [1X2.3-5 OMPlainString[101X
  
  [33X[1;0Y[29X[2XOMPlainString[102X( [3Xstring[103X ) [32X function[133X
  
  [33X[0;0Y[2XOMPlainString[102X wraps the string into a [5XGAP[105X object of a special kind called an
  [5XOpenMath[105X  plain  string.  Internally such object is represented as a string,
  but  [2XOMPutObject[102X ([14X2.3-4[114X) threat it in a different way: instead of converting
  it  into  a  <OMSTR>  object,  an  [5XOpenMath[105X  plain  string  will  be plainly
  substituted  into  the output (this explains its name) without decorating it
  with <OMSTR> tags.[133X
  
  [33X[0;0YIt  is  assumed  that [5XOpenMath[105X plain string contains valid [5XOpenMath[105X code; no
  actual  validation  is performed during its creation. Such functionality may
  be  useful  to compose some [5XOpenMath[105X code at the [5XGAP[105X level to communicate it
  to  the  other  system,  in  particular, to send there symbols which are not
  supported by [5XGAP[105X, for example:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xs:=OMPlainString("<OMS cd=\"nums1\" name=\"pi\"/>");[127X[104X
    [4X[28X<OMS cd="nums1" name="pi"/>[128X[104X
    [4X[25Xgap>[125X [27XOMPrint(s);                                       [127X[104X
    [4X[28X<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">[128X[104X
    [4X[28X	<OMS cd="nums1" name="pi"/>[128X[104X
    [4X[28X</OMOBJ>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.4 [33X[0;0YUtilities[133X[101X
  
  [1X2.4-1 OMTestXML[101X
  
  [33X[1;0Y[29X[2XOMTestXML[102X( [3Xobj[103X ) [32X function[133X
  [33X[1;0Y[29X[2XOMTest[102X( [3Xobj[103X ) [32X function[133X
  
  [33X[0;0YConverts  [3Xobj[103X  to  XML [5XOpenMath[105X and back. Returns true if and only if [3Xobj[103X is
  unchanged  (as  a  [5XGAP[105X object) by this operation. The [5XOpenMath[105X standard does
  not  stipulate  that  converting to and from [5XOpenMath[105X should be the identity
  function so this is a useful diagnostic tool.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMTestXML([[1..10],[1/2,2+E(4)],ZmodnZObj(2,6),(1,2),true,"string"]);     [127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0Y[2XOMTest[102X is a synonym to [2XOMTestXML[102X[133X
  
  [1X2.4-2 OMTestBinary[101X
  
  [33X[1;0Y[29X[2XOMTestBinary[102X( [3Xobj[103X ) [32X function[133X
  
  [33X[0;0YConverts [3Xobj[103X to binary [5XOpenMath[105X and back. Returns true if and only if [3Xobj[103X is
  unchanged  (as  a  [5XGAP[105X object) by this operation. The [5XOpenMath[105X standard does
  not  stipulate  that  converting to and from [5XOpenMath[105X should be the identity
  function so this is a useful diagnostic tool.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XOMTestBinary([[1..10],[1/2,2+E(4)],ZmodnZObj(2,6),(1,2),true,"string"]);     [127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
