Is it possible to impose required constraint at value level?
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 4
- Joined: Fri Feb 21, 2020 1:51 pm
Is it possible to impose required constraint at value level?
Hello All,
Is it possible to impose required constraint at value level?
for example in below xml, I wnt to make sure value for alias1, coli1 and operator is always populated in condition element within where element.
functionalView name="CLAIMS_FV" description="Learning Purpose">
<columns>
<column name="CLAI.CODE" columnAlias="CODE" description="The code of the claim" />
<column name="CLLI.CODE" columnAlias="LINE_CODE" description="The code of the claim line" />
<column name="PROC.CODE" columnAlias="PROC_CODE" description="The code of the claim line procedure" />
</columns>
<fromviews>
<fromview name="CLAIMS_V" alias="CLAI" />
<fromview name="LINES_V" alias="CLLI" />
<fromview name="PROC_V" alias="PROC" />
<fromview name="PROV_V" alias="PROV" />
<fromview name="FORMS_V" alias="CLFO"/>
<fromview name="FORMTYPES_V" alias="CFTY"/>
</fromviews>
<joins>
<join alias1="CLLI" col1="CLAI_ID" condition="=" alias2="CLAI" col2="ID"/>
<join alias1="CLFO" col1="ID" condition="=" alias2="CFTY" col2="CLFO_ID"/>
<join alias1="CFTY" col1="ID" condition="=" alias2="PROC" col2="CFTY_ID"/>
<leftouterjoin alias1="PROV" col1="ID" condition="=" alias2="CLAI" col2="PROVIDER_ID"/>
</joins>
<where>
<condition alias1="CFTY" col1="CODE" operator="=" string="" number="" date= "" />
</where>
</functionalView>
Below is respective XSD for reference:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="functionalView" >
<xs:complexType>
<xs:sequence>
<xs:element name="columns">
<xs:complexType>
<xs:sequence>
<xs:element name="column" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="columnAlias" use="required"/>
<xs:attribute type="xs:string" name="description" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="fromviews" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="fromview" maxOccurs="unbounded" minOccurs="2">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="alias" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="joins" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="1">
<xs:element name="join" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="condition" use="required"/>
<xs:attribute type="xs:string" name="alias2" use="required"/>
<xs:attribute type="xs:string" name="col2" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="leftouterjoin" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="condition" use="required"/>
<xs:attribute type="xs:string" name="alias2" use="required"/>
<xs:attribute type="xs:string" name="col2" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="where" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="condition" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="operator" use="required"/>
<xs:attribute type="xs:string" name="string" use="optional"/>
<xs:attribute type="xs:string" name="number" use="optional"/>
<xs:attribute type="xs:string" name="date" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="description"/>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks,
Rajneesh
Is it possible to impose required constraint at value level?
for example in below xml, I wnt to make sure value for alias1, coli1 and operator is always populated in condition element within where element.
functionalView name="CLAIMS_FV" description="Learning Purpose">
<columns>
<column name="CLAI.CODE" columnAlias="CODE" description="The code of the claim" />
<column name="CLLI.CODE" columnAlias="LINE_CODE" description="The code of the claim line" />
<column name="PROC.CODE" columnAlias="PROC_CODE" description="The code of the claim line procedure" />
</columns>
<fromviews>
<fromview name="CLAIMS_V" alias="CLAI" />
<fromview name="LINES_V" alias="CLLI" />
<fromview name="PROC_V" alias="PROC" />
<fromview name="PROV_V" alias="PROV" />
<fromview name="FORMS_V" alias="CLFO"/>
<fromview name="FORMTYPES_V" alias="CFTY"/>
</fromviews>
<joins>
<join alias1="CLLI" col1="CLAI_ID" condition="=" alias2="CLAI" col2="ID"/>
<join alias1="CLFO" col1="ID" condition="=" alias2="CFTY" col2="CLFO_ID"/>
<join alias1="CFTY" col1="ID" condition="=" alias2="PROC" col2="CFTY_ID"/>
<leftouterjoin alias1="PROV" col1="ID" condition="=" alias2="CLAI" col2="PROVIDER_ID"/>
</joins>
<where>
<condition alias1="CFTY" col1="CODE" operator="=" string="" number="" date= "" />
</where>
</functionalView>
Below is respective XSD for reference:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="functionalView" >
<xs:complexType>
<xs:sequence>
<xs:element name="columns">
<xs:complexType>
<xs:sequence>
<xs:element name="column" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="columnAlias" use="required"/>
<xs:attribute type="xs:string" name="description" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="fromviews" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element name="fromview" maxOccurs="unbounded" minOccurs="2">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="name" use="required"/>
<xs:attribute type="xs:string" name="alias" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="joins" maxOccurs="1" minOccurs="1">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="1">
<xs:element name="join" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="condition" use="required"/>
<xs:attribute type="xs:string" name="alias2" use="required"/>
<xs:attribute type="xs:string" name="col2" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="leftouterjoin" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="condition" use="required"/>
<xs:attribute type="xs:string" name="alias2" use="required"/>
<xs:attribute type="xs:string" name="col2" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:element name="where" maxOccurs="1" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="condition" maxOccurs="unbounded" minOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute type="xs:string" name="alias1" use="required"/>
<xs:attribute type="xs:string" name="col1" use="required"/>
<xs:attribute type="xs:string" name="operator" use="required"/>
<xs:attribute type="xs:string" name="string" use="optional"/>
<xs:attribute type="xs:string" name="number" use="optional"/>
<xs:attribute type="xs:string" name="date" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:string" name="name"/>
<xs:attribute type="xs:string" name="description"/>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks,
Rajneesh
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Is it possible to impose required constraint at value level?
Hello Rajneesh,
I don't know what you do you mean by "always populated". If you want to make sure that a value is set for the alias1, coli1 and operator attributes, you can add a restriction on the string type. For example you can check that the length of the value is greater than one, something like this:
Best Regards,
Octavian
I don't know what you do you mean by "always populated". If you want to make sure that a value is set for the alias1, coli1 and operator attributes, you can add a restriction on the string type. For example you can check that the length of the value is greater than one, something like this:
Code: Select all
<xs:attribute name="operator" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service