You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by xe...@spamgourmet.com on 2010/12/01 13:14:45 UTC

Allow attributes from other namespaces despite validation?

Hi, All,

I am using Xerces-C++ 3.1.1 for SAX2 parsing. I am parsing a W3C standard 
format, the Speech Recognition Grammar Specification 1.0 (SRGS), for which a 
standard DTD and Schema are provided, and I am currently validating using 
both files. The SRGS recommendation says that if attributes or elements from 
other namespaces are encountered, it is permissible to ignore them or 
process them.

Right now, if I try to define a new namespace in an SRGS XML file, and then 
add an attribute using that namespace to an existing element, I get a 
validation error ("attribute '{http://www.example.com/2010/test}attr' is not 
declared for element 'rule'"). Sample file is below.

I'd like to figure out how to ignore or process the attribute. Is there some 
combination of features I can set that will validate to the SRGS namespace, 
yet will allow such items through without errors? Failing that, is there 
anything I can do short of editing the SRGS DTD and/or Schema? Can I do 
something in a Schema for my "test" namespace that might help? Thanks,

Lee Doron


vvvvvvvv

<?xml version="1.0" encoding="WINDOWS-1252"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                   "http://www.w3.org/TR/speech-grammar/grammar.dtd">

<grammar version="1.0"
          xmlns="http://www.w3.org/2001/06/grammar"
          xmlns:test="http://www.example.com/2010/test"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.w3.org/2001/06/grammar
                              http://www.w3.org/TR/speech-grammar/grammar.xsd
                              http://www.example.com/2010/test
                              test.xsd"
          xml:lang="en-US"
          >
   <rule id="hi" test:attr="1">
   hi
   </rule>
</grammar>

^^^^^^^^