Problem with Shen " ' " dralar

Requests, feedback, and general discussion about WoWRoster
DO NOT post topics about WoWRoster AddOns here!

Problem with Shen " ' " dralar

Postby Palladius » Wed Jul 05, 2006 6:51 am

Found a Problem with Reputation Shen'dralar

Below are the results of checking this document for XML well-formedness and validity.

Error Line 354 column 288: character "'" is not allowed in the value of attribute "id".
...play:none;" id="rep_value_inaktivshen'dralar">1980/3000</div><div class="valu
It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.

Error Line 354 column 383: character "'" is not allowed in the value of attribute "id".
...inline;" id="rep_standing_inaktivshen'dralar">Neutral</div></div>

Error Line 391 column 278: character "'" is not allowed in the value of attribute "id".
...isplay:none;" id="rep_value_othershen'dralar">1400/3000</div><div class="valu
It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.

Error Line 391 column 371: character "'" is not allowed in the value of attribute "id".
...y:inline;" id="rep_standing_othershen'dralar">Neutral</div></div>
Palladius
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 6:44 am

Problem with Shen " ' " dralar

Postby zanix » Wed Jul 05, 2006 6:53 am

This is a known error...
But since the old forums got wiped, it's a new one :thumleft:
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Problem with Shen " ' " dralar

Postby Palladius » Wed Jul 05, 2006 2:51 pm

:scratch: :twisted:

How we can fix it :idea:
Last edited by Palladius on Wed Jul 05, 2006 2:53 pm, edited 1 time in total.
Palladius
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 6:44 am

Re: Problem with Shen " ' " dralar

Postby Sahasrahla » Wed Jul 05, 2006 7:24 pm

Open /lib/reputation.php and go to line 96:

Code: Select all
$id strtolower(str_replace(' ','',$this->data['faction'].$this->data['name'])); 


We're gonna add a str_replace to strip out the evil '

You'll end up with something like:

Code: Select all
$id str_replace('\''''strtolower(str_replace(' ','',$this->data['faction'].$this->data['name']))); 



Although to be thorough we should really strip out any non-alpha-numeric characters, just in case Bliz decides to make a faction named "Non-descript Troll Tribe #7". The above code won't strip out the - or the #. So forget that line of code above; let's get fancy and use Regular Expressions instead:

Code: Select all
$id strtolower(preg_replace('/[^a-zA-Z0-9]/'''$this->data['faction'].$this->data['name'])); 


That line of code will strip out anything non-alphanumeric so no matter what faction names Bliz throws at us, the reputation tab with always be XML (and javascript) compliant.
Last edited by Sahasrahla on Wed Jul 05, 2006 7:59 pm, edited 2 times in total.
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Problem with Shen " ' " dralar

Postby ScratchMonkey » Wed Jul 05, 2006 7:40 pm

I think a better solution is to preserve the character but make it XML-compatible. You could replace it with an XML Unicode entity, for instance. That would cover you no matter how "creative" Blizzard gets, and keeps you completely I18N-compatible.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA

Re: Problem with Shen " ' " dralar

Postby Sahasrahla » Wed Jul 05, 2006 8:16 pm

ScratchMonkey wrote:I think a better solution is to preserve the character but make it XML-compatible. You could replace it with an XML Unicode entity, for instance. That would cover you no matter how "creative" Blizzard gets, and keeps you completely I18N-compatible.


Maybe I haven't thought this all the way through, but it seems you're suggesting we change Shen'dralar to Shen&#apos;dralar or Shen&#039;dralar

While that would work for the xml compliance on the id tag, it would not work for the javascript compatibility.

Code: Select all
onmouseover="swapShow('rep_value_othershen&#039;dralar','rep_standing_othershen&#039;dralar');"


That would error out because of the ;


Besides, the point of this $id variable isn't to be human readable, it's simply to give each faction a unique id for the javascript to play with. It shouldn't really matter if we butcher the name.
Last edited by Sahasrahla on Wed Jul 05, 2006 8:21 pm, edited 2 times in total.
User avatar
Sahasrahla
Roster AddOn Dev
Roster AddOn Dev
 
Posts: 46
Joined: Tue Jul 04, 2006 1:53 pm
Location: Branson, MO, USA

Problem with Shen " ' " dralar

Postby ScratchMonkey » Wed Jul 05, 2006 9:56 pm

Ah, then the text doesn't even have to match the faction. You could just use the DB key.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA

Re: Problem with Shen " ' " dralar

Postby Palladius » Thu Jul 06, 2006 2:26 am

:scratch: :scratch: :scratch:
Palladius
WR.net Apprentice
WR.net Apprentice
 
Posts: 5
Joined: Wed Jul 05, 2006 6:44 am

Problem with Shen " ' " dralar

Postby ScratchMonkey » Thu Jul 06, 2006 5:56 pm

I'm just saying that the synthesized text just has to be a unique string. My only concern with stripping is that one might encounter two strings that differ only in punctuation, and simple stripping would present an ambiguity.

It's unlikely that Bliz would use a 4-digit number in the middle of a user-visible name, so you could drop in the Unicode value for the punctuation, but omit the entity delimiters so that the result is a valid JS name. For example:

rep_standing_othershen0039dralar

You could add additional "mangling" (a C++ term for under-the-hood name decoration) if Bliz does decide to start using names that look like that.
User avatar
ScratchMonkey
WR.net Expert
WR.net Expert
 
Posts: 212
Joined: Wed Jul 05, 2006 4:32 pm
Location: San Pablo, CA


Return to General Support & Feedback

Who is online

Users browsing this forum: No registered users and 0 guests