473,890 Members | 1,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSD: ways of restricting xml to non-empty tags?

Hi,

I'd like to know if there are any more ways of restricting an XML
document to having only non-empty tags (containing Strings).

I can think of 2 ways:

1)

<xs:simpleTyp e name="tagName">
<xs:restricti on base="xs:string ">
<xs:pattern value="([a-zA-Z0-9])+"/>
</xs:restriction>
</xs:simpleType>

2)

<xs:simpleTyp e name="tagName">
<xs:restricti on base="xs:string ">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

But approach #2 would allow the user to get away with spaces between
the tags.

Are there any other ways of doing this?

Thanks
Rohit.

Dec 21 '05 #1
1 2180
Piper707 writes:
<xs:simpleTyp e name="tagName">
<xs:restricti on base="xs:string ">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>

But [this] approach would allow the user to get away with spaces between
the tags.


use base="xs:token" instead, which implies aggressive whiteSpace
normalization.

ht
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Dec 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2322
by: Shock | last post by:
Hey all, I am currently researching ways to compare databases via an XSD schema. I wrote a small app that creates a dataset from a database and exports that dataset to XSD. This gives me an XSD file with tables and relationships representing the entire database. At this point, I am trying to find ways to compare these schemas. Does anybody know of a way to do this easily and to record differences if there are any?
3
2876
by: Matthet | last post by:
Hi, Is there any difference if I write sth like this: <xsd:simpleType name="Name"> <xsd:restriction base="xsd:string"> <xsd:minLength value="1"> <xsd:maxLength value="10"> </xsd:restriction> </xsd:simpleType>
1
3952
by: Roland | last post by:
hi all having designed my schema to use repeating groups of elements, I found that some applications (eg. Microsoft InfoPath) refused to recognised that element as a repeating element. I subsequently found that out of the three possible ways (that I know of) of declaring repeating elements in xsd, only one of these was understood:
1
1444
by: Brett Gerhardi | last post by:
Can anyone explain how I can do the following correctly: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="e"/> <xs:complexType name="ct1"> <xs:choice> <xs:any namespace="##any"/> </xs:choice>
2
3669
by: Martijn | last post by:
Because XSD (XML Schema Document) is a definition of the XML document, there must be a parser that can read a XSD file and give the complete XML file as a result. Is there something like this, or do I have to create it by my own??
2
3391
by: yaya9 | last post by:
pls help me! I have a nested xml: <?xml version="1.0" encoding="utf-8" ?> <root> <myType> <FName /> <pop /> </myType> </root>
3
9424
by: Pascal Brunot | last post by:
Hi, That's my first post here so I hope this is the right group to post to. I have to design a good strategy to manipulate XML data in VB.net language. Here's the business case: - I will have a large number (200+) of XML forms created with Infopath that represents industrial machines specifications. Infopath makes a XSD available for each form template.
1
1764
by: Clodo | last post by:
I need to create a PHP page that use an XSL file for transforming a generic XSD in their XHTML with inputbox,select etc.., for allow users to insert data in a user-friendly html-based editor, and on 'submit' the PHP page (server-side) can reconstruct the XML file and validate with the original XSD file, like this project: http://www.codeproject.com/dotnet/xmldataeditor.asp I need to create also some javascript code or postback to php...
6
4287
by: burkley | last post by:
In XML Schema, is it possible to derive a complex type via restriction and have the new derived type be in a different namespace than the original base type? I've banged on this for 2 days now and I'm starting to think the answer is no. I've searched this group and have not seen anything discussing this. the base type. All values of the restricted type are also valid according to the base type".
0
3183
by: liuhengyi | last post by:
Hi, I also have a question when using VS 2008 to edit the xml file. In my xml file, I used schemaLocation attribute to specify the xsd. If I put the xsd in our internal sharepoint site such as: xsi:schemaLocation="someNs http://sharepoint/Test.xsd" VS2008 xml editor shows that "this schema referenced from this location in your document contains errors". However if I copy the xsd to the local folder, and use this:
0
9820
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10462
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9630
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4676
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4270
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.