You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "P. Ramesh" <pr...@quark.co.in> on 2002/12/05 05:36:09 UTC

How do I get "prefix --> NamespaceURI" mapping information of a s chema file....

Hi,

I am using Xerces 2.20 for schema parsing.
I could able to parse a given schema file and get its psvi schema grammer. 
The problem I am facing is as follows :
	1) I am getting elements information with their namespaceURI's but
not their prefix's, how do I get the prefix --> NamespaceURI mapping
information of a schema file? (To put it in a simple manner, how do I get
the fully qualified name of a schema element?)

    The code which I used for parsing schema is as follows:

    DOMImplementationAS domImpl =
(DOMImplementationAS)ASDOMImplementationImpl.getDOMImplementation();
    // create a new parser, and set the error handler
    DOMASBuilder parser = domImpl.createDOMASBuilder();
    parser.setErrorHandler(this);

    // set the features. since we only deal with schema, some features have
    // to be true
    parser.setFeature(NAMESPACES_FEATURE_ID, true);
    parser.setFeature(VALIDATION_FEATURE_ID, true);
    parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
    parser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID,
DEFAULT_SCHEMA_FULL_CHECKING);

    //
    // PARSING XML SCHEMAS
    //

    try {
      ASModel asmodel = null;
      asmodel = parser.parseASURI(<schemaURI>);
	
	ASModelImpl model = (ASModelImpl)asmodel;
    	Vector models = model.getInternalASModels();
    	SchemaGrammar[] grammars = new SchemaGrammar[models.size()];
    	for (int i = 0; i < models.size(); i++) {
      	grammars[i] = ((ASModelImpl)models.elementAt(i)).getGrammar();

	//My code follows
	.......
	.......
	.......

Please let me know how can I get the prefix information of a schema file?

Thanks
pramesh

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org