> ... before parsing it I saved as a grammar a schema ...

Could you be more specific about this? Where did you save it?

This FAQ [1] gives details about how this can be done. Basically, you need
to put the grammar in a grammar pool [2] (a default implementation [3]),
then set the pool to the parser via this property [4].

[1] http://xml.apache.org/xerces2-j/faq-grammars.html
[2] org.apache.xerces.xni.grammars.XMLGrammarPool
[3] org.apache.xerces.util.XMLGrammarPoolImpl
[4] http://apache.org/xml/properties/internal/grammar-pool

Hope this helps,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]



                                                                                
                                                
                      Ron                                                       
                                                
                      Rothblum/Haifa/IB        To:       [EMAIL PROTECTED]      
                                     
                      [EMAIL PROTECTED]                  cc:                    
                                                          
                                               Subject:  Default values with 
grammars                                           
                      05/26/2003 07:30                                          
                                                
                      AM                                                        
                                                
                      Please respond to                                         
                                                
                      xerces-j-user                                             
                                                
                                                                                
                                                
                                                                                
                                                



I have encountered the following problem when loading my schema as a
grammar. I have an xml file which is given as input (with no schema
specified), before parsing it I saved as a grammar a schema to which it
(the xml) should conform. After the parsing, attributes have not received
their default values. I added a reference to the schema in the xml and the
default values were there...

I have the following features for both the preparser (which loads the
schema) and the main parser (for the xml instance):

"http://xml.org/sax/features/namespaces";;
"http://apache.org/xml/features/validation/schema";;
"http://apache.org/xml/features/validation/schema-full-checking";;
"http://xml.org/sax/features/validation";;
"http://apache.org/xml/features/validation/schema/normalized-value";;
"http://apache.org/xml/features/validation/schema/element-default";;
"http://apache.org/xml/features/dom/defer-node-expansion";;

Is there some other feature that I need to set or is this just not
supported (if it isn't maybe it should be)?

Thanks,

Ron Rothblum.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to