xsl-list
[Top] [All Lists]

Re: [xsl] Help please: question on xml's schema and xslt

2014-08-01 08:41:58


E-S4L

On Aug 1, 2014, at 9:12 AM, "Wolfgang Laun 
wolfgang(_dot_)laun(_at_)gmail(_dot_)com" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

On 01/08/2014, L2L 2L emanuelallen(_at_)hotmail(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
I have ask on many different forums; visionzone, sitepoint, oreilly, even
ask an author of a book, but receive no reply. I have even try
stackexchange. This doesn't make sense....

----question 2-------

Is this legal:

<?xml version="1.0" encoding="UTF-8"?> <xs:schema
xmlnss="http://www.w3.org/2001/XMLSchema";> <xs:annotation>
<xs:documentation> I'm warping a name simpleType name nameType in an element
that have the attribute type with the value of nameType. Is this legal; to
warp a name type as so: </xs:documentation> </xs:annotation> <xs:element
name="name" type="nameType"> <xs:simpleType name="nameType"> <xs:restriction
base="xs:string"> <xs:length value="25"/> </xs:restriction> </xs:simplyType>
</xs:element> </xs:schema>

(Indendation is the politeness of list users.)

No it is NOT - Element 'name' has both a 'type' attribute and a
'anonymous type' child. Only one of these is allowed for an element.

Use this;

   <xs:element name="name" type="nameType"/>
   <xs:simpleType name="nameType">
     <xs:restriction base="xs:string">
       <xs:length value="25"/>
     </xs:restriction>
   </xs:simpleType>

-----question 3--------

What are extension and restriction type?

Perhaps risk a short look on the XML Schema spec:
http://www.w3.org/TR/xmlschema11-1/

[Definition:]  A complex type definition which allows element or
attribute content in addition to that allowed by another specified
type definition is said to be an extension.

[Definition:]  A type defined with the same constraints as its ·base
type definition·, or with more, is said to be a restriction.  The
added constraints might include narrowed ranges or reduced
alternatives. Given two types A and B, if the definition of A is a
·restriction· of the definition of B, then members of type A are
always locally valid against type B as well.


----question 4---------

First question:

(Actually the 4th.)


Can I place an extension on a restriction type?

And if so, how? Via what method? Directly? Via reference? Both?

And if so for both, what other ways?

The excellent Primer on XML Schema http://www.w3.org/TR/xmlschema-0/
contains numerous examples for both.

Second question:

(Actually it's the 5th.)


targetNameSpace is to set a name space for the xml element in my schema? yes
or no then an explanation comment please.

This isn't well formulated. If you mean "for the XML elements defined
by <xs:element>" then the answer is: "yes, but not only for these,
also for <xs:complextType>, <xs:simpleType> and other Schema
components defined and named (!) in that XML schema.


a xmlnssi="uri" is to set the prefix for the xsi namespace and a
xsi:noNamespaceSchemaLocation="uri" is to set the location of my schema? yes
or no, then a feedback comment please.

You mean "xmlns:xsi=...".

a) No, it defines the prefix "xsi" for the namespace uniquely
identified by "uri".

b) Yes, but only if you associate the prefix xsi to this URI:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";


is the targetNameSapce needed... I find it non-necessary to do when it
can(by what I'm reading) define top level element and complex type(another
question is that by definning type level complex type, do that also mean
that type level complex when use in a element that is nested in another
element gain the namespace too?). I find it unnecessary to use
targetNameSapce when it doesn't cover all element being defined in the
schema.

No, you need not use targetNameSpace. You may run into difficulties if
you try use different XML schema definitions without target namespaces
but with conflicting definitions.

-W


informational feedback please anyone!



E-S4L


Where's the link button W? WHERE'S LIKE BUTTON W!!!!?????
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>