Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Node -> XSDConcreteComponent
Node -> XSDConcreteComponent [message #55758] Wed, 01 December 2004 13:20 Go to next message
Eclipse UserFriend
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
Re: Node -> XSDConcreteComponent [message #55787 is a reply to message #55758] Wed, 01 December 2004 13:34 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------060403090002020701030205
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hajo,

You can use XSDSchema.getCorrespondingComponent to find the component
for a given node, e.g.,

context.getSchema().getCorrespondingComponent(schemaNode)

I don't think XPath will let you traverse resolved refs, so I don't
think you can do what you want with XPath in that regard.


Hajo Hoffmann wrote:

>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
>
>


--------------060403090002020701030205
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hajo,<br>
<br>
You can use XSDSchema.getCorrespondingComponent to find the component
for a given node, e.g.,<br>
<blockquote>&nbsp; context.getSchema().getCorrespondingComponent(schemaNode)<br >
</blockquote>
I don't think XPath will let you traverse resolved refs, so I don't
think you can do what you want with XPath in that regard.<br>
<br>
<br>
Hajo Hoffmann wrote:
<blockquote cite="midruninpanic-39ACE1.14202001122004@eclipse.org"
type="cite">
<pre wrap="">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:
&lt;xs:complexType name="general"&gt;
&lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
&lt;xs:group ref="alpha"/&gt;
&lt;xs:group ref="beta"/&gt;
&lt;xs:group ref="gamma"/&gt;
&lt;/xs:choice&gt;
&lt;/xs:complexType&gt;

&lt;xs:complexType name="alpha"&gt;
...
&lt;/xs:complexType&gt;

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
</pre>
</blockquote>
<br>
</body>
</html>

--------------060403090002020701030205--
Re: Node -> XSDConcreteComponent [message #592960 is a reply to message #55758] Wed, 01 December 2004 13:34 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060403090002020701030205
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hajo,

You can use XSDSchema.getCorrespondingComponent to find the component
for a given node, e.g.,

context.getSchema().getCorrespondingComponent(schemaNode)

I don't think XPath will let you traverse resolved refs, so I don't
think you can do what you want with XPath in that regard.


Hajo Hoffmann wrote:

>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
>
>


--------------060403090002020701030205
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hajo,<br>
<br>
You can use XSDSchema.getCorrespondingComponent to find the component
for a given node, e.g.,<br>
<blockquote>&nbsp; context.getSchema().getCorrespondingComponent(schemaNode)<br >
</blockquote>
I don't think XPath will let you traverse resolved refs, so I don't
think you can do what you want with XPath in that regard.<br>
<br>
<br>
Hajo Hoffmann wrote:
<blockquote cite="midruninpanic-39ACE1.14202001122004@eclipse.org"
type="cite">
<pre wrap="">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:
&lt;xs:complexType name="general"&gt;
&lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
&lt;xs:group ref="alpha"/&gt;
&lt;xs:group ref="beta"/&gt;
&lt;xs:group ref="gamma"/&gt;
&lt;/xs:choice&gt;
&lt;/xs:complexType&gt;

&lt;xs:complexType name="alpha"&gt;
...
&lt;/xs:complexType&gt;

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
</pre>
</blockquote>
<br>
</body>
</html>

--------------060403090002020701030205--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Node -> XSDConcreteComponent
Next Topic:Running out of memory..
Goto Forum:
  


Current Time: Thu Mar 28 09:54:11 GMT 2024

Powered by FUDForum. Page generated in 0.05074 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top