473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

xml-schema question

3
Hi
I´m having trouble with my xml schema.

My problem is that I want the element "PREMIE" to be able to occur several times. The other elements has to be independent of order. The element names are in swedish but that shouldn´t be a problem.
Here is the .xsd-file:

<xs:element name="BIL">
<xs:complexType>
<xs:all>
<xs:element name="TRAFIKBONUS" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="BILMERKESKOD" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="6" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<!-- ref -->
<xs:element ref="PREMIE" />
<xs:element ref="RABATT" />
</xs:all>
</xs:complexType>
</xs:element>

I really need this to work.
Thanks!
Aug 9 '07 #1
4 1264
jkmyoung
2,057 Expert 2GB
Can you change you <xs:all> to a <xs:sequence> instead?

Then you can have a nested sequence
Expand|Select|Wrap|Line Numbers
  1. <xs:sequence>
  2.    ...
  3.    <xs:sequence>
  4.        <xs:element ref="PREMIE" maxOccurs="unbounded"/>
  5.    </xs:sequence>
  6.    <xs:element ref="RABATT" />
  7. </xs:sequence>
  8.  
inside this sequence.
Aug 9 '07 #2
rudie
3
Thanks for your reply. If I do like you say the order of the elements befor the "nested sequence" will matter. That is the whole problem.
I´d be happy for more input.
Aug 10 '07 #3
jkmyoung
2,057 Expert 2GB
I was afraid you were asking for that:
http://www.thescripts.com/forum/thread88016.html

Really, the problem is that this is easier to express as a context free grammar, instead of a regular expression. The regular expression that describes your structure is ugly.
eg, renaming the elements a, b, c, d the regular expression might look something like:
c*dc*( (ac*)?(bc*)? | bc*ac*) |
c*ac*bc*dc* |
c*bc*ac*dc* |
c*ac*dc*(bc*)? |
c*bc*dc*(ac*)?

If you really want to enforce this criteria, you might be better off switching to RELAX NG, or schematron, or some other tool.
Aug 10 '07 #4
rudie
3
Ok thanx.
I guess there´s no easy way then.
Aug 13 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Robert J Egan | last post by:
Hi i'm trying to search a remote website page. The form returns xml information, though the page extension is missing. I retrieve the information and write it to the screen. So far so good -...
0
by: MarionEll | last post by:
Premier XML Industry Event Slated for Dec. 7-12 in Philadelphia; Presenters Include Adobe, BEA, Microsoft, IBM, Sun, Hewlett-Packard, Oracle Alexandria, Va. Sept. 30, 2003 - IDEAlliance, a...
0
by: MarionEll | last post by:
XML 2003 Exposition Draws Leading XML Vendors Trade Show, Presentations Allow Companies to Showcase Cutting-edge Solutions Alexandria, Va. - Dec. 1, 2003 - XML 2003, the world's largest XML...
0
by: Steve Whitlatch | last post by:
It may be me, or it may be the Linux implementation of XML Catalogs on slackware. Whichever, please shed some light on this XML Catalog problem. When using the --catalogs option, xmllint resolves...
0
by: melledge | last post by:
The Reliable Source for Everything XML - XML 2005 Update XML 2005 - November 14-18 - Atlanta Hilton Hotel - Atlanta, GA www.xmlconference.org Register today and participate in IDEAlliance's...
1
by: Srini | last post by:
I have written two simple webservice functions and trying to consume them through a client piece. Both the webservice functions have similar signature....
0
by: MarionEll | last post by:
Premier XML Industry Event Slated for Dec. 7-12 in Philadelphia; Presenters Include Adobe, BEA, Microsoft, IBM, Sun, Hewlett-Packard, Oracle Alexandria, Va. Sept. 30, 2003 - IDEAlliance, a...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
0
by: jts2077 | last post by:
I am trying to create a large nested XML object using E4X methods. The problem is the, the XML I am trying to create can only have xmlns set at the top 2 element levels. Such as: <store ...
10
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I had a program and it always works fine and suddenly it gives me the following message when a pass a xml file to our server program: error code: -1072896680 reason: XML document must...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.