cvs: phpdoc /en/reference/sdo_das_xml reference.xml /en/reference/sdo_das_xml/functions SDO-DAS-XML-Document-getEncoding.xml
SDO-DAS-XML-Document-getNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-getSchemaLocation.xml SDO-DAS-XML-Document-getXMLDeclaration.xml
SDO-DAS-XML-Document-getXMLVersion.xml SDO-DAS-XML-Document-setNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-setSchemaLocation.xml
SDO-DAS-XML-Document-setXMLDeclaration.xml SDO-DAS-XML-addTypes.xml SDO-DAS-XML-create.xml SDO-DAS-XML-createDocument.xml SDO-DAS-XML-loadFile.xml
SDO-DAS-XML-loadFromFile.xml SDO-DAS-XML-loadFromString.xml SDO-DAS-XML-loadString.xml SDO-DAS-XML-saveDataObjectToFile.xml
SDO-DAS-XML-saveDataObjectToString.xml SDO-DAS-XML-saveDocumentToFile.xml SDO-DAS-XML-saveDocumentToString.xml SDO-DAS-XML-saveFile.xml
SDO-DAS-XML-saveString.xml

From: Date: Tue, 21 Feb 2006 16:13:49 +0000
Subject: cvs: phpdoc /en/reference/sdo_das_xml reference.xml /en/reference/sdo_das_xml/functions SDO-DAS-XML-Document-getEncoding.xml
SDO-DAS-XML-Document-getNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-getSchemaLocation.xml SDO-DAS-XML-Document-getXMLDeclaration.xml
SDO-DAS-XML-Document-getXMLVersion.xml SDO-DAS-XML-Document-setNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-setSchemaLocation.xml
SDO-DAS-XML-Document-setXMLDeclaration.xml SDO-DAS-XML-addTypes.xml SDO-DAS-XML-create.xml SDO-DAS-XML-createDocument.xml SDO-DAS-XML-loadFile.xml
SDO-DAS-XML-loadFromFile.xml SDO-DAS-XML-loadFromString.xml SDO-DAS-XML-loadString.xml SDO-DAS-XML-saveDataObjectToFile.xml
SDO-DAS-XML-saveDataObjectToString.xml SDO-DAS-XML-saveDocumentToFile.xml SDO-DAS-XML-saveDocumentToString.xml SDO-DAS-XML-saveFile.xml
SDO-DAS-XML-saveString.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969372023@lists.php.net to get a copy of this message
mfp Tue Feb 21 16:13:49 2006 UTC Added files: /phpdoc/en/reference/sdo_das_xml/functions SDO-DAS-XML-saveString.xml SDO-DAS-XML-addTypes.xml SDO-DAS-XML-createDocument.xml SDO-DAS-XML-loadFile.xml SDO-DAS-XML-saveFile.xml SDO-DAS-XML-loadString.xml Removed files: /phpdoc/en/reference/sdo_das_xml/functions SDO-DAS-XML-Document-setNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-setSchemaLocation.xml SDO-DAS-XML-saveDocumentToString.xml SDO-DAS-XML-Document-getNoNamespaceSchemaLocation.xml SDO-DAS-XML-Document-getXMLVersion.xml SDO-DAS-XML-saveDocumentToFile.xml SDO-DAS-XML-saveDataObjectToString.xml SDO-DAS-XML-loadFromFile.xml SDO-DAS-XML-loadFromString.xml SDO-DAS-XML-Document-getXMLDeclaration.xml SDO-DAS-XML-saveDataObjectToFile.xml SDO-DAS-XML-Document-getSchemaLocation.xml SDO-DAS-XML-Document-getEncoding.xml Modified files: /phpdoc/en/reference/sdo_das_xml/functions SDO-DAS-XML-create.xml SDO-DAS-XML-Document-setXMLDeclaration.xml /phpdoc/en/reference/sdo_das_xml reference.xml Log: Numerous changes to document the RELEASE_0_9_0 version of the API for the XML DAS

