aspose file tools*
The moose likes Product and Other Certifications and the fly likes Simple Name & Qualified Name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Simple Name & Qualified Name" Watch "Simple Name & Qualified Name" New topic
Author

Simple Name & Qualified Name

Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
signature of startElement is:-
public void startElement(String namespaceURI,
String sName, // simple name
String qName, // qualified name
Attributes attrs)

What is the diffence between the Simple Name & the qualified name ???


Share Knowledge to gain it.
SCJP 2, SCWCD 2, SCDJWS, IBM 141 (In Progress), IBM 486 (Next)
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
Hi Andy,
The startElemnt() tag syntax (which I assume You picked up from the org.xml.sax.ContentHandler interface) is better defined as
public void startElemnt(string namespaceURI, string localName, string fullName, Attributes attributes)
Before going into the definition of the names, consider the following element
<p:name xmlns ="http://www.clearMyDoubts/XML/names" ></p:name>
In teh above case
the elemnt "name" belongs to the namespace "p" defined by "http://www.clearMyDoubts/XML/names"
simpleName(sName) or localName = Just the name of the elemnt which is just the name of teh elemnt, without teh namespace it is associated with !!. In our case it will be --> name
qualifiedName(qName) or fullName = The full name of teh elemnt , including the namespace it is associated with, that is, the name of teh elemnt along with the prefix !!. In our case here it will be --> p:name

Hope this clears your doubt
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
Hi Hari ...
Thanx for the instant reply...
i will try this one
Thanx once again,
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
Hari i tried running this ...on simple xml file
<?xml version="1.0"?>
<p:name xmlns ="http://www.clearMyDoubts/XML/names" ></p:name>

Result:
NamespaceUri is coming blank,
simplename is blank
Qname is p:name
can u please tell me y namespaceuri and simplename are blank???
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
Hi Andy,
You dint define the name space for p
Here is your definition:
1.<?xml version="1.0"?>
2.<p:name xmlns ="http://www.clearMyDoubts/XML/names">
</p:name>
In Line 2, you have to define waht namespace p occupies. So it should be "xmlns :p " instead of "xmlns". That is why, you are geting teh namespace as blank !!
Unfortunately, in my previous posting, "xmlns :p " was converted to a smiley face, becase of teh quoataion ":" ..
Sorry about that
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
Hari thanx once again for the instant reply..
this time i tried with
<?xml version="1.0"?>
<p:name xmlns ="http://www.clearMyDoubts/XML/names"></p:name>
but unfortunately i m getting the same result ..
blank namespace..blank simplename,
QName = p:name
Any idea???
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
Hi Andy,
I am not sure y u are getting taht output ..
here is the code I used

File is

and output is

hope this helps !! :-)
Andy Smith
Ranch Hand

Joined: Sep 28, 2003
Posts: 239
hi Hari....
Im too sorry to say..but still i m getting the same results..
Can there be any Parser Configuration issue..???
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
what are you using andy?
I think you might be using teh sax package from java ?
let me know ..in nay case here is teh link to my source files ...
http://www1.coe.neu.edu/~hari/html/tutorials/xml/src/SAX/
Good Luck
If you still face problems, post the code..lets debug it together
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Simple Name & Qualified Name