Пример #1
0
 public function testdecodeTypedWithXSD_WithRootTypeAndNamespace()
 {
     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 {
         $json_das = new SDO_DAS_Json();
         $json_das->addTypesXsdFile(dirname(__FILE__) . "/Response.xsd");
         $sdo = $json_das->decode($this->json_mail_string, "ResponseType", "http://www.example.org/jsonrpc");
         $json_encoded_string = $json_das->encode($sdo);
         $this->assertTrue($json_encoded_string == $this->json_mail_string, 'encoded json string was: ' . $json_encoded_string . "\nbut should have been: " . $this->json_mail_string);
     } catch (Exception $e) {
         $this->assertTrue(false, "Exception was thrown from decodeTypedWithXSD_WithRootTypeAndNamespace test when it should not have been: " . $e->getMessage());
     }
     $this->assertFalse($JsonDASTest_error_handler_called, 'Error handler should not have been called for decodeTypedWithXSD_WithRootTypeAndNamespace test. Message was ' . $JsonDASTest_error_handler_msg);
 }
Пример #2
0
 public function getJsonDas($xsds, $class_name)
 {
     $json_das = new SDO_DAS_Json();
     foreach ($xsds as $index => $xsds) {
         list($namespace, $xsdfile) = $xsds;
         if (SCA_Helper::isARelativePath($xsdfile)) {
             $xsd = SCA_Helper::constructAbsolutePath($xsdfile, $class_name);
             $json_das->addTypesXsdFile($xsd);
         }
     }
     return $json_das;
 }
Пример #3
0
| 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: SL                                                           |
+----------------------------------------------------------------------+
$Id$
*/
require_once "SDO/DAS/json.php";
try {
    // create a json das, we'll need one later
    $jsonDas = new SDO_DAS_Json();
    // get the rss feed as an SDO object
    $feedurl = $_POST['feedurl'];
    $xmldas = SDO_DAS_XML::create('./rss.xsd');
    $xmldoc = $xmldas->loadFile($feedurl);
    $rss = $xmldoc->getRootDataObject();
    // get the object representing the contents of the <div/> element
    // in the browser
    $objectString = $_POST['object'];
    $item = null;
    // do something special if this is the first time through here
    if ($objectString == "NoItem") {
        // this is the first request so read the first item
        try {
            $item = $rss["channel/item[1]"];
        } catch (Exception $e) {