Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 11180

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Examples</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sdo-das-xml.constants.html">Predefined Constants</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.sdo-das-xml.html">SDO DAS XML Functions</a></div>
 <div class="up"><a href="book.sdo-das-xml.html">SDO DAS XML</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="sdo-das-xml.examples" class="chapter">
 <h1>Examples</h1>

   <p class="para">
    Several of the following examples are based on the
    <a href="sdo.sample.sequence.html" class="link">letter example</a>
    described in the
    <a href="ref.sdo.html" class="link">SDO documentation</a>.
    The examples assume the XML Schema for the letter is contained in a file
    <var class="filename">letter.xsd</var>
    and the letter instance is in the file
    <var class="filename">letter.xml</var>.
    These two files are reproduced here:
   </p>
   <p class="para">
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
  xmlns:letter=&quot;http://letterSchema&quot;
  targetNamespace=&quot;http://letterSchema&quot;&gt;
  &lt;xsd:element name=&quot;letters&quot; type=&quot;letter:FormLetter&quot;/&gt;
  &lt;xsd:complexType name=&quot;FormLetter&quot; mixed=&quot;true&quot;&gt;
    &lt;xsd:sequence&gt;
      &lt;xsd:element name=&quot;date&quot; minOccurs=&quot;0&quot; type=&quot;xsd:string&quot;/&gt;
      &lt;xsd:element name=&quot;firstName&quot; minOccurs=&quot;0&quot; type=&quot;xsd:string&quot;/&gt;
      &lt;xsd:element name=&quot;lastName&quot; minOccurs=&quot;0&quot; type=&quot;xsd:string&quot;/&gt;
    &lt;/xsd:sequence&gt;
  &lt;/xsd:complexType&gt;
&lt;/xsd:schema&gt;</pre>
</div>
    </div>

   </p>
 
   <p class="para">
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;letter:letters xmlns:letter=&quot;http://letterSchema&quot;&gt;
  &lt;date&gt;March 1, 2005&lt;/date&gt;
  Mutual of Omaha
  Wild Kingdom, USA
  Dear
  &lt;firstName&gt;Casy&lt;/firstName&gt;
  &lt;lastName&gt;Crocodile&lt;/lastName&gt;
  Please buy more shark repellent.
  Your premium is past due.
&lt;/letter:letters&gt;</pre>
</div>
    </div>

   </p>
    
   <div class="example" id="example-5478">
    <p><strong>Example #1 Loading, altering, and saving an XML document</strong></p>
    
    <div class="example-contents"><p>
     The following example shows how an XML document can be loaded from a file,
     altered, and written back. 
    </p></div>

    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Load,&nbsp;update,&nbsp;and&nbsp;save&nbsp;an&nbsp;XML&nbsp;document<br />&nbsp;*/<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xsd"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$document&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loadFile</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xml"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$root_data_object&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootDataObject</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$root_data_object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">date&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"September&nbsp;03,&nbsp;2004"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$root_data_object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">firstName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Anantoju"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$root_data_object</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">lastName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Madhu"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveFile</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"letter-out.xml"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"New&nbsp;file&nbsp;has&nbsp;been&nbsp;written:\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;print&nbsp;</span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter-out.xml"</span><span style="color: #007700">);<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">SDO_Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;print(</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">());<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>


    <div class="example-contents"><p>
     An instance of the XML DAS is first obtained from the 
      <span class="function"><a href="sdo-das-xml.create.html" class="function">SDO_DAS_XML::create()</a></span>
     method, 
     which is a static method of the 
     <strong class="classname">SDO_DAS_XML</strong>
     class.
     The location of the xsd is passed as a parameter. 
     Once we have an instance of the XML DAS initialised
     with a given schema,
     we can use it to load the instance document using the 
      <span class="function"><strong>loadFile()</strong></span>
     method.
     There is also a 
      <span class="function"><strong>loadString()</strong></span>
     method if you want to load an XML 
     instance document from a string.
     If the instance document loads successfully, 
     you will be returned an object of type 
     <strong class="classname">SDO_DAS_XML_Document</strong>,
     on which you can call the 
      <span class="function"><strong>getRootDataObject()</strong></span>
     method to get the SDO data object which is the root
     of the SDO data graph. 
     You can then use SDO operations to change the graph. 
     In this example we alter the 
     <var class="varname"><var class="varname">date</var></var>, 
     <var class="varname"><var class="varname">firstName</var></var>, and
     <var class="varname"><var class="varname">lastName</var></var> properties.
     Then we use the 
      <span class="function"><strong>saveFile()</strong></span>
     method to write the changed document back to the file system.
     The saveFile method has an optional extra integer argument which if specified
     will cause the XML DAS to format the XML, using the integer as the amount to 
     indent by at each change in level on the document. 
    </p></div>

    <div class="example-contents"><p>
     This will write the following to <var class="filename">letter-out.xml</var>.
    </p></div>

    <div class="example-contents">
     <div class="xmlcode"><pre class="xmlcode">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;FormLetter xmlns=&quot;http://letterSchema&quot; xsi:type=&quot;FormLetter&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  &lt;date&gt;September 03, 2004&lt;/date&gt;
  Mutual of Omaha
  Wild Kingdom, USA
  Dear
  &lt;firstName&gt;Anantoju&lt;/firstName&gt;
  &lt;lastName&gt;Madhu&lt;/lastName&gt;
  Please buy more shark repellent.
  Your premium is past due.
