- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Admin
gee...
Admin
The solution to this whole problem is realizing that you're using Visual Studio and that refactoring takes a few seconds (maybe a few minutes, if the project is a few hundred pages). Right-click -> refactor -> rename -> voila.
For those of you not familiar with VS 2005+, this allows you to rename a class, variable, struct, or pretty much anything from any point in the application and the compiler will go through the rest of your project and rename all other references to it to match, so that you don't have to fall back to find/replace and manual inspection of whether or not the current find actually needs to be replaced.
Use your tools, people. BasePage is fine, so long as when you need to change things and have it inherit from a new BasePage you rename the old BasePage to something more descriptive.
Admin
I worked at a place where they did exactly the same thing, about five years ago. The XML was impossible to validate. It was actually one of a long list of WTFs at that place, but this one bothered me because, as others have said, it demonstrates a grave lack of understanding of XML.
Admin
I worked in a company that had branches in the USA, Canada, and the UK. Some allegedly XML-savvy folks in the UK branch decided that we needed to represent a table of contents like this:
<BMark1 name="..."> <BMark2 name="..."/> <BMark2 name="..."> <BMark3 name="..."/> <BMark3 name="..."/> </BMark2> </BMark1> <BMark1 name="..."/>Where the depth of the element was encoded into the name, rather than being implied by its position in the document. This would also have sabotaged the ability to write an XSD or DTD unless you arbitrarily limited the depth.
Sadly, this kind of thing seems common in Enterprise-y circles.
Admin
There are two kinds of people: 1) those who start arrays with one and 1) those who start them with zero.
Admin
Generally something like this:
your XSD would mark index as a non-negative integer and the contents of the address tag as a string. Address would be marked as appearing a minimum of 0 times and an undefined maximum.
Admin
Admin
We have some "special" XML too. Ours would look like this:
<properties> <property> <propertykey>numberOfAddresses</propertykey> <propertyvalue>110</propertyvalue> </property> <property> <propertykey>address_1</propertykey> <propertyvalue>442 Fake St.</propertyvalue> </property> ... </properties>Fortunately I'm in the middle of cleaning it up now.
Admin
Do you mind if I take notes?
Admin
what does the XML operator "_" do??? I've never see that before, wish I knew about it because my XML programs would be soooo much faster (I'm guessing because I don't know what it is) plus it looks more professional and enterprisish!
I here are some sweet push and pop XML methods which work well with this data type.
function getNULLvalue() { alert("To do: Need to fix this and user should never see this message."); return null; } function popXML() { try { var seperator = "."; var documentValueAsString = "document"; var elementValueAsString = "element"; var firstValueAsString = "first"; var lastValueAsString = "last"; var nextValueAsString = "next"; var previousValueAsString = "previous"; var childValueAsString = "child"; var siblingValueAsString = "sibling"; var nodesValueAsString = "nodes"; var nodeValueAsString = "node"; var valueValueAsString = "value";
return; }
Admin
It's funny how much that resembles the Apple property list format, used throughout OS X:
Seriously, I can't believe how unhelpful this format is. It's like they were trying to make it a pain to traverse. On the plus side, the xsd is very, very simple.
Admin
"XML is god's revenge on C programmers for mocking Lisp. Not only do they have to have brackets; THEY HAVE TO NAME THEM AS WELL"
Admin
Can't we just get back to the purity of discussing whether or not one can devise a schema for this no doubt excellent piece of inter-process communication?
Admin
Feel free to elucidate.
Admin
Design decisions, you see. Design decisions. Incidentally, what was this moron thinking?
(For those that care, yes: the infinity in question is aleph-null. Just to be on the safe side.)
Admin
XML/Java philosophy: if it's too slow add more hardware
Admin
It's like God created himself...
Admin
I've never used XML, never had courses in XML and never read up on XML, all i know is that it stores data in a tree structure and has syntax much like HTML. But still i see how this is wrong!
Taking a tree and abusing it to make a list, by making all nodes children of the root, is kind a' like... why use a tree for that?
(hehe, finally an XML WTF i could throw a rant into :))
Admin
I think you mean
Even more customizable! You can have integer contents! Now if only XML came into this somewhere it would be enterprisy...oh...wait........
Admin
that needs not be a wtf on the "xml/dtd design" part. example: there's the possibility to insert dynamic data through xml into "adobe indesign cs1" - you can import the xml file and match xml nodes against design configuration. once the location of the xml node is set into the document, you can update the xml without the need to format the whole indesign document again. the problem is that indesign in that version could not understand following scheme, which would be the "appropriate way":
... so all you were able to do is to generate the dtd and xml dynamically and work just as the example above shows:
... so what are the options? create a well-designed xml file or create a crappy xml file and spare the layouter a week of additional work?
wtf needs not be on the xml side.
and yes, indesign seems to have improved on that problem in their next versions.
Admin
Admin
Bwahahaha! Does Ben work for EchoMail?
Admin
Admin
[quote user="OpieThe solution to this whole problem is realizing that you're using Visual Studio and that refactoring takes a few seconds... [/quote] Obviously you're not being paid by the hour ;^)
The correct solution to this whole problem is to throw Visual Studio out of the window and rewrite your entire application in a language / framework that actually works (Perl anyone?)...
Admin
[quote user="JimM"][quote user="OpieThe solution to this whole problem is realizing that you're using Visual Studio and that refactoring takes a few seconds... [/quote]
Obviously you're not being paid by the hour ;^)
The correct solution to this whole problem is to throw Visual Studio out of the window and rewrite your entire application in a language / framework that actually works (Perl anyone?)...[/quote] I hate it when windows autohighlights more text than you want to select :(
Admin
STOP IT STOP IT STOP IT STOP IT
this thread is making me cry ;_;
You are all bad bad people and I love you dearly.
Admin
442 Fake St. doesn't resolve to an address. What's really going on here?
Admin
badly... in the case of C++
Admin
That's exactly the same as what I've seen by a contractor for our systems:
<Bit0 value="Description 1"/> <Bit1 value="Description 2"/> <Bit2 value="Description 3"/> <CODEA value="4"/> <CODEB value="4"/> <CODEC value="9"/>Where CODEA, CODEB and CODEC were descriptors that could vary. No DTD for you!
Those config files are still in place, though. :( I always wanted to send them in ...
Admin
This is EXACTLY why XML is bunch of shit in brackets!
Admin
Never, ever, say you understand something after reading a piece of it on CodeSOD. ;)
Admin
Don't look at Visual Studio 2008, if this offends you.
Someone at MS doesnt' get XML.
Admin
Early C compilers were indeed written in a sub-set of C. Basically, they boot-strapped themselves. (Perhaps your grannie hangs around leather bars and would be excited by the concept?) I haven't looked into it, but I assume they still required a modicum of assembler on the output end in order to work on the plethora of weird chipsets available in the 1970s.
Admin
Correction accepted, however.
Admin
Admin
If XML isn't solving your problem, you need to use more XML.
Admin
Admin
lol
Admin
Um...wow.
So many levels of wrong, it hurts.
Just a quick tip, though: If you need to convert this to something more sensible, perl's XML::Simple comes to mind, which also has a Ruby port...very flexible, makes it fairly simple to convert XML data to native data structures.
Where you go from there, though, is anyone's guess. What the heck does one do with just addresses? Just curious.
Admin
Yeah, but it has an X in front. That means it's an Xtreme Array.
Admin
Hey I know that style, it's been generated with Access!
Damn thing makes up a schema for each file it generates. "Dude, making an XML file is easy, just get the data in a table and make it generate the XML from there".
Admin
Ack! That makes my brain hurt. Why even put an index on on the tag? You just loop over children of root node or write XSLT to process it. A simple xpath would give you the count of the address nodes. I could see maybe putting the sequence number on the address tag as an attribute, but that's not really necessary. Keep it simple and let the tools do the work for you. Thus:
<AddressList> 442 Fake St. 61 Main St. ... 3881 N 4th Ave. #5D </AddressList>Admin
Well, just take a look at Finvoice (by the Finnish Banking Association). They said that they had too little time to specify it. So it's like this (contents removed):
<SellerPartyDetails> <SellerPartyIdentifier /> <SellerOrganisationName /> <SellerOrganisationTaxCode /> </SellerPartyDetails> <SellerContactPersonName /> <SellerCommunicationDetails> <SellerEmailaddressIdentifier /> </SellerCommunicationDetails> <BuyerPartyDetails>...</BuyerPartyDetails> <InvoiceNumber /> <InvoiceDate />So, it's very nice that contact person and email address are not part of SellerPartyDetails, but the most obvious thing: why on earth don't they use <SellerParty><TaxCode />...</Sellerparty>? It would have two very basic benefits: it would be hierarchical, as XML should be, and it would allow software to check for addresses etc with specific tags and not use one tag for the seller, one for the buyer, third for the place of delivery etc.
But hey, it's not like it's in use in more than one country as the official e-invoicing standard...
Admin
XML is like violence.
If it doesn't solve the problem, use more!
Admin
How do you like this?
<Data name="XXXX"> <Data name="XX" value="XXXXX"/> <Data name="XXX" value="XXXXXX"/> </Data> <Data name="XXXXXX" value="XXXX"/> <Data name="XXXX"> <Data name="XXXX" value="XXXX"/> </Data> <Data name="XXX"> <Data name="XX" value="XXX"/> <Data name="XXXX" value="XXXXX"/> </Data>(I X'ed out the actual values)
and it goes on...
Admin
Sadly, I've done something like this before in my code for defining map data for a game :(
The good news was that I didn't type it by hand, I had another program generate it.
Admin
Admin
</rootNode> seems superfluous. I wonder if you could just delete it and everything would still work fine.