• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Simple Name & Qualified Name

 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ???
 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hari ...
Thanx for the instant reply...
i will try this one
Thanx once again,
 
Andy Smith
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic