473,238 Members | 3,271 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,238 software developers and data experts.

XSd problem,...

If I want to assign different value to different versions as the
followings:

<versions>
<version>
<name> a20 </name>
<value> 10 </value>
</version>

<version>
<name> b40 </name>
<value> 50 </value>
</version>

<version>
<name> others</name>
<value> 5 </value>
</version>
</versions>

I guess it cannot be simplified as below, even if we can use <xs:choice
maxOccurs="unbounded"> to define elements in any order with any
occurrences.. the problem is we cannot identify corresponding value for
each version...

<versions>
<version> a20 </version>
<value> 10 </value>

<version> b40 </version>
<value> 50 <value>

<version> others </version>
<value> 5 </value>
</versions>

Am I right? Could anyone confirm me about this if possible?
Thanks a lot!

Jun 6 '06 #1
4 1169
Hi,

You can define a sequence in the schema and specify the name and value
inside that sequence, then set the occurances on the sequence to handle
more versions, like below for instance:

<xs:element name="versions">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="version"/>
<xs:element name="value"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Getting the value for a version element should be easy, in XSLT for
instance if you match on a version element the the value is given by
the following XPath expression (assuming the document is valid against
the schema)

following-sibling::*[1]

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Jun 6 '06 #2
Thanks a lot!!!
Will I get problem if I need to access different values through XPath?
/versions/version/ ? /versions/value?
how can I get corresponding value for each version?
Mavis

George Bina wrote:
Hi,

You can define a sequence in the schema and specify the name and value
inside that sequence, then set the occurances on the sequence to handle
more versions, like below for instance:

<xs:element name="versions">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="version"/>
<xs:element name="value"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Getting the value for a version element should be easy, in XSLT for
instance if you match on a version element the the value is given by
the following XPath expression (assuming the document is valid against
the schema)

following-sibling::*[1]

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Jun 6 '06 #3
Hi Mavis,

If you reach a version element then the corresponding value is
following-sibling::*[1].

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

mavis wrote:
Thanks a lot!!!
Will I get problem if I need to access different values through XPath?
/versions/version/ ? /versions/value?
how can I get corresponding value for each version?
Mavis

George Bina wrote:
Hi,

You can define a sequence in the schema and specify the name and value
inside that sequence, then set the occurances on the sequence to handle
more versions, like below for instance:

<xs:element name="versions">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="version"/>
<xs:element name="value"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Getting the value for a version element should be easy, in XSLT for
instance if you match on a version element the the value is given by
the following XPath expression (assuming the document is valid against
the schema)

following-sibling::*[1]

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Jun 9 '06 #4
Thanks a lot. George.

George Bina wrote:
Hi Mavis,

If you reach a version element then the corresponding value is
following-sibling::*[1].

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

mavis wrote:
Thanks a lot!!!
Will I get problem if I need to access different values through XPath?
/versions/version/ ? /versions/value?
how can I get corresponding value for each version?
Mavis

George Bina wrote:
Hi,

You can define a sequence in the schema and specify the name and value
inside that sequence, then set the occurances on the sequence to handle
more versions, like below for instance:

<xs:element name="versions">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="version"/>
<xs:element name="value"/>
</xs:sequence>
</xs:complexType>
</xs:element>

Getting the value for a version element should be easy, in XSLT for
instance if you match on a version element the the value is given by
the following XPath expression (assuming the document is valid against
the schema)

following-sibling::*[1]

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Jun 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: =?Utf-8?B?am8uZWw=?= | last post by:
Hello All, I am developing an Input Methop (IM) for PocketPC / Windows Mobile (PPC/WM). On some devices the IM will not start. The IM appears in the IM-List but when it is selected from the...
1
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
9
by: AceKnocks | last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.