473,326 Members | 2,175 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,326 software developers and data experts.

help needed in writing xsd for this specific requirement

I have the following xml:

<BookStore>
<Book>
<title></title>
<author></author>
</Book>
<Book>
<title></title>
<author></author>
</Book>
</BookStore>

ideally the xsd for the above xml would be as follows:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="BookStore">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Book" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

But my requirement now is while defining the xsd i do not want to refer to the "Book" tag but directly give the validation specifications for title and author tag.
Is there any way i could do this without referring to the parent "Book" tag?
Sep 13 '07 #1
4 1294
jkmyoung
2,057 Expert 2GB
Do you mean declare a complex type usable by other elements?

Expand|Select|Wrap|Line Numbers
  1. <xsd:complexType name="BookType">
  2.     <xsd:sequence>
  3.         <xsd:element name="title" type="xsd:string"/>
  4.         <xsd:element name="author" type="xsd:string"/>
  5.     </xsd:sequence>
  6. </xsd:complexType>
  7.  
Not entirely sure what you're looking for.
Sep 13 '07 #2
My situation is some thing like this:
the "Book" node keeps changing by name but its inner tags <title> and <author>
will remain the same

i.e now it is
<bookStore>
<book>
<title></title>
<author></author>
</book>
<bookStore>

later my xml might change to:
<bookStore>
<book1>
<title></title>
<author></author>
</book1>
<bookStore>

In both the cases the sub nodes are same. So in my XSD i would like to specify the validation for the title and author tags without referring to its immediate parent i.e book. Is there any solution to this
I hope i am clear
Sep 14 '07 #3
jkmyoung
2,057 Expert 2GB
There isn't a solution in xml schema to the extent that you're asking for.

You can declare the title and author elements, and add a <any namespace="##local"> tag inside bookStore, but that doesn't guarantee the structure you are proposing.
Sep 14 '07 #4
ok thanks a lot for the reply

regards
Deepa
Sep 17 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: *** HAWK | last post by:
I'm trying to make a music CD webpage (eg hmv.com) using ASP. I want it to follow these guidelines: All visitors should be able to obtain a list of 1 - all CDs in the database listed by A-Z by...
31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
8
by: Wolfgang Lipp | last post by:
<annotation> the first eleven contributions in this thread started as an off-list email discussion; i have posted them here with the consent of their authors. -- _w.lipp </annotation> From:...
28
by: stu_gots | last post by:
I have been losing sleep over this puzzle, and I'm convinced my train of thought is heading in the wrong direction. It is difficult to explain my circumstances, so I will present an identical...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
83
by: deppy_3 | last post by:
Hi.I am started learning Programm language C before some time.I am trying to make a programm about a very simple "sell shop".This programm hasn't got any compile problem but when i run it i face...
118
by: Chuck Cheeze | last post by:
This might be in the wrong group, but... Here is an example of my data: entry_id cat_id 1 20 2 25 3 30 4 25 5 35
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: nzkks | last post by:
Hi, I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Objectdatasource using DAL & BLL classes My objectdatasource can produce below output by CategoryID parameter:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.