Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » how to modify the XSD using the Xpath
how to modify the XSD using the Xpath [message #35522] Tue, 13 January 2004 07:18 Go to next message
Eclipse UserFriend
Originally posted by: mmahesh.firstam.com

HI all,

Can any one help me to solve the problem of
solving this problem
listed below..

1)My requirement is to modify the XSD file by using
the XPath.
2)XPath will be in terms of the element name and
not it terms of element.

for Example

The XSD file will look like this

<xs:complexType name=" AuthorsType ">

<xs:attribute name="Name" type="xs:string" use="required"/>

</xs:complexType>


<xs:element name="BookType">
<xs:complexType >

<xs:sequence>

<xs:element ref="Name"/>

<xs:element name="Authors" type="AuthorsType"/>

<xs:element ref="ISBN"/>

<xs:element ref="Publisher"/>

<xs:element ref="Shelf"/>

</xs:sequence>

</xs:complexType>
</xs:element >
<xs:element name="BookStore">

<xs:complexType>

<xs:sequence>

<xs:element ref="BooksType"/>

<xs:element name="Novels" type="NovelsType"/>

<xs:element name="Magazines" type="MagazinesType"/>

</xs:sequence>

</xs:complexType>

</xs:element>



Xpath will be BookStore/BooksType/AuthorType/@name that means BookStore
contains Books of type BooksType and BooksType contains Authors of type
AuthorsType



In the AuthorsType I want to change this attribute of use to optional
<xs:attribute name="Name" type="xs:string" use="required"/>
Re: how to modify the XSD using the Xpath [message #35729 is a reply to message #35522] Wed, 14 January 2004 06:32 Go to previous message
Eclipse UserFriend
Originally posted by: crscc.bol.net.in

Let me make an attempt in answering your query.
You could write a code that walks through the xsd model and puts your
xpath as key and the corresponding element / attribute as the object
inside a map object. I dont think there is anything available to do this
ready made.

Subsequently you could fetch the elemnt/attribute from the xpath.

Me and a friend have made something similar its not thoroughly tested (and
it does not work properly under certain scenarios such as when the com pex
type is extended by extension element)and we are interested only in read
access and not in modifying the xsd.




mahesh wrote:

> HI all,

> Can any one help me to solve the problem of
> solving this problem
> listed below..

> 1)My requirement is to modify the XSD file by using
> the XPath.
> 2)XPath will be in terms of the element name and
> not it terms of element.

> for Example

> The XSD file will look like this

> <xs:complexType name=" AuthorsType ">

> <xs:attribute name="Name" type="xs:string" use="required"/>

> </xs:complexType>


> <xs:element name="BookType">
> <xs:complexType >

> <xs:sequence>

> <xs:element ref="Name"/>

> <xs:element name="Authors" type="AuthorsType"/>

> <xs:element ref="ISBN"/>

> <xs:element ref="Publisher"/>

> <xs:element ref="Shelf"/>

> </xs:sequence>

> </xs:complexType>
> </xs:element >
> <xs:element name="BookStore">

> <xs:complexType>

> <xs:sequence>

> <xs:element ref="BooksType"/>

> <xs:element name="Novels" type="NovelsType"/>

> <xs:element name="Magazines" type="MagazinesType"/>

> </xs:sequence>

> </xs:complexType>

> </xs:element>



> Xpath will be BookStore/BooksType/AuthorType/@name that means BookStore
> contains Books of type BooksType and BooksType contains Authors of type
> AuthorsType



> In the AuthorsType I want to change this attribute of use to optional
> <xs:attribute name="Name" type="xs:string" use="required"/>
Re: how to modify the XSD using the Xpath [message #582663 is a reply to message #35522] Wed, 14 January 2004 06:32 Go to previous message
Raster R is currently offline Raster RFriend
Messages: 77
Registered: July 2009
Member
Let me make an attempt in answering your query.
You could write a code that walks through the xsd model and puts your
xpath as key and the corresponding element / attribute as the object
inside a map object. I dont think there is anything available to do this
ready made.

Subsequently you could fetch the elemnt/attribute from the xpath.

Me and a friend have made something similar its not thoroughly tested (and
it does not work properly under certain scenarios such as when the com pex
type is extended by extension element)and we are interested only in read
access and not in modifying the xsd.




mahesh wrote:

> HI all,

> Can any one help me to solve the problem of
> solving this problem
> listed below..

> 1)My requirement is to modify the XSD file by using
> the XPath.
> 2)XPath will be in terms of the element name and
> not it terms of element.

> for Example

> The XSD file will look like this

> <xs:complexType name=" AuthorsType ">

> <xs:attribute name="Name" type="xs:string" use="required"/>

> </xs:complexType>


> <xs:element name="BookType">
> <xs:complexType >

> <xs:sequence>

> <xs:element ref="Name"/>

> <xs:element name="Authors" type="AuthorsType"/>

> <xs:element ref="ISBN"/>

> <xs:element ref="Publisher"/>

> <xs:element ref="Shelf"/>

> </xs:sequence>

> </xs:complexType>
> </xs:element >
> <xs:element name="BookStore">

> <xs:complexType>

> <xs:sequence>

> <xs:element ref="BooksType"/>

> <xs:element name="Novels" type="NovelsType"/>

> <xs:element name="Magazines" type="MagazinesType"/>

> </xs:sequence>

> </xs:complexType>

> </xs:element>



> Xpath will be BookStore/BooksType/AuthorType/@name that means BookStore
> contains Books of type BooksType and BooksType contains Authors of type
> AuthorsType



> In the AuthorsType I want to change this attribute of use to optional
> <xs:attribute name="Name" type="xs:string" use="required"/>
Previous Topic:EclipseCon- Tutorials
Next Topic:use="required"/use="optional"
Goto Forum:
  


Current Time: Wed Apr 24 16:17:21 GMT 2024

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

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

Back to the top