Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

php - can attributes be hidden in a simplexmlobject? -


i have simplexml object , looks fine, when convert part of it... like: $xmlmeshheading = $meshheading->asxml();

i attributes can't find in simple xml object...? here parts of 2 files:

simplexmlobject:  [meshheadinglist] => simplexmlelement object [descriptorname] => acoustic stimulation                                  (                                     [meshheading] => array                                         (                                             [0] => simplexmlelement object                                                 (                                                      [qualifiername] => methods                                                 )                                              [1] => simplexmlelement object                                                 (                                                     [descriptorname] => adolescent                                                 )                                              [2] => simplexmlelement object                                                 (                                                     [descriptorname] => age factors                                                 )                                              [3] => simplexmlelement object                                                 (                                                     [descriptorname] => child                                                 )                                              [4] => simplexmlelement object                                                 (                                                     [descriptorname] => electromyography                                                     [qualifiername] => methods                                                 )                                              [5] => simplexmlelement object                                                 (                                                     [descriptorname] => female                                                 )                                              [6] => simplexmlelement object                                                 (                                                     [descriptorname] => galvanic skin response                                                     [qualifiername] => physiology                                                 )                                              [7] => simplexmlelement object                                                 (                                                     [descriptorname] => humans                                                 )                                              [8] => simplexmlelement object                                                 (                                                     [descriptorname] => male                                                 )                                              [9] => simplexmlelement object                                                 (                                                     [descriptorname] => muscle, skeletal                                                     [qualifiername] => physiology                                                 )                                              [10] => simplexmlelement object                                                 (                                                     [descriptorname] => probability                                                 )                                              [11] => simplexmlelement object                                                 (                                                     [descriptorname] => reaction time                                                     [qualifiername] => physiology                                                 )                                              [12] => simplexmlelement object                                                 (                                                     [descriptorname] => sex factors                                                 )                                              [13] => simplexmlelement object                                                 (                                                     [descriptorname] => startle reaction                                                     [qualifiername] => physiology                                                 ) 

and here asxml file it's same source...:

 <meshheadinglist>             <meshheading>                 <descriptorname majortopicyn="n">acoustic stimulation</descriptorname>                 <qualifiername majortopicyn="n">methods</qualifiername>             </meshheading>              <meshheading>                 <descriptorname majortopicyn="n">adolescent</descriptorname>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">age factors</descriptorname>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">child</descriptorname>              </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">electromyography</descriptorname>                 <qualifiername majortopicyn="y">methods</qualifiername>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">female</descriptorname>              </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">galvanic skin response</descriptorname>                 <qualifiername majortopicyn="n">physiology</qualifiername>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">humans</descriptorname>              </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">male</descriptorname>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">muscle, skeletal</descriptorname>                 <qualifiername majortopicyn="y">physiology</qualifiername>              </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">probability</descriptorname>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">reaction time</descriptorname>                 <qualifiername majortopicyn="n">physiology</qualifiername>              </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">sex factors</descriptorname>             </meshheading>             <meshheading>                 <descriptorname majortopicyn="n">startle reaction</descriptorname>                 <qualifiername majortopicyn="y">physiology</qualifiername>              </meshheading>         </meshheadinglist> 

my question is... 1. there function "unhide" attributes in simplexml? or 2. how can stuff xml file, attributes , values...?

best, thijs

yes. attributes returned when accessing specific node. per example:

$xml = new simplexmlelement('<xml><foo bar="baz">hello world</foo></xml>'); print_r($xml); 

outputs:

simplexmlelement object (     [foo] => hello world ) 

while this:

$xml = new simplexmlelement('<xml><foo bar="baz">hello world</foo></xml>'); print_r($xml->foo); 

outputs:

simplexmlelement object (     [@attributes] => array         (             [bar] => baz         )      [0] => hello world ) 

it's because of internal structure of simplexmlelement. many built-in objects in php (domdocument, etc.), properties aren't printed out when using print_r on them. simplexml attributes, print_r won't display them unless access node, because overload __get (kind of).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -