Node -> XSDConcreteComponent [message #592949] |
Wed, 01 December 2004 13:20 |
Eclipse User |
|
|
|
Originally posted by: runinpanic.gmx.de
Hi,
I wish to find the corresponding XSDConcreteComponent-Object to a given
Node.
I have a XSDConcreteComponent and an XPath-Expression to get the node:
private void whatever(XSDConcreteComponent context, String xpath) {
Element root = context.getElement();
Node schemaNode = XPathAPI.selectSingleNode(root, xpath);
...
}
Now I need the XSDConcreteComponent the schemaNode points at. My first
plan was to create a hashtable of all given XSDConcreteComponents with
the Node as key. Is there a less time-consuiming way?
But there is another problem with these Nodes:
The XPaths point into an XMLSchema-File. Possible references in the
XMLSchema should be resolved. A Node pointing to a referred Element
should be translated into the resolved XSDConcreteComponent.
Example:
Schema:
<xs:complexType name="general">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="alpha"/>
<xs:group ref="beta"/>
<xs:group ref="gamma"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="alpha">
...
</xs:complexType>
The context is the "general"-complexType-Element as XSDConcreteComponent.
The xpath is "/xs:choice/xs:group[1]".
The result-XSDConcreteComponent should be the resolved
"alpha"-complexType-Element.
Does someone has an idea how to implement such a method?
Thank you in advance
Hajo Hoffmann
|
|
|
Powered by
FUDForum. Page generated in 0.03330 seconds