Re: XmlPullParser.getAttributeValue( )

Stefan Haustein <[email protected]> Tue, 04 Mar 2003 21:49:45 +0100
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
Naresh,

by default, attributes are in no namespace. The default namespace prefix 
does not apply to attributes. This is not a property of XmlPull but of 
the XML namespace specification.

Best,
Stefan

Naresh Bhatia wrote:
> I need some clarification on 
> XmlPullParser.getAttributeValue(java.lang.String namespace,  
> java.lang.String name). My schema is as follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
>   targetNamespace="http://www.user.org/user-schema"
>   xmlns="http://www.user.org/user-schema"
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>   elementFormDefault="qualified"
>   attributeFormDefault="unqualified">
> 
>   <xsd:complexType name="User">
>     <xsd:sequence>
>       <xsd:attribute name="username" type="xsd:string"/>
>       <xsd:attribute name="password" type="xsd:string"/>
>     </xsd:sequence>
>   </xsd:complexType>
> 
>   <xsd:element name="user" type="User"/>
> </xsd:schema>
> 
> My instance is as follows:
> 
> <user
>   xmlns="http://www.user.org/user-schema"
>   username="john" password="john"/>
> 
> I was expecting to get the username attribute as follows:
> 
>   parser.getAttributeValue("http://www.user.org/user-schema",  "username");
> 
> However xpp3 did not like the namespace parameter: I set it to null and 
> even that did not work. Finally it worked with the following change:
> 
>   parser.getAttributeValue("",  "username");
> 
> Is this the expected behavior? Why?
> 
> Thanks.
> Naresh
> 
> 
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
> <http://rd.yahoo.com/M=246920.2960106.4328965.2848452/D=egroupweb/S=1706030390:HM/A=1464858/R=0/*http://www.gotomypc.com/u/tr/yh/cpm/grp/300_Cquo_1/g22lp?Target=mm/g22lp.tmpl>
> 
> 
> To unsubscribe from this group, send an email to:
> [email protected]
> 
> 
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service 
> <http://docs.yahoo.com/info/terms/>.



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/2U_rlB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/