Hello,

 

    I�m starting to develop an application with Xerces and I�m having some trouble acessing the validation information of  child nodes.

 

My code is the following :

 

 

XMLParserConfiguration config = new StandardParserConfiguration();

 

// the pool is empty, but the schema is loaded when parsed, and the validation occurs

            config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",grammarPool);

 

            DOMParser parser = new DOMParser(config);

            parser.setFeature("http://xml.org/sax/features/validation",true);

            parser.setFeature("http://apache.org/xml/features/validation/schema",true);

            parser.parse(filename);

            doc = parser.getDocument();

           

            org.apache.xerces.impl.xs.psvi.XSModel model  = grammarPool.toXSModel();

 

            // the only element this brings is the root node

XSNamedMap element = model.getComponents(XSConstants.ELEMENT_DECLARATION);

 

// I first tried this, but it only works with the root element, none of the others. They don�t have namespace too…

XSElementDeclaration elem = ((XSModelImpl) model).getElementDeclaration("os",null);

….

 

 

If anyone can help me, please, I�ve been trying to do this but it�s taking too long…

 

 

Thanks,

 

Rubens Del Monte

 

Reply via email to