Home arrow static arrow Java Programming [Archive] - org.xml.sax, Interface ContentHandler
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - org.xml.sax, Interface ContentHandler
This topic has 5 replies on 1 page.

Posts:298
Registered: 4/8/04
org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:17 PM



 
Hi all,
In the above interface, we have startElement method. The API says:

"This event allows up to three name components for each element:
the Namespace URI;
the local name; and
the qualified (prefixed) name.
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
the Namespace URI and local name are required when the namespaces property is true (the default), and are optional when the namespaces property is false (if one is specified, both must be);
the qualified name is required when the namespace-prefixes property is true, and is optional when the namespace-prefixes property is false (the default). "

Can sb. please tell me:
- what does it mean when it says: "namespaces property is true and when it's false"?
- what's the difference bet. the local name; and the qualified (prefixed) name?

Thank you all. Any help is greatly appreciated.
 

Posts:2,206
Registered: 8/15/02
Re: org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:24 PM (reply 1 of 5)



 
For the first part, I think thiere is a type in the API, and it should read "feature" not "property", In the code you would have something like[code]
parser.setFeature("http://xml.org/sax/features/namespaces", true);
[/code[

I got this from http://xml.apache.org/xerces2-j/features.html

As for local vs. qualified name - it escapes me for the moment
 

Posts:2,206
Registered: 8/15/02
Re: org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:26 PM (reply 2 of 5)



 
Dang those format tags. Anyway, qualified name means name + namespace, while local name is just name.
 

Posts:31,095
Registered: 4/30/99
Re: org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:28 PM (reply 3 of 5)



 
If you have an element like this:
<foo:bar xmlns:foo="ftang/ftang/ole/biscuitbarrel">...
then:

Namespace URI = ftang/ftang/ole/biscuitbarrel

Local name = bar

Qualified name = foo:bar

(I'm pretty sure about the last one.)
 

Posts:298
Registered: 4/8/04
Re: org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:35 PM (reply 4 of 5)



 
Thank you all for responses. If I have an XML element like this:

<slide type="all">
<title>Wake up to WonderWidgets!</title>
</slide>

Then what the 'local name' and 'qualified name' will be?
Sorry that after all explanations I still am asking the same question...
 

Posts:2,206
Registered: 8/15/02
Re: org.xml.sax, Interface ContentHandler  
Aug 9, 2004 12:46 PM (reply 5 of 5)



 
localName will be "slide" or "title" (depending on the element)

Assuming you aren't using namespaces, the QualifiedNames for each will be "" I think.
 
This topic has 5 replies on 1 page.