It is currently 26 Aug 2025, 23:28
   
Text Size

Magic Data

General Discussion of the Intricacies

Moderator: CCGHQ Admins

Re: Magic Data

Postby Arch » 27 Feb 2011, 12:46

Ark wrote:Just a thought: XML isn't technically considered valid unless you include the mandatory header line at the top, which is at a minimum:
<?xml version="1.0">
Not mandatory but recommended: http://www.w3.org/TR/REC-xml/#sec-prolog-dtd
Valid seems to mean something else also: http://www.w3.org/TR/REC-xml/#dt-valid

Ark wrote:Although, a BOM and charset marker would he helpful to many people's XML software:
\xEF\xBB\xBF<?xml version="1.0" encoding="utf-8"?>
(The 3 hex bytes would show up as an invisible nothing in any text editor)
I've actually had the opposite experience. The more meta stuff added the more likely something is to break. DTDs for instance always seem to cause trouble for me. Do you know of any specific parsers/tools that would fail due to lack of BOM/encoding-declaration?

Either way I can see that specifying encoding could be useful. (Can't find how a lack of such a declaration should actually be handled. Doesn't seem like there is any explicit default encoding to fall back to.) Will add that to the next version, thanks for the feedback.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Magic Data

Postby Ark » 27 Feb 2011, 17:16

I'm aware of the "well formed" vs "valid" but I'm not really going to get into that. DTD's are nearly useless in practice, and so if I said "invalid" I really mean "not well formed".

Did the specs always say "SHOULD", I could have sworn they said "MUST", but anyway, most XML parsers I use (Small lightweight, C++ ones, not from Microsoft) will just fail if the first line isn't <?xml?> at the very minimum and declare that the file is not XML. The version="1.0" and encoding="utf-8" should not mess up any XML parser. If they do, they are very bad parsers indeed.

I have heard that the BOM's existence can make some certain XML parsers not be able to find the <?xml at the start of the file, and thus declare the document not XML, but I think most majorly used XML parsers can deal with a BOM.
BOMs are really meant for UTF-16 to tell LE from BE, and not really supposed to be in UTF-8 encoding, but it has become somewhat the defacto standard for UTF-8 text files to include BOMs, so most programs can deal with them.

Many programs, even Notepad and Wordpad, will default to ISO-8859-1 without the BOM, but these programs are not XML aware, and will not find the encoding="utf-8" anyway. It's still nice to be able to edit XML in a text editor sometimes though.
User avatar
Ark
Programmer
 
Posts: 350
Joined: 16 Jul 2008, 04:29
Has thanked: 10 times
Been thanked: 103 times

Re: Magic Data

Postby MageKing17 » 27 Feb 2011, 18:19

Of course, XML itself is just a solution looking for a problem, so I don't really care if it's well-formed XML as long as I can parse it if I have to. :P
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: Magic Data

Postby Arch » 27 Feb 2011, 19:28

Ark wrote:Did the specs always say "SHOULD", I could have sworn they said "MUST",
Haven't really look at the spec until today so I can't say. Found this in the annotated version though:

http://www.xml.com/axml/testaxml.htm wrote:Why Aren't XML Declarations Compulsory?

They should be, but history got in the way. An XML declaration adds a lot to the value of a document; it makes it self-identifying, and in the internationalized context, self-unpacking. We couldn't bring ourselves to make them compulsory, though, because quite a lot of existing SGML and HTML documents either are, or could easily be made, well-formed XML documents. This wouldn't be the case, though, if we'd required the XML declaration.

However, in all your new XML documents, you should definitely use an XML declaration unless you have a really good reason not to.
Based on that _MUST_ doesn't really seem far of.

Ark wrote:Many programs, even Notepad and Wordpad, will default to ISO-8859-1 without the BOM, but these programs are not XML aware, and will not find the encoding="utf-8" anyway. It's still nice to be able to edit XML in a text editor sometimes though.
Agreed. I mainly use emacs and it seems to apply some magic in finding the encoding of files so I've haven't really thought about it. Guess I can just add the BOM and see if anything blows up.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Magic Data

Postby Marek14 » 20 Apr 2011, 22:56

I adjusted the complete NPH spoiler from MTGSalvation to the format used by these data. Three reprints (plus the five basic lands, two pictures each, like MBS): Enslave, Evil Presence and Phyrexian Hulk.

