How can I do this in a Schema?
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 17
- Joined: Fri Aug 19, 2005 6:02 pm
How can I do this in a Schema?
Hi all,
I have a question about how to create a schema that will validate this format.
I have a file that used to have a format like this.
element type 1
element type 2
element type 2
element type 2
element type 3
element type 3
element type 3
element type 3
It has been changed to this format.
element type 1
element type 2
element type 3
element type 3
element type 2
element type 3
element type 3
element type 2
element type 3
I have a schema that works for the former format. I haven't been able to figure out how to get one to validate the new format.
Could someone please point me in a direction to help figure it out?
Thanks much,
Doug
I have a question about how to create a schema that will validate this format.
I have a file that used to have a format like this.
element type 1
element type 2
element type 2
element type 2
element type 3
element type 3
element type 3
element type 3
It has been changed to this format.
element type 1
element type 2
element type 3
element type 3
element type 2
element type 3
element type 3
element type 2
element type 3
I have a schema that works for the former format. I haven't been able to figure out how to get one to validate the new format.
Could someone please point me in a direction to help figure it out?
Thanks much,
Doug
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Doug,
I'm not sure what you want the schema model to cover, if you want for instance element type 1 followed by any of element type 2 or 3 aany numner of times then you can encode that as
If that is not what you want then please provide more details.
Best Regards,
George
I'm not sure what you want the schema model to cover, if you want for instance element type 1 followed by any of element type 2 or 3 aany numner of times then you can encode that as
Code: Select all
<xs:sequence>
<xs:element name="element1" type="type1">
<xs:choice maxOccurs="unbounded">
<xs:element name="element2" type="type2">
<xs:element name="element3" type="type3">
</xs:choice>
</xs:sequence>
Best Regards,
George
-
- Posts: 17
- Joined: Fri Aug 19, 2005 6:02 pm
Thanks George,
What I am trying to accomplish is this.
For every element 1 there will be at least 1 element 2 that will immediatly follow element 1.
For every element 2 there will be at least 1 element 3 that will immediately follow element 2.
So the following would be what I am trying to model.
E1
E2
E3
E3
E3
E2
E3
E2
E3
E3
The following would be incorrect and cause an error.
E1
E3
E2
E1
E2
E2
E3
E3
or
E2
E3
E1
Does this make sense?
Thanks,
Doug
What I am trying to accomplish is this.
For every element 1 there will be at least 1 element 2 that will immediatly follow element 1.
For every element 2 there will be at least 1 element 3 that will immediately follow element 2.
So the following would be what I am trying to model.
E1
E2
E3
E3
E3
E2
E3
E2
E3
E3
The following would be incorrect and cause an error.
E1
E3
E2
E1
E2
E2
E3
E3
or
E2
E3
E1
Does this make sense?
Thanks,
Doug
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Doug,
That seems something like:
Best Regards,
George
That seems something like:
Code: Select all
<xs:sequence>
<xs:element name="E1"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="E2"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="E3"/>
</xs:sequence>
</xs:sequence>
</xs:sequence>
George
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