Home Super Mario Bros Games Puzzle Games Physics Games Flash Games Girls Games Marvin Games Games Walkthroughs
Java Program Tutorials

Only Best Physics Games

I have not found a method that will parse the uniquely labeled namespaces that my below SPML response contains.

The intent is to retrieve an array filled with attribute 'name' and 'value'.

Thank you in advance!

EX)

<dsml:attr name='que2'>
    <dsml:value>systemProvidedQuestionText?</dsml:value>
  </dsml:attr>

name: que2 value: systemProvidedQuestionText?

RECIEVED XML

    <?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
  xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Body>
<spml:searchResponse xmlns:spml='urn:oasis:names:tc:SPML:1:0' xmlns:dsml='urn:oasis:names:tc:DSML:2:0:core' result='urn:oasis:names:tc:SPML:1:0#success'>
  <spml:operationalAttributes>
    <dsml:attr name='session'>
      <dsml:value>J/twt43t35pA==</dsml:value>
    </dsml:attr>
  </spml:operationalAttributes>
  <spml:searchResultEntry>
    <spml:identifier type='urn:oasis:names:tc:SPML:1:0#GenericString'>
      <spml:id>USER1</spml:id>
    </spml:identifier>
    <spml:attributes>   
      <dsml:attr name='que2'>
        <dsml:value>systemProvidedQuestionText?</dsml:value>
      </dsml:attr>
      <dsml:attr name='ans1'>
        <dsml:value>userProvidedAnswer</dsml:value>
      </dsml:attr>     
      <dsml:attr name='que1'>
        <dsml:value>systemProvidedQuestionText?</dsml:value>
      </dsml:attr>
      <dsml:attr name='ans2'>
        <dsml:value>userProvidedAnswer</dsml:value>
      </dsml:attr>
    </spml:attributes>
  </spml:searchResultEntry>
</spml:searchResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

View the Original Page Here: PHP Unique XML Namespace Parsing     Back to the List

Cheats, Walkthroughs Related to: PHP Unique XML Namespace Parsing

Only Best Physics Games

If I run the code on my phone galaxy s2 2.3.6, it works fine. However, if I try to run on eclipse emulator, it will give me an error. :(

What the code does is simple viewflipper.

I tried to run on emulator platform 2.3.3 and 4.0.3

Thank you for the help.

bottom is the logcat output.

02-21 17:11:39.223: D/dalvikvm(353): GC_FOR_MALLOC freed <1K, 53% free 2560K/5379K, external 1645K/2137K, paused 25ms 02-21 17:11:39.233: D/skia(353): --- decoder->decode returned false 02-21 17:11:39.233: D/AndroidRuntime(353): Shutting down VM 02-21 17:11:39.233: W/dalvikvm(353): threadid=1: thread exiting with uncaught exception (group=0x40015560) 02-21 17:11:39.253: E/AndroidRuntime(353): FATAL EXCEPTION: main 02-21 17:11:39.253: E/AndroidRuntime(353): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.exercise.AndroidViewFlipper/com.exercise.AndroidViewFlipper.AndroidViewFlipperActivity}: android.view.InflateException: Binary XML file line #38: Error inflating class 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.os.Handler.dispatchMessage(Handler.java:99) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.os.Looper.loop(Looper.java:123) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread.main(ActivityThread.java:3683) 02-21 17:11:39.253: E/AndroidRuntime(353): at java.lang.reflect.Method.invokeNative(Native Method) 02-21 17:11:39.253: E/AndroidRuntime(353): at java.lang.reflect.Method.invoke(Method.java:507) 02-21 17:11:39.253: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 02-21 17:11:39.253: E/AndroidRuntime(353): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 02-21 17:11:39.253: E/AndroidRuntime(353): at dalvik.system.NativeStart.main(Native Method) 02-21 17:11:39.253: E/AndroidRuntime(353): Caused by: android.view.InflateException: Binary XML file line #38: Error inflating class 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.createView(LayoutInflater.java:518) 02-21 17:11:39.253: E/AndroidRuntime(353): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.rInflate(LayoutInflater.java:626) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.inflate(LayoutInflater.java:408) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 02-21 17:11:39.253: E/AndroidRuntime(353): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.Activity.setContentView(Activity.java:1657) 02-21 17:11:39.253: E/AndroidRuntime(353): at com.exercise.AndroidViewFlipper.AndroidViewFlipperActivity.onCreate(AndroidViewFlipperActivity.java:14) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 02-21 17:11:39.253: E/AndroidRuntime(353): ... 11 more 02-21 17:11:39.253: E/AndroidRuntime(353): Caused by: java.lang.reflect.InvocationTargetException 02-21 17:11:39.253: E/AndroidRuntime(353): at java.lang.reflect.Constructor.constructNative(Native Method) 02-21 17:11:39.253: E/AndroidRuntime(353): at java.lang.reflect.Constructor.newInstance(Constructor.java:415) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.view.LayoutInflater.createView(LayoutInflater.java:505) 02-21 17:11:39.253: E/AndroidRuntime(353): ... 24 more 02-21 17:11:39.253: E/AndroidRuntime(353): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget 02-21 17:11:39.253: E/AndroidRuntime(353): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.content.res.Resources.loadDrawable(Resources.java:1709) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.content.res.TypedArray.getDrawable(TypedArray.java:601) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.widget.ImageView.(ImageView.java:118) 02-21 17:11:39.253: E/AndroidRuntime(353): at android.widget.ImageView.(ImageView.java:108) 02-21 17:11:39.253: E/AndroidRuntime(353): ... 27 more

