static final String GARMIN_SCHEMA_LANGUAGE =
"http://www.w3.org/2001/XMLSchema-instance";
static final String W3C_XML_SCHEMA =
"http://www.w3.org/2001/XMLSchema";
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
saxParser.setProperty(GARMIN_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
??
On 2 April 2012 17:10, RedBullet <scottedchapman@gmail.com> wrote:
> Yea, I read that. My XML contains the following so I thought that would be
> sifficient:
> <?xml version="1.0" encoding="UTF-8"?>
> <TrainingCenterDatabase
> xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2
> http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd">
>
> Isn't that how it is supposed to work??
>
>
> On Monday, April 2, 2012 12:01:42 PM UTC-4, Daniel Drozdzewski wrote:
>>
>> Did you tell your parser which schema will it be validating against?
>> Setting validation flag to true is not enough...
>>
>> Have a look here at a quick validating example using SAXParser:
>> http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPSAX9.html
>>
>> Daniel
>>
>> On 2 April 2012 16:34, RedBullet <> wrote:
>> > I am parsing some XML with SAX, and I noticed that there was some XSD in
>> > the
>> > files I am parsing.
>> >
>> > So, I figured to would turn validation on the factory before I get the
>> > parse, but when I do I get an error saying there is no validating parser
>> > available.
>> >
>> > So... How does one validate XML on the Android??
>> >
>> > --
>>
>> --
>> Daniel Drozdzewski
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
--
Daniel Drozdzewski
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment