|Re: Querying parents of element declarations [message #630913 is a reply to message #630876]
||Tue, 05 October 2010 14:46
| Ed Merks
Registered: July 2009
Have you looked at the model diagrams in the Javadoc? In general,
methods like EObject.eAllContents walk the containment tree, so you'll
want to have a look at that. Also in general, you can ask any EObject
for it's eClass() and from that EClass you can use
getEAllStructureFeatures to determine what features are available on the
object. I.e., there's a model you can query dynamically at runtime; the
same one that's shown in the model diagrams for your static analysis.
>>> However, I have not been able to figure out whether there are
>>> "convenience methods" that make it possible to know where a given
>>> element is allowed (either optional or required).
>> I'm not sure what you mean.
> If element "X" allows "Y" as a child, I want to be able to form a data
> structure that allows me to ask (programatically) "where is X allowed
> as a child?" or, similarly, if I ask "is Z allowed as a child of X?",
> the answer is "false".
> As far as I can tell, the XSD API is lower-level than that...so I'm
> asking for help in how to "walk" the XSD data model starting with the
> element declarations provided by the "getElementDeclarations" call to
> I've seen the code for XSDPrototypicalSchema.java, and it helped me to
> get to where I'm at now, but it only deals with
> loading/printing/serializing of the model and not "walking" the data
> model. Are there other sets of example/sample code?
Powered by FUDForum
. Page generated in 0.01889 seconds