Jump to content


Photo
- - - - -

better handling of : in array keys.


  • Please log in to reply
9 replies to this topic

#1 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 11:15 AM

this is just a friendly asking.
IPB freaks out, by any array key with : in it.
Now how common is that? depends on whether you work heavily with xml files.
As it is, im having to strip the array keys to be able to loop properly, and retreiving an array of attributes from a source tag( think itunes:creator) makes the xml kernel explode.
need better handling of this in this library quite specifically when somebodies got some free time to re-arrange a kernel with.

#2 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 12:11 PM

quick example for anyone going "huh"?
<media:thumbnail url='someurl' type='somemimetype' />

The xml library chokes on this, throws errors up trying to read the attributes.

#3 Michael

Michael

    Meet Jay

  • +Clients
  • 18,851 posts

Posted 21 May 2012 - 12:22 PM

As long as the XML validates, then wouldn't this be a bug?
My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter · Google+
Follow Invision Focus: On Facebook · On Twitter

#4 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 01:06 PM

As long as the XML validates, then wouldn't this be a bug?

Maybe? it goes further than XML's TBH... or the specific item i am messing with.
example.
$array = array();
$array['my:key'] = array('A', 'B', 'C');
ipsRegistry->getClass('output')->getTemplate('somegroup')->someTemplate($array);
try to loop through that array with my:key.

#5 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 01:09 PM

the issue im having specifically as a note is reading this tag... this is raw-dump, but you get the gist... I'm not seeing any capability for reading this structure in the xml kernel:
[media:thumbnail] => Array
										(
[0] => Array
 (
 [@attributes] => Array
 (
[width] => 66
 [height] => 49
    [url] => http://news.bbcimg.co.uk/media/images/60363000/jpg/_60363401_fernando_torres_getty.jpg
    )
 )
 [1] => Array
  (
    [@attributes] => Array
  (
  [width] => 144
 [height] => 81
 [url] => http://news.bbcimg.co.uk/media/images/60367000/jpg/_60367619_fernando_torres_getty.jpg
 )
   )  )
this is within the "record" level.... seeing nothing that will iterate through that in the xml kernel.

#6 Michael

Michael

    Meet Jay

  • +Clients
  • 18,851 posts

Posted 21 May 2012 - 01:26 PM

You didn't answer my question above, if this is valid XML then why start a feedback topic about it instead of reporting it as a bug? If it's valid XML, and the XML class in IP.Board can't handle it, that's a bug.
My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter · Google+
Follow Invision Focus: On Facebook · On Twitter

#7 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 01:32 PM

You didn't answer my question above, if this is valid XML then why start a feedback topic about it instead of reporting it as a bug? If it's valid XML, and the XML class in IP.Board can't handle it, that's a bug.

umm, sure, but I'm not certain it was ever designed to read that far into the xml like that in the first place? the more legitimate bug would be the array keys itself in the templates in post 4... but sure, I'll report what may be a feature request.

#8 bfarber

bfarber

    RBT-KS

  • IPS Management
  • 27,023 posts

Posted 21 May 2012 - 01:50 PM

Is the issue reading the XML, or handling it in the template.

Or are you not finding a way to read nested into the arrays the XML library creates? If that's the case, you have to pass parent element name to the fetchElements() method to drill down properly.
Brandon Farber
Developer / Senior Support

If it sounds like fun, it's not allowed on the bus!

Posted Image     Posted Image

Invision Power Services, Inc.

#9 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 01:56 PM

Is the issue reading the XML, or handling it in the template.

Or are you not finding a way to read nested into the arrays the XML library creates? If that's the case, you have to pass parent element name to the fetchElements() method to drill down properly.

reading the xml ill likely sort, I'm already drilling down into channels and item here frankly... the feedback topic was made as a result of specifically the : in templates... stripping them creates a difference between the raw xml they would get if is not ATOM or RSS, and the data being handed when it is, leaving them causes issues when looping using those keys.

#10 Marcher Technologies

Marcher Technologies

    $life=FALSE;$code=TRUE;$time--;

  • +Clients
  • 11,153 posts

Posted 21 May 2012 - 02:19 PM

Is the issue reading the XML, or handling it in the template.

Or are you not finding a way to read nested into the arrays the XML library creates? If that's the case, you have to pass parent element name to the fetchElements() method to drill down properly.

apparently fetchElements IS an issue.. try to fetchElements on a tag with a : ... it fails, fetchElementsFromRecord, fetchItem, or fetchAttributesAsArray return no results, it *silently* fails.... NOW I'll report a bug on it... cause that is one. :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users