You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Maik Weber <ma...@gmx.de> on 2001/07/09 14:58:07 UTC

Entities with XMLSchema

Hello,

I have already asked and stydied the tutorial from www.xfront.com. It is
very good. But there was nothing about something to declare an "entity".
Ok, here is an example:
In a DTD you can declare
<!ENTITY text "text to insert">

In the instance document you can use &text; instead of writing "text to
insert". But how can i define something like this with a schema?
I don't think that you have to make a <!DOCTYPE ....> - definition on
each document you want to use the "entity".

greetings
maik

--
* Homepage: www.webis-world.de
* mailto        : maikweber@gmx.de
* ICQ           : #57313947



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entities with XMLSchema

Posted by "Roger L. Costello" <co...@mitre.org>.
Ian Roberts wrote:
> 
> I don't think this is what Maik is after.  Is it possible to declare
> entities within a schema (instead of in a DOCTYPE) for use in the instance
> document?  I believe the answer to this is no.  Entities are a DTD
> specific concept.

Ah, sorry for the misunderstanding.  I agree with Ian.  /Roger


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entities with XMLSchema

Posted by Jeff Rafter <je...@earthlink.net>.
> Is there really no way? I know that entities are a DTD-specific concept
but
> XMLSchema should replace DTDs, shouldn't?

Richard's reference is probably the best one in this case.  In general the
actual ENTITY construct is not supported in Schemas.

But I must argue against the notion that Schemas are intended to replace
DTDs.  The DTD will always be with us as near as I can tell.  DTD processing
precedes Schema processing each building alternate declaration infosets.

Some good discussion starts here:
http://lists.xml.org/archives/xml-dev/200012/msg00538.html

There are a couple more discussions that talk about this-- though they don't
all agree at the coverpages:
http://xml.coverpages.org/schemas.html

Good Luck,
Jeff Rafter
Defined Systems
http://www.defined.net
XML Development and Developer Web Hosting


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


RE: Entities with XMLSchema

Posted by Richard Cook <rp...@prismtechnologies.com>.
Part 0, Appendix C talks about this, using fixed attribute of <element



-----Original Message-----
From: Maik Weber [mailto:maikweber@gmx.de]
Sent: 09 July 2001 15:04
To: xerces-j-user@xml.apache.org
Subject: Re: Entities with XMLSchema

Hello Roger,

Ian is right. I don't want to use the entity in a schema. I want to define
it
there and use it in the document instance - just like you can define a DTD
with this kind
of entities and use it in all documents which are valid against that DTD.

Is there really no way? I know that entities are a DTD-specific concept but
XMLSchema should replace DTDs, shouldn't?

maik

Ian Roberts wrote:

> On Mon, 9 Jul 2001, Roger L. Costello wrote:
>
> > Hello Maik,
> >
> > Since an XML Schema is just an XML document, you can use entities in a
> > Schema the same fashion that you would use them in a plain XML
> > document.  For example:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE xsd:schema [
> > <!ENTITY str "xsd:string">
> > ]>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >             targetNamespace="http://www.test.org"
> >             xmlns="http://www.test.org"
> >             elementFormDefault="qualified">
>
> I don't think this is what Maik is after.  Is it possible to declare
> entities within a schema (instead of in a DOCTYPE) for use in the instance
> document?  I believe the answer to this is no.  Entities are a DTD
> specific concept.
>
> Ian
>
> --
> Ian Roberts, Software Engineer        DecisionSoft Ltd.
> Telephone: +44-1865-203192            http://www.decisionsoft.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

--
* Homepage: www.webis-world.de
* mailto        : maikweber@gmx.de
* ICQ           : #57313947



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entities with XMLSchema

Posted by Maik Weber <ma...@gmx.de>.
Hello Roger,

Ian is right. I don't want to use the entity in a schema. I want to define it
there and use it in the document instance - just like you can define a DTD
with this kind
of entities and use it in all documents which are valid against that DTD.

Is there really no way? I know that entities are a DTD-specific concept but
XMLSchema should replace DTDs, shouldn't?

maik

Ian Roberts wrote:

> On Mon, 9 Jul 2001, Roger L. Costello wrote:
>
> > Hello Maik,
> >
> > Since an XML Schema is just an XML document, you can use entities in a
> > Schema the same fashion that you would use them in a plain XML
> > document.  For example:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE xsd:schema [
> > <!ENTITY str "xsd:string">
> > ]>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >             targetNamespace="http://www.test.org"
> >             xmlns="http://www.test.org"
> >             elementFormDefault="qualified">
>
> I don't think this is what Maik is after.  Is it possible to declare
> entities within a schema (instead of in a DOCTYPE) for use in the instance
> document?  I believe the answer to this is no.  Entities are a DTD
> specific concept.
>
> Ian
>
> --
> Ian Roberts, Software Engineer        DecisionSoft Ltd.
> Telephone: +44-1865-203192            http://www.decisionsoft.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org

--
* Homepage: www.webis-world.de
* mailto        : maikweber@gmx.de
* ICQ           : #57313947



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entities with XMLSchema

Posted by Ian Roberts <ir...@decisionsoft.com>.
On Mon, 9 Jul 2001, Roger L. Costello wrote:

> Hello Maik,
> 
> Since an XML Schema is just an XML document, you can use entities in a
> Schema the same fashion that you would use them in a plain XML
> document.  For example:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE xsd:schema [ 
> <!ENTITY str "xsd:string">
> ]>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>             targetNamespace="http://www.test.org"
>             xmlns="http://www.test.org"
>             elementFormDefault="qualified">

I don't think this is what Maik is after.  Is it possible to declare
entities within a schema (instead of in a DOCTYPE) for use in the instance
document?  I believe the answer to this is no.  Entities are a DTD
specific concept.

Ian

-- 
Ian Roberts, Software Engineer        DecisionSoft Ltd.
Telephone: +44-1865-203192            http://www.decisionsoft.com




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Entities with XMLSchema

Posted by "Roger L. Costello" <co...@mitre.org>.
Hello Maik,

Since an XML Schema is just an XML document, you can use entities in a
Schema the same fashion that you would use them in a plain XML
document.  For example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsd:schema [ 
<!ENTITY str "xsd:string">
]>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.test.org"
            xmlns="http://www.test.org"
            elementFormDefault="qualified">

    <xsd:element name="test">
        <xsd:complexType>
            <xsd:choice>
                <xsd:element name="a" type="&str;"/>
                <xsd:element name="b" type="&str;"/>
            </xsd:choice>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>

Here I have created an entity, str.  Its replacement text is
xsd:string.  I used this entity in defining the type for element a, and
b.

/Roger


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org