[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Designing constructor for QName class
I supose by "QName(String lname, String namespace = String())" you mean something like class QName{ private String namespaceURI; private String localName; public QName(String ln){ this.localName = ln; namespaceURI = new String(); } } This si indeed a possibility, but in many cases you might need more, like, for instance, to actually pass a namespaceURI to a constructor, or even a prefix. So you can overload the constructor. Like this: class QName{ private String namespaceURI; private String localName; private String prefix; public QName(String ln){ this.localName = ln; namespaceURI = new String(); prefix = new String(); } public QName(String ln, String nu){ this.localName = ln; namespaceURI = nu; prefix = new String(); } public QName(String ln, String nu, String px){ ..... } } This way the experienced users can use what suits them best. You can also take a look at this: http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/namespace/QName.html Chances are you have already a QName class at your disposal and you don't have to design any constructors. Greetings, Radu 2006/11/9, Frans Englich <frans.englich@t...>: On Thursday 09 November 2006 13:32, Richard Salz wrote:
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|