http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml diff -u phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml:1.4 phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml:1.5 --- phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml:1.4 Sun Dec 18 16:44:49 2005 +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-create.xml Tue Feb 21 16:13:49 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-create"> <refnamediv> @@ -12,7 +12,7 @@ &reftitle.description; <methodsynopsis> <type>SDO_DAS_XML</type><methodname>SDO_DAS_XML::create</methodname> - <methodparam><type>string</type><parameter>xsd_file</parameter></methodparam> + <methodparam choice="opt"><type>string</type><parameter>xsd_file</parameter></methodparam> </methodsynopsis> &warn.experimental.func; @@ -32,7 +32,9 @@ </term> <listitem> <para> - Path to XSD Schema file. + Path to XSD Schema file. This is optional. If omitted a DAS will be created + that only has the SDO base types defined. Schema files can then be loaded + with the <function>addTypes</function> method. </para> </listitem> </varlistentry> @@ -66,7 +68,17 @@ </term> <listitem> <para> - Thrown for any symantical problems while parsing the given XSD File. + Thrown for any problems while parsing the given XSD File. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <parameter>SDO_DAS_XML_FileException</parameter> + </term> + <listitem> + <para> + Thrown if the specified file cannot be found. </para> </listitem> </varlistentry> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml diff -u phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml:1.4 phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml:1.5 --- phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml:1.4 Sun Dec 18 16:44:49 2005 +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-Document-setXMLDeclaration.xml Tue Feb 21 16:13:49 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-Document-setXMLDeclaration"> <refnamediv> @@ -17,8 +17,9 @@ &warn.experimental.func; <para> - Sets the given boolean value for xml declaration. - Pass TRUE to set it and FLASE to not to unset it. + Controls whether an XML declaration will be generated at the start of the + XML document. Set to <varname>true</varname> to generate the XML declaration, + or <varname>false</varname> to suppress it. </para> </refsect1> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/reference.xml?r1=1.14&r2=1.15&diff_format=u Index: phpdoc/en/reference/sdo_das_xml/reference.xml diff -u phpdoc/en/reference/sdo_das_xml/reference.xml:1.14 phpdoc/en/reference/sdo_das_xml/reference.xml:1.15 --- phpdoc/en/reference/sdo_das_xml/reference.xml:1.14 Sun Dec 18 16:43:56 2005 +++ phpdoc/en/reference/sdo_das_xml/reference.xml Tue Feb 21 16:13:49 2006 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <!-- Purpose: xml --> <!-- Membership: pecl --> <!-- State: experimental --> @@ -26,13 +26,17 @@ <para> The job of the XML DAS is to move data between the application and an XML data source, which can be either a file or - a URL. In order to do this it needs to be told the location of the - XML schema, which is passed as a parameter to the create - method of the XML DAS. - The schema is used to ensure conformance - of XML being written out, and also to ensure that - modifications made to an SDO originating from XML - follow the model described by the XML schema. + a URL. SDOs are always created and maintained according to a model + which defines type names and what property names each type may have. + For data which is from XML, this SDO model is built from a schema file + written in XML schema language (an xsd file). This schema file is + usually passed to the create method when the XMLDAS is initialised. + The + <ulink url='&url.ibm.sdo;'>SDO 2.0 specification</ulink> + defines the mapping between XML types and SDO types. + There are a number of small limitations in the PHP support - + not everything which is in the specification can be done - and + these limitations are summarised in a later section. </para> </section> @@ -57,192 +61,10 @@ </para> </section> - - <section id='sdo-das-xml.limitations'> - <title>Limitations</title> - <para> - The - <ulink url='&url.ibm.sdo;'>SDO 2.0 specification</ulink> - defines the mapping between XML types and SDO types. - With Java SDO, this mapping is implemented by the XMLHelper. - With SDO for PHP, this mapping is implemented by the - XML Data Access Services. - The XML DAS implements the mapping described in the - SDO 2.0 specification with the following restrictions: - </para> - - <procedure id='sdo-das-xml.limitations.simpletypes'> - <title>XML Simple Types</title> - <step> - <para> - Simple Type with abstract="true" - - no PHP support for SDO abstract types. - </para> - </step> - <step> - <para> - Simple Type with sdoJava:instanceClass - - no PHP equivalent provided. - </para> - </step> - <step> - <para> - Simple Type with sdoJava:extendedInstanceClass - - no PHP equivalent provided. - </para> - </step> - <step> - <para> - Simple Type with list of itemType. - </para> - </step> - <step> - <para> - Simple Type with union. - </para> - </step> - </procedure> - - <procedure id='sdo-das-xml.limitations.complextypes'> - <title>XML Complex Types</title> - <step> - <para> - Complex Type with abstract="true" - - no PHP support for SDO abstract types. - </para> - </step> - <step> - <para> - Complex Type with sdo:aliasName - - no PHP support for SDO Type aliases. - </para> - </step> - <step> - <para> - Complex Type with open content - - no PHP support for SDO open types. - </para> - </step> - <step> - <para> - Complex Type with open attribute - - no PHP support for SDO open types. - </para> - </step> - </procedure> - - <procedure id='sdo-das-xml.limitations.attribute'> - <title>XSD Attribute</title> - <step> - <para> - Attribute with sdo:aliasName - - no PHP support for SDO property aliases. - </para> - </step> - <step> - <para> - Attribute with default value - - no PHP support for SDO property defaults. - </para> - </step> - <step> - <para> - Attribute with fixed value - - no PHP support for SDO read-only properties or default values. - </para> - </step> - <step> - <para> - Attribute reference. - </para> - </step> - <step> - <para> - Attribute with sdo:string - - no support for sdo:string="true". - </para> - </step> - <step> - <para> - Attribute referencing a DataObject with - sdo:propertyType - no support for sdo:propertyType="...". - </para> - </step> - <step> - <para> - Attribute with bi-directional property to a DataObject with - sdo:oppositeProperty and sdo:propertyType - - no PHP support for SDO opposite. - </para> - </step> - </procedure> - - <procedure id='sdo-das-xml.limitations.elements'> - <title>XSD Elements</title> - <step> - <para> - Element with sdo:aliasName - - no PHP support for SDO property aliases. - </para> - </step> - <step> - <para> - Element reference. - </para> - </step> - <step> - <para> - Element with nillable. - </para> - </step> - <step> - <para> - Element with substitution group. - </para> - </step> - </procedure> - - <procedure id='sdo-das-xml.limitations.elementsimpletype'> - <title>XSD Elements with Simple Type</title> - <step> - <para> - Element of SimpleType with default - - no PHP support for SDO defaults - </para> - </step> - <step> - <para> - Element of SimpleType with fixed value - - no PHP support for SDO read-only properties or default values. - </para> - </step> - <step> - <para> - Element of SimpleType with sdo:string - - no support for sdo:string="true". - </para> - </step> - <step> - <para> - Element referencing a DataObject with - sdo:propertyType - no support for sdo:propertyType="..." - </para> - </step> - <step> - <para> - Element with bi-directional reference to a DataObject with - sdo:oppositeProperty and sdo:propertyType - - no PHP support for SDO opposite. - </para> - </step> - </procedure> - </section> - - <section id='sdo-das-xml.examples'> &reftitle.examples; <para> - The following examples are based on the + Several of the following examples are based on the <link linkend="sdo.sample.sequence">letter example</link> described in the <link linkend="ref.sdo">SDO documentation</link>. @@ -290,29 +112,34 @@ <example> <title>Loading, altering, and saving an XML document</title> + <para> The following example shows how an XML document can be loaded from a file, altered, and written back. </para> + <programlisting role="php" id="sdo-das-xml.examples.loadfromfile"> <![CDATA[ <?php +/** + * Load, update, and save an XML document + */ try { - $xmldas = SDO_DAS_XML::create("letter.xsd"); - $xdoc = $xmldas->loadFromFile("letter.xml"); - $do = $xdoc->getRootDataObject(); - $do->date = "September 03, 2004"; - $do->firstName = "Anantoju"; - $do->lastName = "Madhu"; - $xmldas->saveDocumentToFile($xdoc, "letter-out.xml"); -} catch (SDO_TypeNotFoundException $e) { - print("Type is not defined in the xsd file"); -} catch (SDO_DAS_XML_ParserException $e) { - print("Problem while parsing"); + $xmldas = SDO_DAS_XML::create("letter.xsd"); + $document = $xmldas->loadFile("letter.xml"); + $root_data_object = $document->getRootDataObject(); + $root_data_object->date = "September 03, 2004"; + $root_data_object->firstName = "Anantoju"; + $root_data_object->lastName = "Madhu"; + $xmldas->saveFile($document, "letter-out.xml"); + echo "New file has been written:\n"; + print file_get_contents("letter-out.xml"); +} catch (SDO_Exception $e) { + print($e->getMessage()); } -?> -]]> +?> ]]> </programlisting> + <para> An instance of the XML DAS is first obtained from the <function>SDO_DAS_XML::create</function> @@ -324,10 +151,10 @@ 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 - <function>loadFromFile</function> + <function>loadFile</function> method. There is also a - <function>loadFromString</function> + <function>loadString</function> method if you want to load an XML instance document from a string. If the instance document loads successfully, @@ -343,12 +170,17 @@ <varname>firstName</varname>, and <varname>lastName</varname> properties. Then we use the - <function>saveDocumentToFile</function> + <function>saveFile</function> 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. </para> + <para> This will write the following to <filename>letter-out.xml</filename>. </para> + <programlisting role="xml" id="sdo-das-xml.examples.loadfromfile.output"> <![CDATA[ <?xml version="1.0" encoding="UTF-8"?> @@ -366,8 +198,11 @@ </programlisting> </example> + <example> + <title>Creating a new XML document</title> + <para> The previous example loaded the document from a file. This example shows how to create an SDO data graph in memory. @@ -377,40 +212,57 @@ <link linkend="sdo.sample.sequence">the Sequence API</link> as well assignments to properties to construct the data graph. </para> + <programlisting role="php" id="sdo-das-xml.examples.create"> <![CDATA[ -<?php +<?php +/** + * Create an XML document from scratch + */ try { - $xmldas = SDO_DAS_XML::create("letter.xsd"); - try { - $letter = $xmldas->createDataObject("http://letterSchema", "FormLetter"); - $letter_seq = $letter->getSequence(); - $letter_seq->insert("April 09, 2005", NULL, 'date'); - $letter_seq->insert("Acme Inc. ", NULL, NULL); - $letter_seq->insert("United Kingdom. "); - $letter_seq->insert("Dear", NULL, NULL); - $letter_seq->insert("Tarun", NULL, "firstName"); - $letter_seq->insert("Nayaraaa", NULL, "lastName"); - $letter->lastName = "Nayar"; - $letter_seq->insert("Please note that your order number "); - $letter_seq->insert(12345); - $letter_seq->insert(" has been dispatched today. Thanks for your business with us."); - print($xmldas->saveDataObjectToString($letter, "http://letterSchema", "FormLetter")); - } catch (SDO_Exception $e) { - print($e); - } -} catch (SDO_TypeNotFoundException $e) { - print("Type is not defined in the xsd file"); -} catch (SDO_DAS_XML_ParserException $e) { - print("Problem while parsing"); -} -?> -]]> + $xmldas = SDO_DAS_XML::create("letter.xsd"); + try { + $doc = $xmldas->createDocument(); + $rdo = $doc->getRootDataObject(); + $seq = $rdo->getSequence(); + $seq->insert("April 09, 2005", NULL, 'date'); + $seq->insert("Acme Inc. ", NULL, NULL); + $seq->insert("United Kingdom. "); + $seq->insert("Dear", NULL, NULL); + $seq->insert("Tarun", NULL, "firstName"); + $seq->insert("Nayaraaa", NULL, "lastName"); + $rdo->lastName = "Nayar"; + $seq->insert("Please note that your order number "); + $seq->insert(12345); + $seq->insert(" has been dispatched today. Thanks for your business with us."); + print($xmldas->saveString($doc)); + } catch (SDO_Exception $e) { + print($e); + } +} catch (SDO_Exception $e) { + print("Problem creating an XML document: " . $e->getMessage()); +}]]> </programlisting> + </example> + + <para> + The + <function>createDocument</function> + 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 + <function>createDocument</function> + method. + </para> + <para> This will emit the following output (line breaks have been inserted for readability): </para> + <programlisting role="xml" id="sdo-das-xml.examples.create.output"> <![CDATA[ <?xml version="1.0" encoding="UTF-8"?> @@ -426,47 +278,456 @@ </FormLetter> ]]> </programlisting> + + <example> + <title>Setting XML document properties</title> + <para> - This third example shows you how to use the SDO_DAS_XML_Document class. - SDO_DAS_XML_Document class is provided to get and set - properties of the XML declaration such as version, schema location, - encoding and so on. + 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 + <function>setXMLDeclaration</function> + method to suppress it. </para> - <programlisting role="php" id="sdo-das-xml.examples.sdo_das_xml_document"> + + <programlisting role="php" id="sdo-das-xml.examples.Example3"> <![CDATA[ <?php -try { - $xmldas = SDO_DAS_XML::create("letter.xsd"); - $xdoc = $xmldas->loadFromFile("letter.xml"); - print("Encoding is set to : " . $xdoc->getEncoding() . "\n"); - print("XML Version : " . $xdoc->getXMLVersion() . "\n"); - $xdoc->setXMLVersion("1.1"); - print($xmldas->saveDocumentToString($xdoc)); -} catch (SDO_TypeNotFoundException $e) { - print("Type is not defined in the xsd file"); -} catch (SDO_DAS_XML_ParserException $e) { - print("Problem while parsing"); -} -?> +/** + * Illustrate the calls that control the XML declaration + */ + $xmldas = SDO_DAS_XML::create("letter.xsd"); + $document = $xmldas->loadFile("letter.xml"); + $document->setXMLVersion("1.1"); + $document->setEncoding("ISO-8859-1"); + print($xmldas->saveString($document)); +?> ]]> + </programlisting> + + <para> + The XML version and encoding are set in the XML declaration at the top + of the XML document. + </para> + + <programlisting role="xml" id="sdo-das-xml.examples.sdo_das_xml_document.output"> +<![CDATA[ +<?xml version="1.1" encoding="ISO-8859-1"?> +.../... +]]> + </programlisting> + + </example> + + + <example> + <title>Using an open type</title> + <para> + This fourth example illustrates the use of an SDO open type + and the use of the + <function>createDataObject</function> + method. + For this example we use the following two + schema: + </para> + <para> + <programlisting role="xml"> +<![CDATA[ +<schema + xmlns="http://www.w3.org/2001/XMLSchema"> + + <element name="jungle"> + <complexType> + <sequence> + <any minOccurs="0" maxOccurs="unbounded"/> + </sequence> + </complexType> + </element> + +</schema> ]]> </programlisting> + </para> + + <para> + Note the presence of the + <varname>any</varname> + element in the definition. + This first schema defines the + <varname>jungle</varname> + 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: + </para> + <para> - The first three lines of output show how the encoding and - XML version has been obtained from the document, - and how the XML version has been set in the XML header. + <programlisting role="xml"> +<![CDATA[ +<schema xmlns= "http://www.w3.org/2001/XMLSchema"> + + <complexType name="snakeType"> + <sequence> + <element name= "name" type="string"/> + <element name= "length" type="positiveInteger" /> + </sequence> + </complexType> + + <complexType name="bearType"> + <sequence> + <element name= "name" type="string"/> + <element name= "weight" type="positiveInteger" /> + </sequence> + </complexType> + + <complexType name="pantherType"> + <sequence> + <element name= "name" type="string"/> + <element name= "colour" type="string" /> + </sequence> + </complexType> + +</schema> +]]> + </programlisting> + </para> + + <para> + Here is the example PHP code that uses these two schema files: + </para> + + <para> + <programlisting role="php" id="sdo-das-xml.examples.Example4"> + <![CDATA[ +<?php + +/** + * Illustrate open types and the use of the addTypes() method + */ + +$xmldas = SDO_DAS_XML::create(); +$xmldas->addTypes("jungle.xsd"); // this is an open type i.e. the xsd specifies it can contain "any" type +$xmldas->addTypes('animalTypes.xsd'); + +$baloo = $xmldas->createDataObject('','bearType'); +$baloo->name = "Baloo"; +$baloo->weight = 800; + +$bagheera = $xmldas->createDataObject('','pantherType'); +$bagheera->name = "Bagheera"; +$bagheera->colour = 'inky black'; + +$kaa = $xmldas->createDataObject('','snakeType'); +$kaa->name = "Kaa"; +$kaa->length = 25; + +$document = $xmldas->createDocument(); +$do = $document->getRootDataObject(); +$do->bear = $baloo; +$do->panther = $bagheera; +$do->snake = $kaa; + +print($xmldas->saveString($document,2)); + +?> + ]]> + </programlisting> + </para> + <para> + These two schema files are loaded into the XML DAS with first the + <function>create</function> + and + <function>addTypes</function> + methods. + The + <function>createDataObject</function> + method is used to create three separate data objects. + In each case the namespaceURI and typename of the type are passed to the + <function>createDataObject</function> + 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 + <function>createDocument</function> + 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 + <varname>jungle</varname> + element defined + in the first schema. + This document will have a single root data object corresponding to an + empty document element <varname>jungle</varname>. + As this is an open type, properties can be added at will. + When the first assignment is made to <varname>$do->bear</varname>, + a property + <varname>bear</varname> + is added to the root data object: + likewise for the next two assignments. + When the document is written out by the + <function>saveString</function> + method, the resulting document is: </para> - <programlisting role="xml" id="sdo-das-xml.examples.sdo_das_xml_document.output"> + + <para> + <programlisting role="xml"> <![CDATA[ -Encoding is set to : UTF-8 -XML Version : 1.0 -<?xml version="1.1" encoding="UTF-8"?> -... +<?xml version="1.0" encoding="UTF-8"?> +<jungle xsi:type="jungle" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <bear xsi:type="bearType"> + <name>Baloo</name> + <weight>800</weight> + </bear> + <panther xsi:type="pantherType"> + <name>Bagheera</name> + <colour>inky black</colour> + </panther> + <snake xsi:type="snakeType"> + <name>Kaa</name> + <length>25</length> + </snake +]]> + </programlisting> + </para> + + </example> + + <example> + + <title>Finding out what you can from the document</title> + + <para> + 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. + + </para> + + <para> + The two method calls that can be made against the document + are <function>getRoot|ElementName(</function> and + <function>getRootEelementURI</function>. + These return the element name and namespace of the document element, + respectively. + </para> + + <para> + The two method calls that can be made against any data object are + <function>getTypeName</function> + and + <function>getTypeNamespaceURI</function>. + These return the SDO type name and type namespace of the data object, + respectively. + </para> + + <para> + Always, calling <function>getRootElementURI</function> + on the document object will return the same value as + calling <function>getNamespaceURI</function> 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. + </para> + + <programlisting role="xml"> +<![CDATA[ +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:letter="http://letterSchema" + targetNamespace="http://letterSchema"> + + <xsd:element name="letters" type="letter:FormLetter"/> + + <xsd:complexType name="FormLetter" mixed="true"> + .../... +]]> + </programlisting> + + <para> + The three important values are: + <itemizedlist> + <listitem> + <para> + <varname>letters</varname>, the name of the document element + </para> + </listitem> + <listitem> + <para> + <varname>FormLetter</varname>, the name of the complex type of the document element. + This is also the name of the SDO type of the root data object. + </para> + </listitem> + <listitem> + <para> + <varname>http://letterSchema</varname>, the namespace to which the document element belongs. + This is also the namespaceURI of the SDO type of the root data object. + </para> + </listitem> + </itemizedlist> + 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 the type is defined inline and is + anonymous, + the SDO type name will be the same as the element name. + </para> + + <para> + The following program loads the letter document and checks the + return values from each of the four calls. + </para> + <programlisting role="php" id="sdo-das-xml.examples.Example5"> + <![CDATA[ +<?php +/** + * Finding out what you can about the document and document element + * This can be quite hard to understand because there are four calls + * Two calls are made against the document + * Two calls are made against the root data object and its model + * Because of the SDO-XML mapping rules and how the SDO model is derived + * from the XML model, only three possible values can come back from these four calls. + * Always, $document->getRootElementURI() == (type of root data object)->namespaceURI + * Essentially, it all comes form the first few lines of the xsd: + * <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" + * xmlns:letter="http://letterSchema" + * targetNamespace="http://letterSchema"> + * <xsd:element name="letters" type="letter:FormLetter"/> + */ + +$xmldas = SDO_DAS_XML::create("letter.xsd"); +$document = $xmldas->loadFile("letter.xml"); +$root_do = $document->getRootDataObject(); + +/** + * The "root element name" is the element name of the document element + * in this case 'letters' + * This matches the 'name' attribute of the document element in the xsd and matches + * the element name from the xml + */ +echo "The document element name is " . $document->getRootElementName() . "\n"; +assert($document->getRootElementName() == 'letters'); // a property of the document + +/** + * The "root element URI" is the namespace part of the element name of the document element + * in this case 'http://letterSchema' since 'letters' is in that namespace + * This is taken from the xsd and matches the namespace picked up from the xml + */ +echo "The document element is in the namespace " . $document->getRootElementURI() . "\n"; +assert($document->getRootElementURI() == 'http://letterSchema'); // a property of the document + +/** + * The type name is taken from the SDO model + * The XML-SDO mapping rules make this either: + * The name of the complexType if there is one (in this case there is) + * The document element name if there no complexType + * This is taken from the xsd + */ +echo "The type name of the root data object is " . $root_do->getTypeName() . "\n"; +assert($root_do->getTypeName() == 'FormLetter'); + +/** + * The type's namespaceURI is taken from the SDO model + * The XML-SDO mapping rules ensure that this will always be the same as + * the namepace URI of the document element + */ +echo "The namespaceURI of the root data object is " . $root_do->getTypeNamespaceURI() . "\n"; +assert($root_do->getTypeNamespaceURI() == 'http://letterSchema'); + +?> + ]]> + </programlisting> + <para> + The output from this program is as follows: + </para> + <programlisting role="xml" id="sdo-das-xml.examples.Example5.output"> +<![CDATA[ +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 ]]> </programlisting> </example> + + <example> + + <title>Printing the SDO model</title> + + <para> + The XML DAS provides a simple means to see what types and properties + have been loaded. The php "print" or "echo" instruction will + print out the types and properties. + </para> + + <programlisting role="php" id="sdo-das-xml.examples.Example6"> + <![CDATA[ +<?php +/** + * Illustrate printing out the model + */ + +$xmldas = SDO_DAS_XML::create("letter.xsd"); +print $xmldas; + +?> +]]> + </programlisting> + + <para> + The output from this program is as follows: + </para> + <programlisting role="xml" id="sdo-das-xml.examples.Example6.output"> +<![CDATA[ +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) +]]> + </programlisting> + + </example> + + </section> @@ -474,14 +735,16 @@ <section id='sdo-das-xml.classes'> &reftitle.classes; <para> - The XML DAS provides three classes. - The SDO_DAS_XML which is the main class used to fetch the - data from the XML source and also can used to write the data back. - The next one is SDO_DAS_XML_Document class, - which is basically useful to get/set the XML declarations such as - encoding, version etc. - And the last class is SDO_DAS_XML_ParserException which will - be thrown for any parser exceptions while loading xsd/xml file. + The XML DAS provides two main classes. + The first is SDO_DAS_XML which is the main class used to fetch the + data from the XML source and used to write the data back. + The second is the SDO_DAS_XML_Document class, + which represents the data in the XML document. + </para> + <para> + There are also some exception classes which can be thrown + if errors are found when looking for or parsing the xsd or + xml files. </para> <section id='sdo-das-xml.class.sdo_das_xml'> @@ -489,70 +752,72 @@ <classname>SDO_DAS_XML</classname> </title> <para> - This is the main class of XML DAS, + This is the main class of the XML DAS, which is used fetch the data from the xml source and also used to write the data back. Other than the methods to load and save xml files, - it also has a method called createDataObject - which can be used to create an empty DataObject of a given type. </para> <section id='sdo-das-xml.class.SDO_DAS_XML.methods'> &reftitle.methods; + <itemizedlist> + <listitem> <para> <link linkend='function.SDO-DAS-XML-create'>create</link> - This is the only static method available in SDO_DAS_XML class. - Used to construct SDO_DAS_XML object. + This is a static method available in the SDO_DAS_XML class. + Used to construct an SDO_DAS_XML object. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-createDataObject'>createDataObject</link> - Can be used to construct the DataObject of a given type. + <link linkend='function.SDO-DAS-XML-addTypes'>addTypes</link> + Works in much the same way as <function>create</function> but used + to add the contents of a second or subsequent schema file to + an XML DAS that has already been created. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-loadFromFile'>loadFromFile</link> - Loads the xml instance document from a file. - This file can be at local file system or it can be on a remote host. + <link linkend='function.SDO-DAS-XML-createDataObject'>createDataObject</link> + Can be used to construct an SDO data object of a given type. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-loadFromString'>loadFromString</link> - same as the above method. - Loads the xml instance which is available as string. + <link linkend='function.SDO-DAS-XML-createDocument'>createDocument</link> + Can be used to construct an XML Document object from scratch. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-saveDataObjectToFile'>saveDataObjectToFile</link> - save SDO_DataObject to a file. + <link linkend='function.SDO-DAS-XML-loadFile'>loadFile</link> + Loads the xml instance document from a file. + This file can be at local file system or it can be on a remote host. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-saveDataObjectToString'>saveDataObjectToString</link> - save SDO_DataObject to a string. + <link linkend='function.SDO-DAS-XML-loadString'>loadString</link> + same as the above method. + Loads the xml instance which is available as string. </para> </listitem> <listitem> <para> - <link linkend='function.SDO-DAS-XML-saveDocumentToFile'>saveDocumentToFile</link> + <link linkend='function.SDO-DAS-XML-saveFile'>saveFile</link> save SDO_DAS_XML_Document object as a xml file. </para> </listitem> - <listitem> <para> - <link linkend='function.SDO-DAS-XML-saveDocumentToString'>saveDocumentToString</link> + <link linkend='function.SDO-DAS-XML-saveString'>saveString</link> save SDO_DAS_XML_Document object as a xml string. </para> </listitem> </itemizedlist> + </section> </section> @@ -562,26 +827,16 @@ <classname>SDO_DAS_XML_Document</classname> </title> <para> - This class can be used to get/set XML Declarations such as encoding, - schema location etc. + This class can be used to get to the name and namespace of the document element, + and to get to the root data object of the document. + Lastly, it can also be used to set the XML version and encoding + of a document on output. </para> <section id='sdo-das-xml.class.SDO_DAS_XML_Document.methods'> &reftitle.methods; <itemizedlist> <listitem> <para> - <link linkend='function.SDO-DAS-XML-Document-getEncoding'>getEncoding</link> - gets the encoding string. - </para> - </listitem> - <listitem> - <para> - <link linkend='function.SDO-DAS-XML-Document-getNoNamespaceSchemaLocation'>getNoNamespaceSchemaLocation</link> - gets the no namespace schema location. - </para> - </listitem> - <listitem> - <para> <link linkend='function.SDO-DAS-XML-Document-getRootDataObject'>getRootDataObject</link> gets the root DataObject. </para> @@ -602,26 +857,6 @@ <listitem> <para> - <link linkend='function.SDO-DAS-XML-Document-getSchemaLocation'>getSchemaLocation</link> - gets schema location. - </para> - </listitem> - - <listitem> - <para> - <link linkend='function.SDO-DAS-XML-Document-getXMLDeclaration'>getXMLDeclaration</link> - gets whether xml declaration is set ot not. - </para> - </listitem> - <listitem> - <para> - <link linkend='function.SDO-DAS-XML-Document-getXMLVersion'>getXMLVersion</link> - gets the xml version. - </para> - </listitem> - - <listitem> - <para> <link linkend='function.SDO-DAS-XML-Document-setEncoding'>setEncoding</link> sets the encoding string with the given value. </para> @@ -629,26 +864,10 @@ <listitem> <para> - <link linkend='function.SDO-DAS-XML-Document-setNoNamespaceSchemaLocation'>setNoNamespaceSchemaLocation</link> - sets the no namespace schema location with the given value. - </para> - </listitem> - - <listitem> - <para> - <link linkend='function.SDO-DAS-XML-Document-setSchemaLocation'>setSchemaLocation</link> - sets the schema location with the given value. - </para> - </listitem> - - <listitem> - <para> <link linkend='function.SDO-DAS-XML-Document-setXMLDeclaration'>setXMLDeclaraion</link> to set/unset the xml declaration. </para> </listitem> - - <listitem> <para> @@ -670,45 +889,160 @@ Thrown for any parser errors while loading the xsd/xml file. </para> </section> + + <section id='sdo-das-xml.class.sdo_das_xml_fileexception'> + <title> + <classname>SDO_DAS_XML_FileException</classname> + </title> + <para> + Is a subclass of + <classname>SDO_Exception</classname>. + Thrown by any of the methods that load data from a file, when the file + cannot be found. + </para> + </section> + </section> - </partintro> - &reference.sdo-das-xml.functions; -</reference> + <section id='sdo-das-xml.limitations'> + <title>Limitations compared with SDO 2.0 specification</title> + <para> + The + <ulink url='&url.ibm.sdo;'>SDO 2.0 specification</ulink> + defines the mapping between XML types and SDO types. + With Java SDO, this mapping is implemented by the XMLHelper. + With SDO for PHP, this mapping is implemented by the + XML Data Access Service. + The XML DAS implements the mapping described in the + SDO 2.0 specification with some restrictions. + A detailed list is of the limitations is: + </para> -<!-- - Please note that this example uses a company schema(( - <link linkend="sdo.examples">company.xsd</link> - )) as defined in SDO samples section. - </para> - <programlisting role="php" id="sdo-das-xml.examples.createDataObject"> - <![CDATA[ -<?php -$xmldas = SDO_DAS_XML::create("company.xsd"); -$do = $xmldas->createDataObject("companyNS", "CompanyType"); -$do->name = "Acme Inc"; -$dept1 = $do->createDataObject("departments"); -$dept1->name = "sales"; -$emp1 = $dept1->createDataObject("employees"); -$emp1->name = "Fred"; -$emp1->manager = FALSE; -$dept2 = $do->createDataObject("departments"); -$emp2 = $dept2->createDataObject("employees"); -$emp2->name = "Neil"; -$emp2->manager = TRUE; -print($xmldas->saveDataObjectToString($do, "companyNS", "CompanyType")); -var_dump($do); -?> -]]> - </programlisting> - </example> + <procedure id='sdo-das-xml.limitations.simpletypes'> + <title>XML Simple Types</title> + <step> + <para> + Simple Type with sdoJava:instanceClass + - no PHP equivalent provided. + </para> + </step> + <step> + <para> + Simple Type with sdoJava:extendedInstanceClass + - no PHP equivalent provided. + </para> + </step> + <step> + <para> + Simple Type with list of itemType. + </para> + </step> + <step> + <para> + Simple Type with union. + </para> + </step> + </procedure> - <example> - <title>Working with the SDO_DAS_XML Class</title> - <para> - This example shows you how to create the DataObject and use + <procedure id='sdo-das-xml.limitations.complextypes'> + <title>XML Complex Types</title> + <step> + <para> + Complex Type with sdo:aliasName + - no PHP support for SDO Type aliases. + </para> + </step> + </procedure> ---> + <procedure id='sdo-das-xml.limitations.attribute'> + <title>XSD Attribute</title> + <step> + <para> + Attribute with sdo:aliasName + - no PHP support for SDO property aliases. + </para> + </step> + <step> + <para> + Attribute with default value + - no PHP support for SDO property defaults. + </para> + </step> + <step> + <para> + Attribute with fixed value + - no PHP support for SDO read-only properties or default values. + </para> + </step> + <step> + <para> + Attribute referencing a DataObject with + sdo:propertyType - no support for sdo:propertyType="...". + </para> + </step> + <step> + <para> + Attribute with bi-directional property to a DataObject with + sdo:oppositeProperty and sdo:propertyType + - no PHP support for SDO opposite. + </para> + </step> + </procedure> + + <procedure id='sdo-das-xml.limitations.elements'> + <title>XSD Elements</title> + <step> + <para> + Element with sdo:aliasName + - no PHP support for SDO property aliases. + </para> + </step> + <step> + <para> + Element with substitution group. + </para> + </step> + </procedure> + + <procedure id='sdo-das-xml.limitations.elementsimpletype'> + <title>XSD Elements with Simple Type</title> + <step> + <para> + Element of SimpleType with default + - no PHP support for SDO defaults + </para> + </step> + <step> + <para> + Element of SimpleType with fixed value + - no PHP support for SDO read-only properties or default values. + </para> + </step> + <step> + <para> + Element of SimpleType with sdo:string + - no support for sdo:string="true". + </para> + </step> + <step> + <para> + Element referencing a DataObject with + sdo:propertyType - no support for sdo:propertyType="..." + </para> + </step> + <step> + <para> + Element with bi-directional reference to a DataObject with + sdo:oppositeProperty and sdo:propertyType + - no PHP support for SDO opposite. + </para> + </step> + </procedure> + </section> + + </partintro> + &reference.sdo-das-xml.functions; +</reference> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveString.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveString.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveString.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-saveString"> <refnamediv> <refname>SDO_DAS_XML::saveString</refname> <refpurpose> Saves the SDO_DAS_XML_Document object to a string </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>SDO_DAS_XML::saveString</methodname> <methodparam><type>SDO_XMLDocument</type><parameter>xdoc</parameter></methodparam> <methodparam choice="opt"><type>integer</type><parameter>indent</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Saves the SDO_DAS_XML_Document object to string. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>xdoc</parameter> </term> <listitem> <para> SDO_DAS_XML_Document object. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>indent</parameter> </term> <listitem> <para> Optional argument to specify that the xml should be formatted. A non-negative integer is the amount to indent each level of the xml. So, the integer 2, for example, will indent the xml so that each contained element is two spaces further to the right than its containing element. The integer 0 will cause the xml to be completely left-aligned. The integer -1 means no formatting - the xml will come out on one long line. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> xml string. </para> </refsect1> <!-- Use when EXCEPTIONS exist <refsect1 role="exceptions"> &reftitle.exceptions; <para> When does this function throw exceptions? </para> </refsect1> --> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::saveDocumentToString</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-addTypes.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-addTypes.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-addTypes.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-addTypes"> <refnamediv> <refname>SDO_DAS_XML::addTypes</refname> <refpurpose> To load a second or subsequent schema file to a SDO_DAS_XML object </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>SDO_DAS_XML</type><methodname>SDO_DAS_XML::addTypes</methodname> <methodparam><type>string</type><parameter>xsd_file</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Load a second or subsequent schema file to an XML DAS that has already been created with the static method <function>create</function>. Although the file may be any valid schema file, a likely reason for using this method is to add a schema file containing definitions of extra complex types, hence the name. See Example 4 of the parent document for an example. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>xsd_file</parameter> </term> <listitem> <para> Path to XSD Schema file. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> None if successful, otherwise throws an exception as described below. </para> </refsect1> <refsect1 role="exceptions"> &reftitle.exceptions; <para> <variablelist> <varlistentry> <term> <parameter>SDO_TypeNotFoundException</parameter> </term> <listitem> <para> Thrown if a type is not defined in the underlying model. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_DAS_XML_ParserException</parameter> </term> <listitem> <para> Thrown for any problems while parsing the given XSD File. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_DAS_XML_FileException</parameter> </term> <listitem> <para> Thrown if the specified file cannot be found. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::create</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-createDocument.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-createDocument.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-createDocument.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-createDocument"> <refnamediv> <refname>SDO_DAS_XML::createDocument</refname> <refpurpose> Creates an XML Document object from scratch, without the need to load a document from a file or string. </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <para> There are three forms for this method call. </para> <methodsynopsis> <type>SDO_DAS_XML_Document</type><methodname>SDO_DAS_XML::createDocument</methodname> <void/> </methodsynopsis> <methodsynopsis> <type>SDO_DAS_XML_Document</type><methodname>SDO_DAS_XML::createDocument</methodname> <methodparam><type>string</type><parameter>document element name</parameter></methodparam> </methodsynopsis> <methodsynopsis> <type>SDO_DAS_XML_Document</type><methodname>SDO_DAS_XML::createDocument</methodname> <methodparam><type>string</type><parameter>document element name</parameter></methodparam> <methodparam><type>string</type><parameter>document element namespace URI</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Creates an XML Document object. This will contain just one empty root element on which none of the properties will have been set. The purpose of this call is to allow an application to create an XML document from scratch without the need to load a document from a file or string. The document that is created will be as if a document had been loaded that contained just a single empty document element with no attributes set or elements within it. </para> <para> <function>createDocument</function> may need to be told what the document element is. This will not be necessary in simple cases. When there is no ambiguity then no parameter need be passed to the method. However it is possible to load more than one schema file into the same XML DAS and in this case there may be more than one possible document element defined: furthermore it is even possible that there are two possible document elements that differ only in the namespace. To cope with these cases it is possible to specify either the document element name, or both the document element name and namespace to the method. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>document element name</parameter> </term> <listitem> <para> The name of the document element. Only needed if there there is more than one possibility. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>document element namespace URI</parameter> </term> <listitem> <para> The namespace part of the document element name. Only needed if there is more than one possible document element with the same name. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns an SDO_XML_DAS_Document object on success. </para> </refsect1> <refsect1 role="exceptions"> &reftitle.exceptions; <para> <variablelist> <varlistentry> <term> <parameter>SDO_UnsupportedOperationException</parameter> </term> <listitem> <para> Thrown if an element name or element name and namespace URI is passed, but not found in the underlying model. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::createDataObject</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadFile.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadFile.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadFile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-loadFile"> <refnamediv> <refname>SDO_DAS_XML::loadFile</refname> <refpurpose> Returns SDO_DAS_XML_Document object for a given path to xml instance document </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>SDO_XMLDocument</type><methodname>SDO_DAS_XML::loadFile</methodname> <methodparam><type>string</type><parameter>xml_file</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Constructs the tree of SDO_DataObjects from the given address to xml instance document. Returns SDO_DAS_XML_Document Object. Use SDO_DAS_XML_Document::getRootDataObject method to get root data object. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>xml_file</parameter> </term> <listitem> <para> Path to Instance document. This can be a path to a local file or it can be a URL. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns SDO_DAS_XML_Document object on Success or throws exception as described. </para> </refsect1> <refsect1 role="exceptions"> &reftitle.exceptions; <para> <variablelist> <varlistentry> <term> <parameter>SDO_TypeNotFoundException</parameter> </term> <listitem> <para> Thrown if a type is not defined by the underlying model. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_PropertyNotFoundException</parameter> </term> <listitem> <para> Thrown if a property within a type is not defined in the underlying model. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_DAS_XML_ParserException</parameter> </term> <listitem> <para> Thrown for any problems while parsing the given XSD File. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_DAS_XML_FileException</parameter> </term> <listitem> <para> Thrown if the specified file cannot be found. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::loadFromFile</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveFile.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveFile.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-saveFile.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-saveFile"> <refnamediv> <refname>SDO_DAS_XML::saveFile</refname> <refpurpose> Saves the SDO_DAS_XML_Document object to a file </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>void</type><methodname>SDO_DAS_XML::saveFile</methodname> <methodparam><type>SDO_XMLDocument</type><parameter>xdoc</parameter></methodparam> <methodparam><type>string</type><parameter>xml_file</parameter></methodparam> <methodparam choice="opt"><type>integer</type><parameter>indent</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Saves the SDO_DAS_XML_Document object to a file. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>xdoc</parameter> </term> <listitem> <para> SDO_DAS_XML_Document object. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>xml_file</parameter> </term> <listitem> <para> xml file. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>indent</parameter> </term> <listitem> <para> Optional argument to specify that the xml should be formatted. A non-negative integer is the amount to indent each level of the xml. So, the integer 2, for example, will indent the xml so that each contained element is two spaces further to the right than its containing element. The integer 0 will cause the xml to be completely left-aligned. The integer -1 means no formatting - the xml will come out on one long line. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> None. </para> </refsect1> <refsect1 role="exceptions"> &reftitle.exceptions; <para> <variablelist> <varlistentry> <term> <parameter>SDO_DAS_XML_FileException</parameter> </term> <listitem> <para> Thrown if the specified file cannot be found. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::saveDocumentToFile</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadString.xml?view=markup&rev=1.1 Index: phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadString.xml +++ phpdoc/en/reference/sdo_das_xml/functions/SDO-DAS-XML-loadString.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. --> <refentry id="function.SDO-DAS-XML-loadString"> <refnamediv> <refname>SDO_DAS_XML::loadString</refname> <refpurpose> Returns SDO_DAS_XML_Document for a given xml instance string </refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>SDO_DAS_XML_Document</type><methodname>SDO_DAS_XML::loadString</methodname> <methodparam><type>string</type><parameter>xml_string</parameter></methodparam> </methodsynopsis> &warn.experimental.func; <para> Constructs the tree of SDO_DataObjects from the given xml instance string. Returns SDO_DAS_XML_Document Object. Use SDO_DAS_XML_Document::getRootDataObject method to get root data object. </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term> <parameter>xml_string</parameter> </term> <listitem> <para> xml string. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> Returns SDO_DAS_XML_Document object on Success or throws exception as described. </para> </refsect1> <refsect1 role="exceptions"> &reftitle.exceptions; <para> <variablelist> <varlistentry> <term> <parameter>SDO_TypeNotFoundException</parameter> </term> <listitem> <para> Thrown if a type is not defined by the underlying model. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_PropertyNotFoundException</parameter> </term> <listitem> <para> Thrown if the a property within a type is not defined in the underlying model. </para> </listitem> </varlistentry> <varlistentry> <term> <parameter>SDO_DAS_XML_ParserException</parameter> </term> <listitem> <para> Thrown for any problems while parsing the given XSD File. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <!-- Use when a CHANGELOG exists <refsect1 role="changelog"> &reftitle.changelog; <para> <informaltable> <tgroup cols="2"> <thead> <row> <entry>&Version;</entry> <entry>&Description</entry> </row> </thead> <tbody> <row> <entry>Enter the PHP version of change here <entry>Description of change </row> </tbody> </tgroup> </informaltable> </para> </refsect1> --> <!-- Use when examples exist <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>A <function>SDO_DAS_XML::loadFromString</function> example</title> <para> Any text that describes the purpose of the example, or what goes on in the example should go here (inside the <example> tag, not out </para> <programlisting role="php"> <![CDATA[ <?php if ($anexample === true) { echo 'Use the PEAR Coding Standards'; } ?> ]]> </programlisting> &example.outputs; <screen> <![CDATA[ Use the PEAR Coding Standards ]]> </screen> </example> </para> </refsect1> --> <!-- Use when adding See Also links <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function></function></member> <member>Or <link linkend="somethingelse">something else</link></member> </simplelist> </para> </refsect1> --> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.doc (#969372023) next »