Re: Re: XmlPullParser.getAttributeValue( )
Aleksander Slominski <[email protected]> Wed, 05 Mar 2003 00:01:14 -0500
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
vivek200120 wrote:
> Whoa,Whoa...
> I am a bit out of sync here .,, .The
> attributeFormDefault="unqualified" is a property of the XML schema
> spec .Xml Pull parser parses just XML ,how then can it understand a
> Schema attribute. I am trying to use the pull parser to develop a
> schema parser and this has had me thinking..Camn some one tell me
> how much of the XML schema spec can the pull parser understand??
> If this is a naive question,excuse me .but will some one answer
XmlPullParser has no knowledge about XML schemas only about XML namespaces.
it seems that Naresh had schema with attributeFormDefault="unqualified"
but he expected attributes to be qualified and was surprised that calling
parser.getAttributeValue("http://www.user.org/user-schema",
"username"); did not work.
it did not work because of two separate issues: first because it should
not work as default XML namespaces does not apply to attributes and in
this XML document and as it was the case in his example XML document
default namespace was used and atttributes were were without namespace
prefix and such document has exactly valid attributes when unqualified
was used in XML schema (that was second issue: understanding what
exactly means (un)qualified).
hope that makes it clear.
thanks,
alek
>
>
>
>
>
> --- In [email protected], "Naresh Bhatia" <nbhatia@s...>
> wrote:
>
>> Stefan, Alek,
>>
>> Thanks for the clarification. I am now in sync!
>> Naresh
>>
>> -----Original Message-----
>> From: Aleksander Slominski [mailto:aslom@e...]
>> Sent: Tuesday, March 04, 2003 4:02 PM
>> To: [email protected]
>> Subject: Re: [xmlpull-dev] XmlPullParser.getAttributeValue( )
>>
>>
>> BTW: this is explained in greater length in
>> http://www.w3.org/TR/xmlschema-0/#ref38 (check "Instance
>
> with a
>
>> Qualified Attribute" example)
>>
>> alek
>>
>> Stefan Haustein wrote:
>>
>> >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
>>
>>
>
>
>
> 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/
>
>
--
"Mr. Pauli, we in the audience are all agreed that your theory is crazy.
What divides us is whether it is crazy enough to be true." Niels H. D. Bohr
------------------------ Yahoo! Groups Sponsor ---------------------~-->
New Yahoo! Mail Plus. More flexibility. More control. More power.
Get POP access, more storage, more filters, and more.
http://us.click.yahoo.com/Hcb0iA/P.iFAA/46VHAA/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/