aspose file tools*
The moose likes Java in General and the fly likes The pain of a beginner developer - deciphering cryptic documentation and such Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "The pain of a beginner developer - deciphering cryptic documentation and such" Watch "The pain of a beginner developer - deciphering cryptic documentation and such" New topic
Author

The pain of a beginner developer - deciphering cryptic documentation and such

Andy Jack
Ranch Hand

Joined: Nov 22, 2012
Posts: 257
I wanted to learn XML parsing. I began with a DOM parser example here.
I wanted to know why DocumentBuilderFactory is really needed. So i went here. Don't go to that link.
That link talks about Document. To read about it, I went here.
I read the document and did not understand a word of it. There is no plain english explanation for it. . Don't even think about thinking why the normalize() method is there in the code.

So, I am wondering -

Am I thinking too much ? Should developers understand the purpose of each line of code ? Or is it just important to "get the work done" without having good fundamentals ?
Should I become a developer who copy pastes and just understands a little bit ? The boss won't reward me for being a knowledgeable guy. He/she will only care if a product
is created and put to market. Okay, maybe there is no need to go into every method and see how its implemented, but one should know why a line of code is there in the program.


Java Newbie with 72% in OCJP/SCJP - Super Confused Jobless Programmer.
I am a "newbie" too. Please verify my answers before you accept them.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
The javadocs are a reference, not an introduction. They describe how a particular method works, but not why it works that way, and how each fits into the larger context. The javadocs of some classes provide a useful introduction, but generally they don't.

Your first stop for introductory material regarding the Java class library should always be the Java Tutorial; it has a chapter on XML processing as well: http://docs.oracle.com/javase/tutorial/jaxp/index.html

The JAXP FAQ may also be useful: http://jaxp.java.net/1.4/JAXP-FAQ.html

As regards the page you first went to: It just shows the code without any explanations, so it may be good for getting up and running quickly, but not so much for learning what's going on. (Oh, and the "normalize" call is not required. You can experiment with what happens if you leave it in or take it out.)
Andy Jack
Ranch Hand

Joined: Nov 22, 2012
Posts: 257
Ulf Dittmer wrote:(Oh, and the "normalize" call is not required. You can experiment with what happens if you leave it in or take it out.)


Thanks for the links.

Yes, I had done that and it worked. In fact, I mentioned that in mr.mykong's webpage too. Problem is that if its not needed, then why is it there ?
Which makes me think what is the purpose of normalize ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Normalization is the process of transforming an XML document into a standard format. For example, these documents are identical from XML's point of view, even though they look different to a human (assuming that whitespace is not significant, which is usually the case):


Normalization of these two documents will result in documents that looks identical to humans.
Andy Jack
Ranch Hand

Joined: Nov 22, 2012
Posts: 257
Thanks Ulf. I have some questions which I hope are not silly.

I was also looking for some kind of example which shows us a (noticeable?) difference in the output of the parser. That is, it shows us an xml doc and points out all the places in the doc which could use normalization (and also tell us what normalization is ??? Is it like the normalization in databases ???). Then, show us output with normalization and without it so that we can compare and see the differences.

I hope I am not making this complicated.

Thanks.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
Well, you *are* making it more complicated than it needs to be by thinking about it at all You can happily use XML for years without ever having to worry about it. If the objective is to get up to speed with using XML in Java, I advise to forget about it for the moment - it's not an important concept.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18992
    
    8

Andy Jack wrote:Then, show us output with normalization and without it so that we can compare and see the differences.


That doesn't make any sense because normalization is a process which you apply to the Document object. It has really nothing to do with the XML document in its serialized form. The two things are not identical at all.

And I've been working with XML for years and years and never had to concern myself with whether a Document object was normalized or not.
Andy Jack
Ranch Hand

Joined: Nov 22, 2012
Posts: 257
Paul Clapham wrote:
And I've been working with XML for years and years and never had to concern myself with whether a Document object was normalized or not.


Okay. I don't know why they invented that method and why did mykong use it in his code - maybe they want to confuse me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: The pain of a beginner developer - deciphering cryptic documentation and such