472,958 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Xml schema: how to achieve <!ENTITY x "y">

I have an XML Schema with regular expressions.

e.g. <xsd:pattern value="[a-zA-Z]{1}[a-zA-Z0-9._=+-]*"/>

I have other patterns in the same schema document which share regular
expression substructure, like the string "[a-zA-Z0-9._=+-]"

I'd like to do something like:

<!ENTITY substring_pattern "[a-zA-Z0-9._=+-]">

And revise my xml schema to look like:

<xsd:pattern value="[a-zA-Z]{1}&substring_pattern;*"/>
I can't figure out how to generate a reusable literal that can be
embedded in attribute values within an XML schema document.

<!ENTITY> isn't valid xml in an XML schema, at least not as far as my
tests have shown in attempting to validate with a schema using such
declarations.
HELP!
Signed,
cut-and-pasting-for-now-but-tired-of-it
--
----------

Email from unknown persons will be blocked by spam filters.
Please post replies to the news conference. Thank you.

Jul 20 '05 #1
6 1895
In article <pjlbc.163534$Cb.1653348@attbi_s51>,
Phil Jarvis <ph************@sybase.com> wrote:
I can't figure out how to generate a reusable literal that can be
embedded in attribute values within an XML schema document.


Schemas don't provide an entity-like mechanism: they just do the
validation bit of DTDs. if you want an entity, put a DTD on your
schema and define one in the usual way.

-- Richard
Jul 20 '05 #2
I suspect that if I do what you suggest, presumably something like

<!DOCTYPE MySchema SYSTEM "MySchema.dtd">

for an XML schema document which otherwise looks like this:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
...

That both attempts to
(a) run it as input for schema validated xml content or
(b) run it as input for xml validation against the dted

would be a disaster. (I'd have to define the whole
XML Schema in the dtd, for starters, and XML Schema validators would
probably STILL choke on the <!DOCTYPE > statement).

DTD's and XML schema don't mix, I suspect, with the schema validation
tools I use. So I must be missing what you had in mind. Could you give
me an example?

(FYI: I'm just using Sun J2SE 1.4.2 tools)

Richard Tobin wrote:
In article <pjlbc.163534$Cb.1653348@attbi_s51>,
Phil Jarvis <ph************@sybase.com> wrote:

I can't figure out how to generate a reusable literal that can be
embedded in attribute values within an XML schema document.

Schemas don't provide an entity-like mechanism: they just do the
validation bit of DTDs. if you want an entity, put a DTD on your
schema and define one in the usual way.

-- Richard


--
----------

Email from unknown persons will be blocked by spam filters.
Please post replies to the new conference. Thank you.

Jul 20 '05 #3
see for example http://java.sun.com/dtd/jspxml.xsd
"View source" if you don't see the DOCTYPE etc.

with respect,
Toni Uusitalo
Jul 20 '05 #4
In article <teFbc.67340$JO3.39105@attbi_s04>,
Phil Jarvis <ph************@sybase.com> wrote:
I suspect that if I do what you suggest, presumably something like

<!DOCTYPE MySchema SYSTEM "MySchema.dtd">

for an XML schema document which otherwise looks like this:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
...

That both attempts to
(a) run it as input for schema validated xml content or
(b) run it as input for xml validation against the dted

would be a disaster. (I'd have to define the whole
XML Schema in the dtd, for starters, and XML Schema validators would
probably STILL choke on the <!DOCTYPE > statement).


There's a DTD for schemas at http://www.w3.org/2001/XMLSchema.dtd, but
you don't need to use a complete DTD, just an internal subset with the
entity you want. Of course if you validate it against an incomplete
DTD it will be invalid, but you don't have to DTD-validate just to use
an entity declaration.

XML Schemas are XML documents, so no Schema validator should "choke"
on a DOCTYPE statement. All XML processors are required to process
the internal subset, so if you put your entity declaration there it
should work.

-- Richard
Jul 20 '05 #5
Lots of good advice in these replies. I'll try it out.

Thanks!

Richard Tobin wrote:
In article <teFbc.67340$JO3.39105@attbi_s04>,
Phil Jarvis <ph************@sybase.com> wrote:
I suspect that if I do what you suggest, presumably something like

<!DOCTYPE MySchema SYSTEM "MySchema.dtd">

for an XML schema document which otherwise looks like this:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
...

That both attempts to
(a) run it as input for schema validated xml content or
(b) run it as input for xml validation against the dted

would be a disaster. (I'd have to define the whole
XML Schema in the dtd, for starters, and XML Schema validators would
probably STILL choke on the <!DOCTYPE > statement).

There's a DTD for schemas at http://www.w3.org/2001/XMLSchema.dtd, but
you don't need to use a complete DTD, just an internal subset with the
entity you want. Of course if you validate it against an incomplete
DTD it will be invalid, but you don't have to DTD-validate just to use
an entity declaration.

XML Schemas are XML documents, so no Schema validator should "choke"
on a DOCTYPE statement. All XML processors are required to process
the internal subset, so if you put your entity declaration there it
should work.

-- Richard


--
----------

Email from unknown persons will be blocked by spam filters.
Please post replies to the new conference. Thank you.

Jul 20 '05 #6
Just a followup, the answers (provided in replies) to my questions
worked just fine against schema validation tools and such when I tried them.

Thanks for your help.

--
----------

Email from unknown persons will be blocked by spam filters.
Please post replies to the new conference. Thank you.

Jul 20 '05 #7

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

Similar topics

2
by: Zombie | last post by:
Hi all, I wish to create a namespace other than the default one. Let's say, the Schema looks like: ----------------------------------------------------------------------- <?xml version="1.0"...
1
by: Lee Chapman | last post by:
Has anyone successfully been able to use an XmlValidatingReader (Framework 1.1) to validate documents against XML Schemas that haven't been added to the XmlValidatingReader.Schemas collection...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
2
by: Chuck Bowling | last post by:
AIML Schema: http://209.168.21.76/CommunityStarterKit/Downloads/258.aspx I have a Schema (in the link above) that I've been trying to make work in VS2003 for a while now and just can't seem to...
3
by: Kiran | last post by:
Hi, I want to back up my data in some table in SQL server and import it back using Bulk Load of SQL server 2K. I can use the following code to backup the data in XML ...
0
by: WideBoy | last post by:
Dear Group, I have recently started working with a large XML schema built to expose a domain specific data model in XML. I was wondering if any one has any ideas on how best to develop an XML...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
5
by: orabalu | last post by:
Hi Guys, Can you give me some examples for Incremental load in PL/SQL for Datawarehouse projects. Regards, Balu
3
by: Kai Schlamp | last post by:
Hello! In my schema I have the following: <xs:complexType name="textareaType"> <xs:simpleContent> <xs:restriction base="xs:string"> <xs:attribute ref="label" use="required" />...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.