|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Does anyone know how to add "mutually exclusive" attributes n a schema?
I precise, for instance, the <elem> can have the attribute att1="" only and only if it havn't got a att2="" one. On the contrary the <elem> can have the attribute att2="" only and only if it havn't got a att1="" one. Thanks a lot to whom will give me a solution!! |
|
#2
|
|||
|
|||
|
You're trying to set mutual exclusion through setting attributes? as in if attr1="" and attr2="" then set attr1="locked"?
you can't do that if user one opens up the XML document, reads that both are "", and then user two opens up the XML document and reads both are "", then user one sets attr1="locked" and user two then sets attr2="locked" then mutual exclusion is broken. If your deriving this XML document from a DB you should do operations there since XML is generally meant for marshalling data. You'll need to find an outside component for locking a file on a computer, I can't think of any that are built in off the top of my head.....that's my 2 cents. |
|
#3
|
|||
|
|||
|
I'm not sure to understand your reply (thanks for it anyway!)
What I'm looking for is effectively a check mutually exclusive attributes. But I don't understand you talking about user 1 and user 2. I try to have a shema which validates: <elem att1="anyvalue" /> =OK <elem att2="anyvalue" /> =OK <elem att1="anyvalue" att2="anyvalue" /> = NOK Is that what you've understand? |
|
#4
|
|||
|
|||
|
that's absolutely what i was thinking. But i was thinking you'd
have it <elem att1="" att2=""/> =OK <elem att1="anyvalue" att2=""/> =OK <elem att2="anyvalue" att1=""/> =OK <elem att1="anyvalue" att2="anyvalue" /> = NOK anyway you put it, this cannot and will not work. In this case, the mutually exclusive area is the XML document. The point of mutual exclusion is to keep the document locked for one user so the users do not mess up any alterations and changes one user makes. The problem with attributes acting as a semaphore is they will not work. When I open this XML document, it is loaded into memory on my computer. You also load this document at virtually the same time. Lets say att1="ilk" and att2="" so that we should be able to alter it. We both read that att1 and 2 are not both set to OK. If i then write att2="df" and att1="lkj" then no user should be able to access this document. However, since user 2 (you) already read the variables, you then sets att2="kj" and already we have a problem, user 2 has overwritten data that user 1 has written, and this will continue as both users edit and update the document. I know of no way to lock a document without some component/feature add in. If this XML document is being handled from a SQL server, i'd recommend editing alll info from the DB instead, then generate the XML file. Last edited by unatratnag : September 2nd, 2003 at 12:27 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSD Schema + if else |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|