Hi all,
I'm trying to put together an XSD for an XML type I'm experimenting with.
I was just wondering whether it's possible for me to validate whether an
image element, which I've defined in my XSD, can be enforced to contain
either one named attribute, or two other named attributes.
My XML document will eventually look something like this:
<Vehicles>
<Vehicle>
<VehicleID>1</VehicleID>
<!-- Various other elements -->
<Images>
<Image
ImageURL="http://www.mywebsite.com/myvehicles/myvehicle.jpg" />
<Image Filename="myvehicle.jpg"
ImageData="1b549c8d0a8099809f7818927409b078a0707.. ." />
</Images>
<!-- Various other elements -->
</Vehicle>
</Vehicles>
My question:
Is there a way to force an Image element in the Images element to contain
either:
Just an ImageURL attribute
or
A Filename attribute and an ImageData attribute
--
Kind regards,
Anthony Williams 3 1129
Hi Anthony,
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to define 2 attributes in an
XSD, and force an element to contain either of them. If there is any
misunderstanding, please feel free to let me know.
As far as I know, this cannot be defined in XSD. However, we can put the
two attribute values in one, and use another attribute to identify the type
of the value attribute. The type attribute can be an enumerative value to
choose from ImageURL and FileName.
HTH. If anything is unclear, please feel free to reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Hi Kevin,
Thanks for the advice. We've gone down a seperate route with the XSD now due
to this. We've chosen to have three attributes, of which there must be at
least one.
We're also considering using a DTD instead of XSD.
Thanks anyway!
Kind regards,
Anthony Williams
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:R4**************@cpmsftngxa06.phx.gbl... Hi Anthony,
First of all, I would like to confirm my understanding of your issue. From your description, I understand that you need to define 2 attributes in an XSD, and force an element to contain either of them. If there is any misunderstanding, please feel free to let me know.
As far as I know, this cannot be defined in XSD. However, we can put the two attribute values in one, and use another attribute to identify the type of the value attribute. The type attribute can be an enumerative value to choose from ImageURL and FileName.
HTH. If anything is unclear, please feel free to reply to the post.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi Anthony,
Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jean-Christophe Michel |
last post by:
Hi,
In a complex merging of two (non ordered) xml files
i need to keep track of the elements of the second tree that were already
merged with first tree, to copy only unused elements at the end....
|
by: Pablo Gomes Ludermir |
last post by:
Hello,
I have the following case that I am trying to put in XML Schema.
I have the classes HelpItem, Document and Message that work as follows:
One HelpItem contains several Document and...
|
by: middletree |
last post by:
For an ASp Intranet app, I have some code that should work, but I am not able
to make it happen for some reason, after spending considerable time on this.
I am pretty thick when it comes to...
|
by: Neil Zanella |
last post by:
Hello,
I would like to know why the W3C decided not to make the following
valid XHTML:
<input checked type="radio" name="foo" value="bar" />FooBar
forcing people to write the following to...
|
by: Lisa |
last post by:
I have to work with an existing xml where there is a root element and all
other elements are children of the root (in other words there is no nesting
or hierarchy), e.g.
<myroot>
<A>adata</A>...
|
by: nathaniel.k.lee |
last post by:
Is it not possible, in IE, to dynamically click a radio button? I'm
grabbing some values from a database and using them to populate radio
buttons on a page. I have alternate code for Firefox...
|
by: Philipp |
last post by:
Hello. OK I know this is the most asked question in XML (it says in some
tutorial), but still. Please give me your insight on this (as I'm a newbie).
I want to store parameters for a programm in...
|
by: TT (Tom Tempelaere) |
last post by:
Hi all,
I created an XSD to define the structure of an XML file for my project. I
made an XML file linked to the XSD using XmlSpy. The problem is that if I
read the file using .NET XmlDocument...
|
by: Rafe |
last post by:
Hi,
I'm working within an application (making a lot of wrappers), but the
application is not case sensitive. For example, Typing obj.name,
obj.Name, or even object.naMe is all fine (as far as...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |