• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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.
 
Sheriff
Posts: 28436
104
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 ]
 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic