Hello

I'm fairly new to the native interface and implementation APIs and have been 
having some difficulties. I have a schema we are using for the purpose of 
representing the semantics of a
domain and also to validate whether fragments of non-xml text could be marked
up as XML.  When we are parsing the schema and storing the elements as Java
objects in our data structure, I would like to be able to be able to capture
the simple types as some Java object such as org.apache.xerces.impl.xs.DateDV 
and store that.

1)  Is there a way to access this kind of attribute datatype information from a
SchemaGrammar, or by using some other method than using SchemaGrammars?  From
what I can see, you can't access the datatype information of attributes and
simple types that aren't globally declared using a SchemaGrammar, but maybe I'm 
missing something. It looks like this kind of information could be retrieved 
using xerces' dom's ASModel, but that is unfortuanately being deprecated.

2)  If there isn't a way and I'm stuck with temporarily using ASModels, do you
have any idea how much longer they'll be in existance?

3)  I am also having my share of problems just getting the SchemaGrammar.  I 
can get it using the DOMASModel, but getting it the straitforward way with the 
org.apache.xerces.impl.xs.traversers.XSDHandler, I end up getting null pointer 
exceptions after the parseSchema is called (no other other info from stacktrace 
besides that) 

....
String filename = "sample.xsd";
        File schemaFile = new File(filename);
        Reader reader = new InputStreamReader(new FileInputStream(schemaFile)); 
        XMLInputSource input = new XMLInputSource(null, filename, null);
        input.setCharacterStream(reader);

        XSDDescription descr = new XSDDescription();
        descr.setTargetNamespace("http://www.oreilly.com/javaxml2";);
        descr.setLiteralSystemId(filename);
        descr.setContextType(descr.CONTEXT_PREPARSE);
        descr.setLocationHints( new String[] { filename } );
        
        XSDHandler handler = new XSDHandler(new XSGrammarBucket());
        SchemaGrammar gramm = handler.parseSchema(input, descr, new Hashtable
());


I have a feeling its my use of the XSDDescription thats at fault, because when 
I used another method on the XSDHandler that took the XSDDescription as an 
argument, I got a null ptr exception again.  I tried about every permutation 
possible, setting or not setting various different system id's, which I don't 
entirely understand either (i.e. expanded, literal, base, all using the 
filename for the file in the pwd), as well as location hints and enclosing tag 
which I have a feeling I don't need. 

Any tips or sample code that could get me started with working with 
SchemaGrammars or XSDDescriptions correctly?

Thank you in advance and sorry for the long letter,
Eric Shell

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

Reply via email to