[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: XML doubt
- From: "Pete Cordell" <petexmldev@codalogic.com>
- To: "**** ****" <****@****.***>,<andrew.j.welch@gmail.com>
- Date: Tue, 23 Sep 2008 09:40:02 +0100
Hi ****,
You should really mail the mailing list with these types of questions. For
one thing it shares the load of answering the questions, and also gives
others a chance to learn from the answer. It also means that there is a
Googlable archive of the question that others in future can look up. And
the final benefit is that if you pick out certain people to answer the
question, they may not actually know the answer; which is semi-relevant
here! For that reason I've included the xml-dev mailing list in the reply.
So, to answer your question as best I can, yes I think this is something
that an xs:assert could be used for. However, I'm not exactly sure what the
XPath expression would be! Andrew, and maybe somebody else on the list
should have a better idea. This is my best attempt:
<xs:element name='SERVICE_CATEGORY_PUB'>
<xs:complexType>
<xs:choice minOccurs='0'>
<xs:element ref='AGREEMENT_PUBLICATION'/>
<xs:element ref='NO_AGREEMENT_PUBLICATION'/>
</xs:choice>
<xs:attribute name='VALUE' type='serviceCat'/>
<xs:assert test="@serviceCat lt 17 or
AGREEMENT_PUBLICATION or
NO_AGREEMENT_PUBLICATION"/>
</xs:complexType>
</xs:element>
Also, xs:assert is a feature of the updated version of XML schema (version
1.1) and as mentioned elsewhere XSD 1.1 is very new, and isn't in its final
form yet. There are a few brave soles working on implementations, but you
would be advised to check your XML tool chain before getting too excited
about this answer!
BTW - I think your totalDigits constraint in serviceCat is redundant.
HTH,
Pete Cordell
Codalogic Ltd
Interface XML to C++ the easy way using XML C++
data binding to convert XSD schemas to C++ classes.
Visit http://www.codalogic.com/lmx/ for more info
----- Original Message -----
From: "**** ****" <****@****.***>
To: <petexmldev@codalogic.com>; <andrew.j.welch@gmail.com>
Sent: Tuesday, September 23, 2008 7:37 AM
Subject: XML doubt
Hi,I hope you guys are going to forgive me for disturbing you. I am new to
xml and have a terrible problem, which desperates me. I was searching the
web for any solutions to it but did not find anything. then I came across
your emails and here I am begging for help. pls help me with it:
See the element SERVICE_CATEGORY_PUB and its restriction
*serviceCat*.AGREEMENT_PUBLICATION and NO_AGREEMENT_PUBLICATION are
optional, but I would like to make them mandatory if the value entered is in
the range 17-27. Do you know how to do this? I attached the relative peace
of form.
<xs:element name='SERVICE_CATEGORY_PUB'>
<xs:complexType>
<xs:choice minOccurs='0'>
<xs:element ref='AGREEMENT_PUBLICATION'/>
<xs:element ref='NO_AGREEMENT_PUBLICATION'/>
</xs:choice>
<xs:attribute name='VALUE' type='serviceCat'/>
</xs:complexType>
</xs:element>
<xs:simpleType name='serviceCat'>
<xs:annotation>
<xs:documentation>Pattern for Service Category (Numeric between
1 and 27)</xs:documentation>
</xs:annotation>
<xs:restriction base='xs:integer'>
<xs:totalDigits value='2'/>
<xs:minInclusive value='1'/>
<xs:maxInclusive value='27'/>
Does it have anything to do with assert or alternative? + where can I find
more info about them, there is nothing substantial regrding these two on the
web.
I will be relly grateful for any help.
Best regards,
****
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
*This information was removed from the archives by OASIS staff on 2008-02-12.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]