|
Max (and anybody who can help
me), I tried out
that but it result in a java.lang.ClassCastException.. the code is this : XMLParserConfiguration config = new
StandardParserConfiguration();
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();
XSElementDeclaration elem = ((XSModelImpl)
model).getElementDeclaration("os",null);
// this line ocurrs the exception.. the XSElementDeclaration cannot be
casted into a ((ElementPSVI
XSElementDeclaration elemson = ((ElementPSVI)
elem).getElementDeclaration(); I �ve been looking into the
xerces documentation but I still havent found a way to get the XSElementDeclaration
that are child of a XSElementDeclaration. Thanks, Rubens Del Monte -----Mensagem
original----- For child element you can extract its declaration as the following Hello, XMLParserConfiguration
config = new StandardParserConfiguration();
config.setProperty("http://apache.org/xml/properties/internal/grammar-pool",grammarPool);
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(); XSNamedMap
element = model.getComponents(XSConstants.ELEMENT_DECLARATION); XSElementDeclaration
elem = ((XSModelImpl) model).getElementDeclaration("os",null); …. -- Maksym Kovalenko |
Title:
- Can´t acess child elements definition Rubens Del Monte
- Re: Can´t acess child elements definition Maksym Kovalenko
- RES: Can´t acess child elements definition Rubens Del Monte
- Re: RES: Can´t acess child elements definiti... Maksym Kovalenko
