Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using a keyword as a value for only one type of attribute

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to validate a xml against a schema and I wish that a keyword in my case "binaryFileID" only be used as a value for the attribute type of element of type col i.e. and no where else in the xml. How would I do this?

<col type="binaryFileID">FILEID</col>


Thank you for your time.
 
Marshal
Posts: 28271
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had a look at an XSL Schema tutorial, specifically the part about "restrictions". It's here:

http://www.w3schools.com/schema/schema_facets.asp

Anyway, you can put an xs:restriction on any element, and you can use an xs:pattern as a restriction which uses a regular expression. So, just figure out a regular expression that says "not equal to 'binaryFileID'" and put that restriction on every attribute in the schema except that one.

I have to say that I find this a strange requirement. Why should the contents of one attribute type be allowed to affect the contents of a completely unrelated attribute type?

(Arggh... no smilies for XML!)

[ January 20, 2006: Message edited by: Paul Clapham ]
[ January 20, 2006: Message edited by: Paul Clapham ]
 
Do Re Mi Fa So La Tiny Ad
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic