473,563 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML-Schema: Attribute Value dependent rules?

XML-Schema: Attribute Value dependent rules?

As far as I can tell XML-Schema does not permit the sepcification of rules
that only apply if an attribute has a certain value. For example, in the
document below, attribute RemoteServer must be present and non-null if
attribute LocalMachine is false, but need not be present if it is true.

<Configuratio n>
<Registry LocalMachine="f alse" RemoteServer="\ \SERVER1"
RootKey="HKEY_L OCAL_MACHINE" RegistryKey="My RegKey"/>
</Configuration>

One solution to this is to allow one of two elements, say LocalRegistry and
RemoteRegistry each with their own attribute sets. Thus we could create a
schema to allow either of the following instance documents:

<Configuratio n>
<LocalRegistr y RootKey="HKEY_L OCAL_MACHINE" RegistryKey="My RegKey"/>
</Configuration>

or

<Configuratio n>
<RemoteRegist ry Server="\\SERVE R1" RootKey="HKEY_L OCAL_MACHINE"
RegistryKey="My RegKey"/>
</Configuration>

However I don't like this approach. Changing the name of the Element suggests
more differences than really exist, it is after all, just a registry.

The other solution is to keep just the one Registry element and make the
RemoteServer attribute optional, but that means that you cannot validate
the "RemoteServ er attribute must be specified if LocalMachine is false" rule.

Both approaches seem to have drawbacks, either clarity suffers or validation
becomes less exact.

Do other people share this view and if so what solutions have you come up with?

TIA

Andrew Lord
Jul 20 '05 #1
0 1468

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

Similar topics

8
2339
by: Robert J Egan | last post by:
Hi i'm trying to search a remote website page. The form returns xml information, though the page extension is missing. I retrieve the information and write it to the screen. So far so good - However i cannot format this information in anyway. A copy of the returned information saved to my server results in the xml data being formatted and...
1
2157
by: felipe_azv | last post by:
a got this code in asp to construct a xml , to export it to a url this is de asp code: <% SQL = "Select * from User where CodeUser in ("& request.form("C1" &")" set rs = server.CreateObject("ADODB.Recordset") rs.CursorType = 3
2
2760
by: Simon Strandgaard | last post by:
I am trying to understand how to create a 'catalog.xml' file for my docbook-xml documents. If I understand correct a local catalog.xml file can both avoid hardcoding in makefiles (portability), plus speed up if the stylesheet+dtds is located on the local machine. Question #1: How do I create a catagory.xml file, which works?
0
1536
by: MarionEll | last post by:
Premier XML Industry Event Slated for Dec. 7-12 in Philadelphia; Presenters Include Adobe, BEA, Microsoft, IBM, Sun, Hewlett-Packard, Oracle Alexandria, Va. Sept. 30, 2003 - IDEAlliance, a leading trade association dedicated to fostering XML and other information technology standards, today announced the full program for XML Conference...
0
1415
by: MarionEll | last post by:
XML 2003 Exposition Draws Leading XML Vendors Trade Show, Presentations Allow Companies to Showcase Cutting-edge Solutions Alexandria, Va. - Dec. 1, 2003 - XML 2003, the world's largest XML conference and exposition, will feature a trade show floor filled with key XML vendors including Adobe Systems, Inc. (NASDAQ: ADBE), ArborText, BEA...
3
1929
by: David L | last post by:
Hi, I am wondering that whether the fact that as more tools/environments/products support XML, then the need for knowing XML itself gets less important. I am comparing xml to assembler. IT staff generally use higher level languages and not get worried by assembler itself. Thanks for sharing your valuable insights.
5
4192
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple values in the where clause as below
0
2218
by: UncleRic | last post by:
Environment: Mac OS X (10.4.10) on MacBook Pro I'm a Perl Neophyte. I've downloaded the XML::Parser module and am attempting to install it in my working directory (referenced via PERL5LIB env): PERL5LIB=/Users/Ric/Library/Perl/ ls XML-Parser-2.34/ XML-Parser-2.34.tar
9
2473
by: Lie | last post by:
Why this generates AttributeError, then not? Python 2.5.2 (r252:60911, Apr 21 2008, 11:17:30) on linux2 Type "help", "copyright", "credits" or "license" for more information. Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'dom' <module 'xml.dom' from...
10
15555
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I had a program and it always works fine and suddenly it gives me the following message when a pass a xml file to our server program: error code: -1072896680 reason: XML document must have a top level element. line #: 0 I don't know if it is my xml file or it is something else? Here is my client side program: <%@...
0
7659
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8103
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.