Update Date: 2012-02-21 17:18
Searched Times: 2

Yes, I have goggled this question and even referred to my textbook (PHP by Don Gosselin) but I seriously cannot understand the explanations :-( (I feel dumb)

From my understanding:

echo = shows the final result of a function

return = returns the value from a function

I applied both echo and return in the following functions I cannot see the difference or the 'effectiveness' of using return instead of echo.

<?php
echo "<h1 style='font-family:Helvetica; color:red'>Using <em>echo</em></h1>";
function add1($x, $y){
    $total = $x + $y;
    echo $total;
}
echo "<p>2 + 2 = ", add1(2, 2), "</p>";

echo "<h1 style='font-family:Helvetica; color:red'>Using <em>return</em></h1>";
function add2($x, $y){
    $total = $x + $y;
    return $total;
}
echo "<p>2 + 2 = ", add2(2, 2), "</p>";

?>

Both display the result! What am I not understanding? :(

Please bear with me!

Update Date: 2012-02-21 17:03
Searched Times: 1

I've been learning Objective C lately, and I came across some code for using the accelerometer in an iPhone app. It works perfectly; however, there's one if-statement in the code which I simply cannot understand (both the meaning and why it works). The specific chunk is this:

if (0.2f < deviceTilt.y > -0.2f){position.x = 0;}

I just can't figure out the condition, and I hadn't seen the use of two comparison operators in one single clause before.

Hope somebody can help me out!

PS: The whole project can be found in this link: http://www.ifans.com/forums/showthread.php?t=151394

Update Date: 2012-02-21 17:02
Searched Times: 1

Hey guys I'm trying to see where my pairs of keys stop, I have arrays built like this

EDIT People are getting really confused so I'm using a real array instead of an example

array (
  'key' => '',
  'po' => '',
  'label' => '',
  'report_key' => '',
  'shipper' => '',
  'status' => '',
  'location' => '',
  'inspector' => '',
  'commodity' => '',
  'brand' => '',
  'case_count' => '',
  'variety' => '',
  'style' => '',
  'grower_lot' => '',
  'pack_date' => '',

  // grouping 4 items
  'berry_size1' => '',
  'berry_size2' => '',
  'berry_size3' => '',
  'berry_size4' => '',

  // grouping 3 items
  'bunch_color1' => '',
  'bunch_color2' => '',
  'bunch_color3' => '',

  // grouping 2 items     
  'color1' => '',
  'color2' => '',


  // grouping 3 items
  'stem1' => '',
  'stem2' => '',
  'stem3' => '',


  // grouping 2 items
  'shatter1' => '',
  'shatter2' => '',


  // grouping 2 items
  'splits1' => '',
  'splits2' => '',


  // grouping 2 items
  'wet_sticky1' => '',
  'wet_sticky2' => '',

  'overall_quality' => '',


  // grouping 2 items
  'sugar_brix1' => '',
  'sugar_brix2' => '',

  'rating' => '',
  'comments' => '',
)

I came up with some stupid way that really doesn't work to try and sort things out, its extremely backwards, honestly I'm pretty embarrassed by my attempt.

            foreach($obj as $key=>$val) {

            if(strpos(  preg_replace('/[^a-z]/i', '', $key), 
                        preg_replace('/[^a-z]/i', '', $all_keys[$key+$b+1])
                        ) !== false) { echo "<p>$key</p>"; // items 1-3 will show
            } elseif(strpos(preg_replace('/[^a-z]/i', '', $key), 
                            preg_replace('/[^a-z]/i', '', $all_keys[$key+$b-1])
                            ) !== false) { echo "<p>$key</p>"; // show last item
            } else {

                  $in.='<aside class="left">';
                    $in .= "<label for='$key'>". ucwords(strtolower(str_replace('_',' ',$key))) ."</label><br/>";
                    $in .= ($key=='key') ? "<input type='text' value='". $objLastId ."' id='$key' class='disabled' disabled='disabled'>" : "<input type='text' value='' name='$key' id='$key'>";
                  $in.='</aside>';

              $b++;
              }
            }

Anyway what I'm really trying to achieve is something like this, could someone steer me in the right direction please?

<style>
 .row2 input {width: 50px !important;}
 .row3 input {width: 27px !important;}
 .row4 input {width: 15px !important;}
</style>

// stem was a 2 item group, so should have the row4 class
// and should have the second item appended by a &nbsp; 
// all be inside the same grouping, like below ...
<aside class="left row2">
<label for="color1">Color</label>
<br/><input type="text" value="" name="color1" id="color1">
&nbsp;<input type="text" value="" name="color2" id="color2">
</aside>


// stem was a 3 item group, so should have the row4 class
// and should have items 2-3 appended by a &nbsp; all be inside 
// the same grouping, like below ...
<aside class="left row3">
<label for="stem1">Stem</label>
<br><input type="text" id="stem1" name="stem1" value="">
&nbsp;<input type="text" id="stem2" name="stem2" value="">
&nbsp;<input type="text" id="stem3" name="stem3" value="">
</aside>


// berry_size was a 4 item group, so should have the row4 class
// and should have items 2-4 appended by a &nbsp; all be inside 
// the same grouping, like below ...
<aside class="left row4">
<label for="berry_size1">Berry Size</label>
<br/><input type="text" id="berry_size1" name="berry_size1" value="">
&nbsp;<input type="text" id="berry_size2" name="berry_size2" value="">
&nbsp;<input type="text" id="berry_size3" name="berry_size3" value="">
&nbsp;<input type="text" id="berry_size4" name="berry_size4" value="">
</aside>

... or ...

// this is a single, so no extra class and ....
<aside class="left">
<label for="other_item">Other Item</label>
<br/><input type="text" id="other_item" name="other_item" value="">
</aside>

What I see this really boiling down to is reading the next array keys name (I stripped the name and used the integer in my version), atleast I think that's the right way to do it?

Update Date: 2012-02-21 16:49
Searched Times: 1

On a spark text area in my Flex Mobile project, I want to only allow upper and lowercase letters, numbers and only some symbols. It works fine except now when someone hits the return key it doesnt do a line break like it naturally would. is there something I need to add to my restrict to allow line breaks?

so i tried this in the MXML of the Text Area:

restrict="a-z A-Z 0-9 !@#$%()"

and this restrict="a-z A-Z 0-9 !@#$%()\n"

Just to be clear, I'm on a 'Mobile' project, and testing without restrict on my Nexus one, using the touch screen keyboard, if i hit return it works fine, and does the line break.

but, as soon as I do restrict="a-z A-Z 0-9 !@#$%()" the return key does not work like it should.

Update Date: 2012-02-21 15:40
Searched Times: 0


Only Best Physics Games


Java Program Examples
RSS4Java.com is dedicated to popular Java technology posts, blogs and entries.
Copyright© 2010 Rss4Java.com. Java is a trademark of Sun Microsystems, Inc. All blogs, posts and entries are the property of their authors.