&lt;/FormLetter&gt;</pre>
</div>
   </div>

    
   </div>

   <div class="example" id="example-5479">

    <p><strong>Example #2 Creating a new XML document</strong></p>

    <div class="example-contents"><p>
     The previous example loaded the document from a file. 
     This example shows how to create an SDO data graph in memory.
     In this example it is then saved to an XML string.
     Furthermore, because the letter contains both structured and 
     unstructured content, it uses
     <a href="sdo.sample.sequence.html" class="link">the Sequence API</a>
     as well assignments to properties to construct the data graph.
    </p></div>

    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Create&nbsp;an&nbsp;XML&nbsp;document&nbsp;from&nbsp;scratch<br />&nbsp;*/<br /></span><span style="color: #007700">try&nbsp;{<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xsd"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$doc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDocument</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$rdo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootDataObject</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$rdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getSequence</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"April&nbsp;09,&nbsp;2005"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'date'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"Acme&nbsp;Inc.&nbsp;"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"United&nbsp;Kingdom.&nbsp;"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"Dear"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"Tarun"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"firstName"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"Nayaraaa"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"lastName"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$rdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">lastName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Nayar"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"Please&nbsp;note&nbsp;that&nbsp;your&nbsp;order&nbsp;number&nbsp;"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #0000BB">12345</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$seq</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">insert</span><span style="color: #007700">(</span><span style="color: #DD0000">"&nbsp;has&nbsp;been&nbsp;dispatched&nbsp;today.&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;business&nbsp;with&nbsp;us."</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveString</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">));<br />&nbsp;&nbsp;&nbsp;}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">SDO_Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print(</span><span style="color: #0000BB">$e</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;}<br />}&nbsp;catch&nbsp;(</span><span style="color: #0000BB">SDO_Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;print(</span><span style="color: #DD0000">"Problem&nbsp;creating&nbsp;an&nbsp;XML&nbsp;document:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$e</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getMessage</span><span style="color: #007700">());<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>


   </div>

   <p class="para">
    The 
     <span class="function"><strong>createDocument()</strong></span>
    method on the XML DAS returns a document object 
    with a single root data object corresponding to an empty document element. 
    The element name of the document element is known from the schema file. 
    If there is any ambiguity about what the document element is, as there can be 
    when more than one schema has been loaded into the same XML DAS, 
    the element name and the namespace URI can be passed to the 
     <span class="function"><strong>createDocument()</strong></span> 
    method.
   </p>

   <p class="para">
    This will emit the following output (line breaks have been inserted for readability):
   </p>

   <div class="example-contents">
     <div class="xmlcode"><pre class="xmlcode">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;FormLetter xmlns=&quot;http://letterSchema&quot; xsi:type=&quot;FormLetter&quot; 
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
&lt;date&gt;April 09, 2005&lt;/date&gt;
Acme Inc. United Kingdom. 
Dear
&lt;firstName&gt;Tarun&lt;/firstName&gt;
&lt;lastName&gt;Nayar&lt;/lastName&gt;
Please note that your order number 12345 has been 
dispatched today. Thanks for your business with us.
&lt;/FormLetter&gt;</pre>
</div>
   </div>



   <div class="example" id="example-5480">

    <p><strong>Example #3 Setting XML document properties</strong></p>

    <div class="example-contents"><p>
     This third example shows you how to set the XML version and
     encoding on the document object. 
     These will be used when the XML is written out.
     If no XML declaration is wanted at all
     (perhaps you want to generate the XML as a string to embed
     in something) then you can use the 
      <span class="function"><strong>setXMLDeclaration()</strong></span>
     method to suppress it. 
    </p></div>

    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Illustrate&nbsp;the&nbsp;calls&nbsp;that&nbsp;control&nbsp;the&nbsp;XML&nbsp;declaration<br />&nbsp;*/<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xsd"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$document&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loadFile</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xml"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setXMLVersion</span><span style="color: #007700">(</span><span style="color: #DD0000">"1.1"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setEncoding</span><span style="color: #007700">(</span><span style="color: #DD0000">"ISO-8859-1"</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;print(</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveString</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>


    <div class="example-contents"><p>
     The XML version and encoding are set in the XML declaration at the top 
     of the XML document.
    </p></div>

    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;?xml version=&quot;1.1&quot; encoding=&quot;utf-8&quot;?&gt;
.../...</pre>
</div>
   </div>

    
   </div>
   
   
   <div class="example" id="example-5481">
    <p><strong>Example #4 Using an open type</strong></p>
    <div class="example-contents"><p>
     This fourth example illustrates the use of an SDO open type 
     and the use of the 
      <span class="function"><strong>createDataObject()</strong></span>
     method.
     For this example we use the following two 
     schema:
   </p></div>
   <div class="example-contents"><p>
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;schema
  xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
  
  &lt;element name=&quot;jungle&quot;&gt;
    &lt;complexType&gt;
      &lt;sequence&gt;
        &lt;any minOccurs=&quot;0&quot; maxOccurs=&quot;unbounded&quot;/&gt;
      &lt;/sequence&gt;
    &lt;/complexType&gt;
  &lt;/element&gt;
  
&lt;/schema&gt;</pre>
</div>
    </div>

   </p></div>

   <div class="example-contents"><p>
     Note the presence of the 
     <var class="varname"><var class="varname">any</var></var> 
     element in the definition.
     This first schema defines the 
     <var class="varname"><var class="varname">jungle</var></var> 
     complex type as containing a sequence of 
     any other type. 
     The other types that the example will use are defined in a 
     second schema file:
    </p></div>
     
   <div class="example-contents"><p>
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;schema xmlns= &quot;http://www.w3.org/2001/XMLSchema&quot;&gt;

   &lt;complexType name=&quot;snakeType&quot;&gt;
     &lt;sequence&gt;
       &lt;element name= &quot;name&quot; type=&quot;string&quot;/&gt;
       &lt;element name= &quot;length&quot; type=&quot;positiveInteger&quot; /&gt;
     &lt;/sequence&gt;
   &lt;/complexType&gt;

   &lt;complexType name=&quot;bearType&quot;&gt;
     &lt;sequence&gt;
       &lt;element name= &quot;name&quot; type=&quot;string&quot;/&gt;
       &lt;element name= &quot;weight&quot; type=&quot;positiveInteger&quot; /&gt;
     &lt;/sequence&gt;
   &lt;/complexType&gt;

   &lt;complexType name=&quot;pantherType&quot;&gt;
     &lt;sequence&gt;
       &lt;element name= &quot;name&quot; type=&quot;string&quot;/&gt;
       &lt;element name= &quot;colour&quot; type=&quot;string&quot; /&gt;
     &lt;/sequence&gt;
   &lt;/complexType&gt;

&lt;/schema&gt;</pre>
</div>
    </div>

   </p></div>
     
   <div class="example-contents"><p>
    Here is the example PHP code that uses these two schema files:
   </p></div>
   
   <div class="example-contents"><p>
    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Illustrate&nbsp;open&nbsp;types&nbsp;and&nbsp;the&nbsp;use&nbsp;of&nbsp;the&nbsp;addTypes()&nbsp;method<br />&nbsp;*/<br /><br /></span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addTypes</span><span style="color: #007700">(</span><span style="color: #DD0000">"jungle.xsd"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;this&nbsp;is&nbsp;an&nbsp;open&nbsp;type&nbsp;i.e.&nbsp;the&nbsp;xsd&nbsp;specifies&nbsp;it&nbsp;can&nbsp;contain&nbsp;"any"&nbsp;type<br /></span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addTypes</span><span style="color: #007700">(</span><span style="color: #DD0000">'animalTypes.xsd'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$baloo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDataObject</span><span style="color: #007700">(</span><span style="color: #DD0000">''</span><span style="color: #007700">,</span><span style="color: #DD0000">'bearType'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$baloo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Baloo"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$baloo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">weight&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">800</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$bagheera&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDataObject</span><span style="color: #007700">(</span><span style="color: #DD0000">''</span><span style="color: #007700">,</span><span style="color: #DD0000">'pantherType'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$bagheera</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">name&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Bagheera"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$bagheera</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">colour&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'inky&nbsp;black'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$kaa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDataObject</span><span style="color: #007700">(</span><span style="color: #DD0000">''</span><span style="color: #007700">,</span><span style="color: #DD0000">'snakeType'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$kaa</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Kaa"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$kaa</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">length&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">25</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$document&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">createDocument</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$do&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootDataObject</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bear&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$baloo</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">panther&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$bagheera</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">snake&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$kaa</span><span style="color: #007700">;<br /><br />print(</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveString</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </p></div>
   <div class="example-contents"><p>
    These two schema files are loaded into the XML DAS with first the 
     <span class="function"><strong>create()</strong></span> 
    and 
     <span class="function"><strong>addTypes()</strong></span>
     methods. 
    The 
     <span class="function"><strong>createDataObject()</strong></span> 
    method is used to create three separate data objects. 
    In each case the namespaceURI and typename of the type are passed to the 
     <span class="function"><strong>createDataObject()</strong></span> 
    method: in this example the namespace URI is blank because no
    namespace is used in the schema. 
    Once the three data objects - representing a bear, a panther and a snake - 
    have been created, a document object is created with the 
     <span class="function"><strong>createDocument()</strong></span> 
    method. 
    In this case there is no ambiguity about what the document element of the
    document should be - as the second schema file only defines complex types, 
    the document element can only be the global 
    <var class="varname"><var class="varname">jungle</var></var> 
    element defined 
    in the first schema. 
    This document will have a single root data object corresponding to an 
    empty document element <var class="varname"><var class="varname">jungle</var></var>. 
    As this is an open type, properties can be added at will. 
    When the first assignment is made to <var class="varname"><var class="varname">$do->bear</var></var>,
    a property 
    <var class="varname"><var class="varname">bear</var></var> 
    is added to the root data object: 
    likewise for the next two assignments.
    When the document is written out by the 
     <span class="function"><strong>saveString()</strong></span> 
    method, the resulting document is:
   </p></div>
   
   <div class="example-contents"><p>
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;jungle xsi:type=&quot;jungle&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt;
  &lt;bear xsi:type=&quot;bearType&quot;&gt;
    &lt;name&gt;Baloo&lt;/name&gt;
    &lt;weight&gt;800&lt;/weight&gt;
  &lt;/bear&gt;
  &lt;panther xsi:type=&quot;pantherType&quot;&gt;
    &lt;name&gt;Bagheera&lt;/name&gt;
    &lt;colour&gt;inky black&lt;/colour&gt;
  &lt;/panther&gt;
  &lt;snake xsi:type=&quot;snakeType&quot;&gt;
    &lt;name&gt;Kaa&lt;/name&gt;
    &lt;length&gt;25&lt;/length&gt;
  &lt;/snake&gt;
&lt;/jungle&gt;</pre>
</div>
    </div>

   </p></div>
       
   </div>

   <div class="example" id="example-5482">

    <p><strong>Example #5 Finding out what you can from the document</strong></p>

    <div class="example-contents"><p>
     This example is intended to illustrate how you can find the 
     element name and 
     namespace of the document element from the XML Document object, and 
     the SDO type and namespace from the root data object of the XML data 
     object, and how they relate to one another.
     This can be difficult to understand because there are four method calls:
     two can be made against the Document object, and two that can be made 
     against any data object including the root data object.
     Because of the rules that define how the SDO model is derived
     from the XML model, when the data object concerned is the 
     root object that represents the document object for the document, 
     only three possible values can come back from these 
     four method calls.
     
    </p></div>

    <div class="example-contents"><p>
     The two method calls that can be made against the document
     are  <span class="function"><strong>getRootElementName()</strong></span> and
      <span class="function"><strong>getRootEelementURI()</strong></span>.
     These return the element name and namespace of the document element,
     respectively. 
    </p></div>
    
    <div class="example-contents"><p>
     The two method calls that can be made against any data object are 
      <span class="function"><strong>getTypeName()</strong></span>
     and 
      <span class="function"><strong>getTypeNamespaceURI()</strong></span>.
     These return the SDO type name and type namespace of the data object, 
     respectively.
    </p></div>
    
    <div class="example-contents"><p>
     Always, calling  <span class="function"><strong>getRootElementURI()</strong></span>
     on the document object will return the same value as 
     calling  <span class="function"><strong>getNamespaceURI()</strong></span> on the
     root data object. 
     Essentially, the information is all derived from the first few lines of the 
     schema file,
     where there are three distinct pieces of information.
     For illustration, here again are the first few lines of the 
     letter.xsd that we used above.
    </p></div>
    
    <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">&lt;xsd:schema xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;
            xmlns:letter=&quot;http://letterSchema&quot;
            targetNamespace=&quot;http://letterSchema&quot;&gt;
            
  &lt;xsd:element name=&quot;letters&quot; type=&quot;letter:FormLetter&quot;/&gt;
  
  &lt;xsd:complexType name=&quot;FormLetter&quot; mixed=&quot;true&quot;&gt;
    .../...</pre>
</div>
    </div>

 
   <div class="example-contents"><p>
    The three important values are:    
    <ul class="itemizedlist">
     <li class="listitem">
      <p class="para">
       <var class="varname"><var class="varname">letters</var></var>, the name of the document element
      </p>
     </li>
     <li class="listitem">
      <p class="para">
       <var class="varname"><var class="varname">FormLetter</var></var>, the name of the complex type of the document element.
       This is also the name of the SDO type of the root data object.
      </p>
     </li>
     <li class="listitem">
      <p class="para">
       <var class="varname"><var class="varname">http://letterSchema</var></var>, the namespace to which the document element belongs.
       This is also the namespaceURI of the SDO type of the root data object.
      </p>
     </li>
    </ul>
    It is part of the XML-SDO mapping rules that 
    when the SDO model is built from the schema file,
    the typename and namespaceURI of the SDO types for the root element
    are taken
    from those of the complex type of the document element, where it exists.
    Hence in this example the typename of the root data object is FormLetter.
    In the event that there is no separate complex type definition
    for the document element, when the type is defined inline and is 
    anonymous, 
    the SDO type name will be the same as the element name. 
   </p></div>
   
   <div class="example-contents"><p>
    The following program loads the letter document and checks the 
    return values from each of the four calls. 
   </p></div> 
    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Finding&nbsp;out&nbsp;what&nbsp;you&nbsp;can&nbsp;about&nbsp;the&nbsp;document&nbsp;and&nbsp;document&nbsp;element<br />&nbsp;*&nbsp;This&nbsp;can&nbsp;be&nbsp;quite&nbsp;hard&nbsp;to&nbsp;understand&nbsp;because&nbsp;there&nbsp;are&nbsp;four&nbsp;calls<br />&nbsp;*&nbsp;Two&nbsp;calls&nbsp;are&nbsp;made&nbsp;against&nbsp;the&nbsp;document<br />&nbsp;*&nbsp;Two&nbsp;calls&nbsp;are&nbsp;made&nbsp;against&nbsp;the&nbsp;root&nbsp;data&nbsp;object&nbsp;and&nbsp;its&nbsp;model<br />&nbsp;*&nbsp;Because&nbsp;of&nbsp;the&nbsp;SDO-XML&nbsp;mapping&nbsp;rules&nbsp;and&nbsp;how&nbsp;the&nbsp;SDO&nbsp;model&nbsp;is&nbsp;derived<br />&nbsp;*&nbsp;from&nbsp;the&nbsp;XML&nbsp;model,&nbsp;only&nbsp;three&nbsp;possible&nbsp;values&nbsp;can&nbsp;come&nbsp;back&nbsp;from&nbsp;these&nbsp;four&nbsp;calls.<br />&nbsp;*&nbsp;Always,&nbsp;$document-&gt;getRootElementURI()&nbsp;==&nbsp;(type&nbsp;of&nbsp;root&nbsp;data&nbsp;object)-&gt;namespaceURI&nbsp;<br />&nbsp;*&nbsp;Essentially,&nbsp;it&nbsp;all&nbsp;comes&nbsp;form&nbsp;the&nbsp;first&nbsp;few&nbsp;lines&nbsp;of&nbsp;the&nbsp;xsd:<br />&nbsp;*&nbsp;&lt;xsd:schema&nbsp;xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br />&nbsp;*&nbsp;&nbsp;&nbsp;xmlns:letter="http://letterSchema"<br />&nbsp;*&nbsp;&nbsp;&nbsp;targetNamespace="http://letterSchema"&gt;<br />&nbsp;*&nbsp;&nbsp;&nbsp;&lt;xsd:element&nbsp;name="letters"&nbsp;type="letter:FormLetter"/&gt;<br />&nbsp;*/<br /><br /></span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xsd"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$document&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">loadFile</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xml"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$root_do&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootDataObject</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;The&nbsp;"root&nbsp;element&nbsp;name"&nbsp;is&nbsp;the&nbsp;element&nbsp;name&nbsp;of&nbsp;the&nbsp;document&nbsp;element<br />&nbsp;*&nbsp;in&nbsp;this&nbsp;case&nbsp;'letters'<br />&nbsp;*&nbsp;This&nbsp;matches&nbsp;the&nbsp;'name'&nbsp;attribute&nbsp;of&nbsp;the&nbsp;document&nbsp;element&nbsp;in&nbsp;the&nbsp;xsd&nbsp;and&nbsp;matches<br />&nbsp;*&nbsp;the&nbsp;element&nbsp;name&nbsp;from&nbsp;the&nbsp;xml<br />&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;document&nbsp;element&nbsp;name&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootElementName</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootElementName</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #DD0000">'letters'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;a&nbsp;property&nbsp;of&nbsp;the&nbsp;document<br /><br />/**<br />&nbsp;*&nbsp;The&nbsp;"root&nbsp;element&nbsp;URI"&nbsp;is&nbsp;the&nbsp;namespace&nbsp;part&nbsp;of&nbsp;the&nbsp;element&nbsp;name&nbsp;of&nbsp;the&nbsp;document&nbsp;element<br />&nbsp;*&nbsp;in&nbsp;this&nbsp;case&nbsp;'http://letterSchema'&nbsp;since&nbsp;'letters'&nbsp;is&nbsp;in&nbsp;that&nbsp;namespace<br />&nbsp;*&nbsp;This&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;xsd&nbsp;and&nbsp;matches&nbsp;the&nbsp;namespace&nbsp;picked&nbsp;up&nbsp;from&nbsp;the&nbsp;xml<br />&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;document&nbsp;element&nbsp;is&nbsp;in&nbsp;the&nbsp;namespace&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootElementURI</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">$document</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getRootElementURI</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #DD0000">'http://letterSchema'</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;a&nbsp;property&nbsp;of&nbsp;the&nbsp;document<br /><br />/**<br />&nbsp;*&nbsp;The&nbsp;type&nbsp;name&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;SDO&nbsp;model<br />&nbsp;*&nbsp;The&nbsp;XML-SDO&nbsp;mapping&nbsp;rules&nbsp;make&nbsp;this&nbsp;either:<br />&nbsp;*&nbsp;&nbsp;&nbsp;The&nbsp;name&nbsp;of&nbsp;the&nbsp;complexType&nbsp;if&nbsp;there&nbsp;is&nbsp;one&nbsp;(in&nbsp;this&nbsp;case&nbsp;there&nbsp;is)<br />&nbsp;*&nbsp;&nbsp;&nbsp;The&nbsp;document&nbsp;element&nbsp;name&nbsp;if&nbsp;there&nbsp;no&nbsp;complexType<br />&nbsp;*&nbsp;This&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;xsd&nbsp;<br />&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;type&nbsp;name&nbsp;of&nbsp;the&nbsp;root&nbsp;data&nbsp;object&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$root_do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTypeName</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">$root_do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTypeName</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #DD0000">'FormLetter'</span><span style="color: #007700">);&nbsp;&nbsp;<br /><br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;The&nbsp;type's&nbsp;namespaceURI&nbsp;is&nbsp;taken&nbsp;from&nbsp;the&nbsp;SDO&nbsp;model<br />&nbsp;*&nbsp;The&nbsp;XML-SDO&nbsp;mapping&nbsp;rules&nbsp;ensure&nbsp;that&nbsp;this&nbsp;will&nbsp;always&nbsp;be&nbsp;the&nbsp;same&nbsp;as&nbsp;<br />&nbsp;*&nbsp;the&nbsp;namepace&nbsp;URI&nbsp;of&nbsp;the&nbsp;document&nbsp;element<br />&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;namespaceURI&nbsp;of&nbsp;the&nbsp;root&nbsp;data&nbsp;object&nbsp;is&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$root_do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTypeNamespaceURI</span><span style="color: #007700">()&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">assert</span><span style="color: #007700">(</span><span style="color: #0000BB">$root_do</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTypeNamespaceURI</span><span style="color: #007700">()&nbsp;==&nbsp;</span><span style="color: #DD0000">'http://letterSchema'</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>
     The output from this program is as follows:
   </p></div>
   <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">The document element name is letters
The document element is in the namespace http://letterSchema
The type name of the root data object is FormLetter
The namespaceURI of the root data object is http://letterSchema</pre>
</div>
   </div>

    
   </div>
   
   <div class="example" id="example-5483">

    <p><strong>Example #6 Printing the SDO model</strong></p>

    <div class="example-contents"><p>
     The XML DAS provides a simple means to see what types and properties 
     have been loaded. The php &quot;print&quot; or &quot;echo&quot; instruction will 
     print out the types and properties. 
    </p></div>

    <div class="example-contents">
     <div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/**<br />&nbsp;*&nbsp;Illustrate&nbsp;printing&nbsp;out&nbsp;the&nbsp;model<br />&nbsp;*/<br /><br /></span><span style="color: #0000BB">$xmldas&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">SDO_DAS_XML</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">(</span><span style="color: #DD0000">"letter.xsd"</span><span style="color: #007700">);<br />print&nbsp;</span><span style="color: #0000BB">$xmldas</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>


    <div class="example-contents"><p>
     The output from this program is as follows:
   </p></div>
   <div class="example-contents">
<div class="xmlcode"><pre class="xmlcode">object(SDO_XML_DAS)#1 {
18 types have been defined. The types and their properties are::
1. commonj.sdo:BigDecimal
2. commonj.sdo:BigInteger
3. commonj.sdo:Boolean
4. commonj.sdo:Byte
5. commonj.sdo:Bytes
6. commonj.sdo:ChangeSummary
7. commonj.sdo:Character
8. commonj.sdo:DataObject
9. commonj.sdo:Date
10. commonj.sdo:Double
11. commonj.sdo:Float
12. commonj.sdo:Integer
13. commonj.sdo:Long
14. commonj.sdo:Short
15. commonj.sdo:String
16. commonj.sdo:URI
17. http://letterSchema:FormLetter
    - date (commonj.sdo:String)
    - firstName (commonj.sdo:String)
    - lastName (commonj.sdo:String)
18. http://letterSchema:RootType
    - letters (http://letterSchema:FormLetter)</pre>
</div>
   </div>


   </div>

   
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="sdo-das-xml.constants.html">Predefined Constants</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.sdo-das-xml.html">SDO DAS XML Functions</a></div>
 <div class="up"><a href="book.sdo-das-xml.html">SDO DAS XML</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>