Used {W/P}, {U/P}, {B/P}, {R/P} and {G/P} for Phyrexian mana, I think these are the official symbols. Used {P} for general Phyrexian mana symbol used on Rage Extractor.

As an aside, could we get consensus on the hybrid mana? It looks like they are currently uppercase in mana costs and lowercase elsewhere...

EDIT: found a typo in Arm with AEther - should be "Whenever this creature deals damage to an opponent, you may return target creature that player controls to its owner's hand."
Attachments
nph.zip
(7.24 KiB) Downloaded 318 times
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Magic Data

Postby Ark » 21 Apr 2011, 02:00

Marek14 wrote:I adjusted the complete NPH spoiler from MTGSalvation to the format used by these data. Three reprints (plus the five basic lands, two pictures each, like MBS): Enslave, Evil Presence and Phyrexian Hulk.

Used {W/P}, {U/P}, {B/P}, {R/P} and {G/P} for Phyrexian mana, I think these are the official symbols. Used {P} for general Phyrexian mana symbol used on Rage Extractor.

As an aside, could we get consensus on the hybrid mana? It looks like they are currently uppercase in mana costs and lowercase elsewhere...

EDIT: found a typo in Arm with AEther - should be "Whenever this creature deals damage to an opponent, you may return target creature that player controls to its owner's hand."
(?/P) for the card's mana cost or {(?/P)} in the rule text is probably the official method. {P} for generic on the one card. I'd go with uppercase, as most of Gatherer uses uppercase. I convert all lowercase to uppercase in my program before it gets exported.
User avatar
Ark
Programmer
 
Posts: 350
Joined: 16 Jul 2008, 04:29
Has thanked: 10 times
Been thanked: 103 times

Re: Magic Data

Postby Marek14 » 21 Apr 2011, 07:58

My file lacks reminder text, so in any case, it will have to be updated when the official spoiler comes out.

I found another typo, in Chancellor of the Dross, it should say "At the beginning of the first upkeep", like on Chancellors of Forge and Spires.

Also, Isolation Cell is lacking the {2}, should be:

Isolation Cell
4
Artifact
Whenever an opponent casts a creature spell, that player loses 2 life unless he or she pays {2}.
NPH U

Jor Kadeen, the Prevailer has "creatrues" in text, should be "creatures"

Some other notes:

1. Seems that planeswalkers currently display their loyalty between mana cost and type line -- I think they should display it after type line to make it consistent with creatures who display their P/T there.

2. The mana symbols in mana costs don't have {braces} (except for hybrid ones), while all the others do. If this was standardized, it might allow for easier text searches.

3. I suggest to put the loyalty abilities costs in [brackets] to mimic their cost box.

Also, Knights vs. Dragons should be now available as data
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Magic Data

Postby Marek14 » 26 Apr 2011, 07:01

New promo Archenemy scheme:

Drench the Soil in Their Blood
Scheme
When you set this scheme in motion, after the main phase, there is an additional combat phase followed by an additional main phase. Creatures you control gain vigilance until end of turn.
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Magic Data

Postby Arch » 26 Apr 2011, 17:29

The comprehensive rules says that mana is {A} and {A/B}, that's what I'm going to use. I would not go by gatherer for this as it's pretty inconsistent (or possibly consistent but mad) when it comes to mana representation.

Don't see any problems with your suggestions regarding the changes to the text Marek, will fix/implement those.

Probably won't have time to look at it until next week though. So I guess the update will coincide with the release to gatherer. (Usually up on gatherer around the time of pre-release right?)
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Magic Data

Postby Marek14 » 26 Apr 2011, 20:56

Should be, although given the early release of spoiler, it might happen sooner.
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Magic Data

Postby Marek14 » 29 Apr 2011, 06:38

Aaaand it's apparently there.
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

Re: Magic Data

Postby Arch » 03 May 2011, 16:30

Updated. Link
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Magic Data

Postby friarsol » 04 May 2011, 02:09

Thanks for the continual updates Arch. Definitely helpful to have everything in one place
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Magic Data

Postby Arch » 04 May 2011, 14:46

You're welcome, always nice to know that its being used.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Magic Data

Postby Marek14 » 04 May 2011, 17:32

Thanks for the update! :)
Marek14
Tester
 
Posts: 2773
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 303 times

PreviousNext

Return to Magic Rules Engine Programming

Who is online

Users browsing this forum: No registered users and 8 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 8 users online :: 0 registered, 0 hidden and 8 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 8 guests

Login Form