/** * Get XML DAS for Atom * * @param string $class_name Class name * @param string $namespace_uri Namespace * * @todo refactor this back into getXmldas - should just be able to load the atom schema if the namespace and type are http://www.w3.org/2005/Atom and entryType. This needs some thought though as the namespace could change, and someone else might use the type name entryType in a non-atom schema * * @return XML_DAS */ public static function getXmldasForAtom($class_name, $namespace_uri) { SCA::$logger->log("Entering"); $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/Atom1.0.xsd'); // expect to find xsds along with the SCA code - automatically loads xhtml1.xsd and xml.xsd as part of this. // TODO examine this code again // one might imagine that what is wanted is a map: // array(namespace => Set Of xsd) // but this is not what we have // Code Analyser correctly picks up a number // of strangenesses $xsds = SCA_Helper::getAllXsds($class_name); //$atomhelperlog->log("SCA_ServiceWrapperAtom::getXmldasForAtom() Just tried to find xsds in the component: ". print_r($xsds, true) ." \n"); //$xmldas = SDO_DAS_XML::create(); foreach ($xsds as $index => $xsds) { list($namespace, $xsdfile) = $xsds; if (SCA_Helper::isARelativePath($xsdfile)) { $xsd = SCA_Helper::constructAbsolutePath($xsdfile, $class_name); $xmldas->addTypes($xsd); } } // $atomhelperlog->log("SCA_ServiceWrapperAtom::getXmldasForAtom() xmldas after adding other types from the class:: $xmldas \n"); SCA::$logger->log("Exiting"); return $xmldas; }
/** * Get DAS * * @return object */ public static function getXmlDas() { if (is_null(self::$xmldas)) { self::$xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/rss2.0.xsd'); } return self::$xmldas; }
public function updateOrderStatus($order_id, $status) { $order = $this->retrieveOrderById($order_id); $order->status = $status; $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/Order.xsd'); $doc = $xmldas->createDocument('urn::orderNS', 'order', $order); $xmldas->saveFile($doc, dirname(__FILE__) . '/Orders/Order_' . $order->orderId . '.xml', 2); }
function directPayment($payment) { // Write the payment details out to file $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/Customer.xsd'); $filename = dirname(__FILE__) . "/Payments/Payment_" . $payment->paymentId . ".xml"; $doc = $xmldas->createDocument('customerNS', 'payment', $payment); $xmldas->saveFile($doc, $filename, 2); }
public function testWsdlXsdRead() { $xmldas = SDO_DAS_XML::create(); $xmldas->addTypes(dirname(__FILE__) . "/../../../../SCA/Bindings/soap/soap/2003-02-11.xsd"); $doc = $xmldas->createDocument(); $definitions = $doc->getRootDataObject(); $reflection = new SDO_Model_ReflectionDataObject($definitions); $sdo_type = $reflection->getType(); $type_name = $sdo_type->getName(); $this->assertEquals($type_name, 'tDefinitions', 'SCA/Bindings/soap/soap/2003-02-11.xsd not read correctly'); //$this->printSdoType($definitions); }
public function testXsiTypesGenerated() { $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . "/Bug11774.xsd"); $doc = $xmldas->createDocument('', 'request-list'); $rdo = $doc->getRootDataObject(); $request = $xmldas->createDataObject('', 'collectionInfo'); $request->collection->insert('Blah'); $request->kind = 'collectionInfo'; $rdo->request->insert($request); $xml = $xmldas->saveString($doc); $this->assertContains('xsi:type="collectionInfo"', $xml); }
public function testElementsComeOutInTheRightNamespace() { $location_of_sca_class = SCA_Helper::getFileContainingClass("SCA"); $sca_dir = dirname($location_of_sca_class); $location_of_atom_xsd = $sca_dir . "/Bindings/atom/Atom1.0.xsd"; $xmldas = SDO_DAS_XML::create($location_of_atom_xsd); $document = $xmldas->createDocument('http://www.w3.org/2005/Atom', 'entry'); $entry = $document->getRootDataObject(); $author = $entry->createDataObject('author'); $author->name[] = "Caroline Maynard"; $xml = $xmldas->saveString($document, 2); $this->assertContains("<tns:author>", $xml); $this->assertContains("<tns:name>", $xml); }
function getEvents($order_id) { $files = event_files(); $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/Event.xsd'); $doc = $xmldas->createDocument('urn::eventNS', 'events'); $events = $doc->getRootDataObject(); foreach ($files as $file) { $xdoc = $xmldas->loadFile(dirname(__FILE__) . '/Events/' . $file); $event = $xdoc->getRootDataObject(); if ($event->orderId == $order_id) { $events->event[] = $event; } } return $events; }
/** * Load the WSDL and hence initialise the SDO model * * @param string $wsdl * @throws SCA_RuntimeException */ public function setWSDLTypes($wsdl) { SCA::$logger->log('Entering'); SCA::$logger->log("wsdl is {$wsdl}"); try { $this->xmldas = @SDO_DAS_XML::create($wsdl); } catch (Exception $e) { $problem = $e->getMessage(); SCA::$logger->log("exception thrown from create(): {$problem}"); if ($e instanceof SDO_Exception) { $problem = "SDO_Exception in setWSDLTypes : " . $problem; } trigger_error($problem); } }
public function testLocalProxyPassesSdoByValue() { $das = SDO_DAS_XML::create(dirname(__FILE__) . '/person.xsd'); $person = $das->createDataObject('PersonNamespace', 'personType'); $person->name = 'William Shakespeare'; $person->dob = 'April 1564, most likely 23rd'; $person->pob = 'Stratford-upon-Avon, Warwickshire'; // if you call the instance directly it does pass-by-reference $instance = new LocalProxyTestSDOReverser(); $instance->reverseSDOArgument($person); $this->assertEquals(strrev('William Shakespeare'), $person->name); // if you call the instance as a service it does pass-by-value $person = $das->createDataObject('PersonNamespace', 'personType'); $person->name = 'William Shakespeare'; $person->dob = 'April 1564, most likely 23rd'; $person->pob = 'Stratford-upon-Avon, Warwickshire'; $service = SCA::getService('./LocalProxyTestSDOReverser.php'); $service->reverseSDOArgument($person); $this->assertEquals('William Shakespeare', $person->name); }
function enumerate() { //build a contacts SDO out of the contents of a number of the files. SCA::$logger->log("Entering"); //Create an array of SDOs $contactsArray = array(); try { //NOTE: need directory called Contact with entries 2.xml and 3.xml in it $first = 1; $last = 1; while (file_exists("Contact/{$last}.xml")) { $last++; } $last--; SCA::$logger->log("Feed will contain entries {$first} to {$last}"); $xmldas = SDO_DAS_XML::create('contacts.xsd'); for ($i = $first; $i <= $last; $i++) { if (file_exists("Contact/{$i}.xml")) { $doc = $xmldas->loadFile("Contact/{$i}.xml"); SCA::$logger->log("read in " . $xmldas->saveString($doc)); $root_data_object = $doc->getRootDataObject(); SCA::$logger->log("about to return the sdo"); //NOTE: return $resource; //this returns the xml (escaped...) array_push($contactsArray, $root_data_object); } else { throw new SCA_NotFoundException(); } } SCA::$logger->log("Built an array of SDOs: " . print_r($contactsArray, true)); $contactsSDO = $xmldas->createDataObject('http://example.org/contacts', 'contacts'); foreach ($contactsArray as $contact) { $contactsSDO->contact[] = $contact; } SCA::$logger->log("Built a contactsSDO: " . print_r($contactsSDO, true)); return $contactsSDO; } catch (Exception $e) { SCA::$logger->log("caught exception: " . $e->getMessage()); throw new SCA_NotFoundException(); } }
public function testencode() { global $JsonDASTest_error_handler_called; global $JsonDASTest_error_handler_severity; global $JsonDASTest_error_handler_msg; set_error_handler('JsonDASTest_user_error_handler'); $JsonDASTest_error_handler_called = false; $exception_thrown = false; try { $xmldas = SDO_DAS_XML::create(); $xmldas->addTypes(dirname(__FILE__) . '/Portfolio.xsd'); $xdoc = $xmldas->createDocument("http://www.example.org/Portfolio", "Portfolio"); $portfolio = $xdoc->getRootDataObject(); // Test complex type array $holding = $portfolio->createDataObject('holding'); // Test simpe types $holding->ticker = 'AAPL'; $holding->number = 100.5; $holding = $portfolio->createDataObject('holding'); $holding->ticker = 'INTL'; $holding->number = 100.5; $holding = $portfolio->createDataObject('holding'); $holding->ticker = 'IBM'; $holding->number = 100.5; $other = $xmldas->createDataObject("http://www.example.org/Portfolio", "OtherType"); $other->x = 'XXX'; $other->y = 123; // Test open types $portfolio["otherA"] = $other; $portfolio["otherB"] = "some string"; $portfolio["otherC"] = 123; $json_das = new SDO_DAS_Json(); $json_encoded_string = $json_das->encode($portfolio); $this->assertTrue($json_encoded_string == $this->json_portfolio_string, 'encoded json string was: ' . $json_encoded_string . "\nbut should have been: " . $this->json_portfolio_string); } catch (Exception $e) { $this->assertTrue(false, "Exception was thrown from encode test when it should not have been: " . $e->getMessage()); } $this->assertFalse($JsonDASTest_error_handler_called, 'Error handler should not have been called for encode test. Message was ' . $JsonDASTest_error_handler_msg); }
/** * Load the WSDL and hence initialise the SDO model * * @param string $wsdl WSDL * * @throws SCA_RuntimeException * @return null */ public function setWSDLTypes($wsdl) { SCA::$logger->log('Entering'); SCA::$logger->log("wsdl is {$wsdl}"); try { $this->xmldas = @SDO_DAS_XML::create($wsdl, "WEARETHEEBAYSOAPBINDING"); } catch (Exception $e) { $problem = $e->getMessage(); SCA::$logger->log("exception thrown from create(): {$problem}"); if ($e instanceof SDO_Exception) { $problem = "SDO_Exception in setWSDLTypes : " . $problem; } /** * Depending On Whether The Function Is Being Used On The * Client Side Or The Server Side Either Report The Problem * To The Client, Or Record The Problem In The Error.Log */ trigger_error($problem); /* When the 'TypeHandler is being used by the Soap Server */ if (strcmp($this->association, self::SERVER) === 0) { throw new SoapFault("Client", "Invalid WSDL Type"); } } }
public function addTypesXsdFile($xsd_file) { if ($this->is_smd_model == true) { // SMD has already been used to build part of the type // model so we can't now switch to using XSD throw SDO_Exception('Cannot add XSD types to the JSON DAS because SMD types have already been added'); } if ($this->is_generic_model == true) { // XSD has already been used to build part of the type // model so we can't now switch to using SMD throw SDO_Exception('Cannot add XSD types to the JSON DAS because the DAS has already been used to parse JSON generically'); } $this->is_xsd_model = true; if ($this->xml_das == null) { $this->xml_das = SDO_DAS_XML::create(); } if ($xsd_file != null) { $this->xml_das->addTypes($xsd_file); } }
/* +-----------------------------------------------------------------------------+ | (c) Copyright IBM Corporation 2006, 2007 | | All Rights Reserved. | +-----------------------------------------------------------------------------+ | Licensed under the Apache License, Version 2.0 (the "License"); you may not | | use this file except in compliance with the License. You may obtain a copy | | of the License at - | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | +-----------------------------------------------------------------------------+ | Authors: Graham Charters, Matthew Peters | | | +-----------------------------------------------------------------------------+ $Id$ */ $xmldas = SDO_DAS_XML::create('Catalog.xsd'); $doc = $xmldas->createDocument('catalogNS', 'catalog'); $catalog = $doc->getRootDataObject(); $item = $catalog->createDataObject('item'); $item->itemId = 1; $item = $catalog->createDataObject('item'); $item->itemId = 2; echo $xmldas->saveString($doc, 2);
/** * Add types from the supplied XSD file to the XMLDAS owned by this DAS. * Create an XMLDAS if one does not already exist. * * @param string $xsd_file XSD File * * @return null */ public function addTypesXsdFile($xsd_file) { if ($this->xml_das == null) { $this->xml_das = SDO_DAS_XML::create(); } if ($xsd_file != null) { $this->xml_das->addTypes($xsd_file); } }
| http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | | implied. See the License for the specific language governing | | permissions and limitations under the License. | +----------------------------------------------------------------------+ | Author: Graham Charters | +----------------------------------------------------------------------+ $Id$ --> <body> <?php $xmldas = SDO_DAS_XML::create('./letter.xsd'); $doc = $xmldas->loadFile('letter.xml'); $letter_seq = $doc->getRootDataObject()->getSequence(); for ($i = 0; $i < count($letter_seq); $i++) { $out = str_replace(array("\n"), array("<br/>"), $letter_seq[$i]); if ($letter_seq->getProperty($i) == NULL) { echo $out; } else { echo "<b>{$out}</b>"; } } ?> </body> </html>
/** * 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 * Essentiually, 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(); /** * Incidentally, the root data object type name and * namespaceURI can also be obtained from the type via * a reflection data object built on the root data object */ //$model_rdo = new SDO_Model_ReflectionDataObject($root_do); //$type = $model_rdo->getType(); //echo "The type name of the root data object is " . $type->name . "\n"; //echo "The namespace URI of the root data object is " . $type->namespaceURI . "\n"; /** * 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
/** * Am repeating this code here (it's in the previous method also) * as we are seeing a number of different combinitations of * creating and XMLDAS based on the \@type annotations in the * \@Service comment or in the \@Reference comment * * TODO - create a more complete model of the service in memory * so that we can pick bits from it rather than having to * rescan the class and regen it every time we need a bit * * @param string $class_name Class name * @param mixed $xsds XSDs * * @return SDO_DAS_XML */ public static function getXmldasFormXsdArray($class_name, $xsds) { $xmldas = SDO_DAS_XML::create(); foreach ($xsds as $index => $xsds) { list($namespace, $xsdfile) = $xsds; if (SCA_Helper::isARelativePath($xsdfile)) { $xsd = SCA_Helper::constructAbsolutePath($xsdfile, $class_name); $xmldas->addTypes($xsd); } } return $xmldas; }
<?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); ?>
| http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | | implied. See the License for the specific language governing | | permissions and limitations under the License. | +----------------------------------------------------------------------+ | Author: Matthew Peters | +----------------------------------------------------------------------+ $Id$ */ /** * Load the jungle and animal schema */ $xmldas = SDO_DAS_XML::create('jungle.xsd'); $xmldas->addTypes('animalTypes.xsd'); /** * Create three animals */ $baloo = $xmldas->createDataObject('', 'bearType'); $baloo->name = "Baloo"; $baloo->weight = 700; $bagheera = $xmldas->createDataObject('', 'pantherType'); $bagheera->name = "Bagheera"; $bagheera->colour = 'inky black'; $kaa = $xmldas->createDataObject('', 'snakeType'); $kaa->name = "Kaa"; $kaa->length = 25; /** * Create a jungle (picks the root element <jungle/>)
*/ $rss_xmldas = SDO_DAS_XML::create('./rss.xsd'); $rss_document = $rss_xmldas->loadFile('./base.xml'); $rss_data_object = $rss_document->getRootDataObject(); /** * Set the RSS channel values */ $channel = $rss_data_object->channel; $channel->lastBuildDate = date("D\\, j M Y G:i:s T"); $channel->pubDate = date("D\\, j M Y G:i:s T"); $channel->link = 'http://' . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . '/newitem.php'; $channel->ttl = '1'; /** * Load the blog data */ $blog_xmldas = SDO_DAS_XML::create('./blog.xsd'); $blog_document = $blog_xmldas->loadFile('./blog.xml'); $blog_data_object = $blog_document->getRootDataObject(); /** * Iterate through the blog entries converting * them to RSS items. */ foreach ($blog_data_object->item as $item) { $new_channel_item = $channel->createDataObject('item'); $new_channel_item->createDataObject('guid'); $new_channel_item->createDataObject('enclosure'); $new_channel_item->title = $item->title; $new_channel_item->description = $item->description; $new_channel_item->pubDate = $item->date; $new_channel_item->link = 'http://' . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . '/showitem.php?id=' . $item->guid; $new_channel_item->guid->value = md5($new_channel_item->pubDate);
| of the License at - | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | +-----------------------------------------------------------------------------+ | Authors: Graham Charters, Matthew Peters | | | +-----------------------------------------------------------------------------+ $Id$ */ $xmldas = SDO_DAS_XML::create('../../Schema/Order.xsd'); $doc = $xmldas->createDocument('urn::orderNS', 'order'); $order = $doc->getRootDataObject(); $order->orderId = 1; $order->status = "RECEIVED"; $newItem = $order->createDataObject('item'); $newItem->itemId = 1; $newItem->description = "Fork Handles"; $newItem->price = 10; $newItem->quantity = 2; $newItem->warehouseId = 3; $newItem = $order->createDataObject('item'); $newItem->itemId = 2; $newItem->description = "Candles (pack of 4)"; $newItem->price = 4.99; $newItem->quantity = 3;
public function testSoap() { /* This is the problem described by bug #9498 */ try { define('WSDL_NAMESPACE', 'http://schemas.xmlsoap.org/wsdl/'); define('SOAP_NAMESPACE', 'http://schemas.xmlsoap.org/wsdl/soap/'); $xmldas = SDO_DAS_XML::create(WSDL_NAMESPACE); $xmldas->addTypes(SOAP_NAMESPACE); $wsdl_doc = $xmldas->createDocument(); $wsdl = $wsdl_doc->getRootDataObject(); $service = $wsdl->createDataObject('service'); $port = $service->createDataObject('port'); $soap_address = $xmldas->createDataObject(SOAP_NAMESPACE, 'tAddress'); $soap_address->location = 'http://example.com'; $port->address = $soap_address; $this->assertEquals(SOAP_NAMESPACE, $port->address->getTypeNamespaceURI(), "testSoap - wrong namespace URI for address;"); $stringified = $xmldas->saveString($wsdl_doc); $this->assertFalse(strpos($stringified, '<wsdl:port><soap:address') === FALSE, "testSoap - wrong namespace prefix for address;"); } catch (SDO_Exception $e) { $this->assertTrue(false, "testSoap - Unexpected Exception Caught: " . $e->getMessage()); } }
$accessSchemaFile = $this->path->path('classes:store/shipping/UPS/Rate/xml/AccessRequest.xsd'); $requestSchemaFile = $this->path->path('classes:store/shipping/UPS/Rate/xml/RateRequest.xsd'); $responseSchemaFile = $this->path->path('classes:store/shipping/UPS/Rate/xml/RateResponse.xsd'); $endpointurl = 'https://wwwcie.ups.com/webservices/Rate'; $outputFileName = "XOLTResult.xml"; try { //create AccessRequest data object $das = SDO_DAS_XML::create("{$accessSchemaFile}"); $doc = $das->createDocument(); $root = $doc->getRootDataObject(); $root->AccessLicenseNumber = $access; $root->UserId = $userid; $root->Password = $passwd; $security = $das->saveString($doc); //create RateRequest data oject $das = SDO_DAS_XML::create("{$requestSchemaFile}"); $requestDO = $das->createDataObject('', 'RequestType'); $requestDO->RequestAction = 'Rate'; $requestDO->RequestOption = 'Rate'; $pickuptypeDO = $das->createDataObject('', 'CodeType'); $pickuptypeDO->Code = '07'; $shipmentDO = $das->createDataObject('', 'ShipmentType'); $shipperDO = $das->createDataObject('', 'ShipperType'); $shipperDO->Name = 'Name'; $shipperDO->ShipperNumber = ''; $addressDO = $das->createDataObject('', 'AddressType'); $addressDO->AddressLine1 = 'AddressLine1'; $addressDO->City = 'City'; $addressDO->StateProvinceCode = 'NJ'; $addressDO->PostalCode = '07430'; $addressDO->CountryCode = 'US';
| of the License at - | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | +-----------------------------------------------------------------------------+ | Authors: Graham Charters, Matthew Peters | | | +-----------------------------------------------------------------------------+ $Id$ */ $xmldas = SDO_DAS_XML::create('Event.xsd'); $doc = $xmldas->createDocument('urn::eventNS', 'events'); $events = $doc->getRootDataObject(); date_default_timezone_set('UTC'); $event = $events->createDataObject('event'); $event->eventId = 1; $event->orderId = 2; $event->customerId = 3; $event->timeStamp = date(DATE_W3C); $event->description = "This is an event for a newly opened order."; $event->status = "RECEIVED"; $event = $events->createDataObject('event'); $event->eventId = 2; $event->orderId = 2; $event->customerId = 3; $event->timeStamp = date(DATE_W3C);
*/ case 'database': echo '<b>Retrieving from database</b><br/><br/>'; require_once '../contacts/contacts_data.inc.php'; $root = retrieve_contact('shifty'); $contact = $root->contact[0]; break; /** * Load the contact from XML */ /** * Load the contact from XML */ case 'XML': echo '<b>Retrieving from XML</b><br/><br/>'; $xmldas = SDO_DAS_XML::create('contacts.xsd'); $doc = $xmldas->loadFile('contacts.xml'); $contact = $doc->getRootDataObject(); break; default: echo '<b>Invalid data source type (use database or XML)</b><br/><br/>'; return false; break; } /** * Create a new address child data object * Note: data objects are factories for their children */ $address = $contact->createDataObject('address'); echo '<b>Set and Get output</b><br/>'; /**
/** * a helper method to read all of the orders in from file */ private function readOrders() { $this->xmldas = SDO_DAS_XML::create("./Orders.xsd"); $this->doc = $this->xmldas->loadFile("./Orders.xml"); $this->orders = $this->doc->getRootDataObject(); }
function get_catalog() { $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/Catalog.xsd'); $xdoc = $xmldas->loadFile(dirname(__FILE__) . '/Catalog.xml'); return $xdoc->getRootDataObject(); }
| limitations under the License. | +-----------------------------------------------------------------------------+ | Authors: Graham Charters, Matthew Peters | | | +-----------------------------------------------------------------------------+ $Id$ */ include_once "display_cart.php"; include_once "table.php"; include_once "Catalog/catalog.php"; session_start(); if (isset($_SESSION['cart'])) { // pick up the old cart if there is one, else get a new one $cart = $_SESSION['cart']; } else { $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/../Schema/Order.xsd'); $cart = $xmldas->createDataObject('urn::orderNS', 'OrderType'); $cart->orderId = time(); $cart->status = 'NONE'; $_SESSION['cart'] = $cart; } ?> <html> <head> <title>Cart</title> </head> <body> <p> <?php