[prev in list] [next in list] [prev in thread] [next in thread] 

List:       soap-user
Subject:    AW: XML Instance --> XML Schema ? (update)
From:       "Houman Moshtagh" <dev_wsdl () yahoo ! de>
Date:       2002-08-31 19:23:11
[Download RAW message or body]

Hi Ann,

Ok let's try an example; this is the best way to understand this. :)

- First the Schema:

<xsd:element name="student" type="personinfo"/>

<xsd:complexType name="personinfo">
  <xsd:sequence>
    <xsd:element name="name" type="xsd:string"/>
    <xsd:element name="age" type="xsd:positiveInteger"/>
    <xsd:element name="adress" type="USAdress"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="USAdress">
  <xsd:sequence>
    <xsd:element name="street" type="xsd:string"/>
    <xsd:element name="city" type="xsd:string"/>
  </xsd:sequence>
</xsd:complexType>


- And now the XML instance:

<student>
       <name>Houman</name>
       <age>27</age>
       <adress>
           <street>Street</street>
           <city>City</city>
       </adress>
</student>


That means if I don’t use the XMLSchemalocation there wouldn't be a way
to validate if my tags in the instance have the right data type.  E.g.
where should it know about the positive Integer of "age"?  Ok, but would
the XML instance still running as it should? Hmmmm on the other hand
there is no need for the XML Schema if the instance has already the
right data types (e.g. String) and the right restrictions (e.g. positive
integer).  So the XML instance could work even without validating
through the Schema, that’s why the schema is optional.  I think I get
the point now, isn't it? :)

How is about SOAP? Soap uses also the namespaces and xsi:schemalocation.
Can SOAP also validate a piece of XML tags in the body through a user
defined Schema? I can image this makes no sense about RPC-SOAP, since
the information provided in the body is just the return value of some
method.
But what's about the Document-Style-SOAP? An XML Schema could be useful
for an instance of XML provided in the body. What do you think?


Houman




-----Ursprüngliche Nachricht-----
Von: Anne Thomas Manes [mailto:anne@manes.net] 
Gesendet: Freitag, 30. August 2002 14:05
An: soap-user@xml.apache.org
Betreff: RE: XML Instance --> XML Schema ? (update)

If you want to validate the document using a schema, then you have to
tell
the validator where to find the schema. But you don't necessarily have
to
tell your validator the actual location of the schema from within the
document. You might provide the location using a switch or parameter
when
you launch the validator. (Perhaps you don't have access to the original
schema, or perhaps you want to validate it using a different schema.)

If you don't provide the schema location to the validator when you
launch
it, then the validator has to rely on the hints supplied within the
document -- which can be specified either in the namespace declaration
or in
the xsi:schemaLocation attribute.

Anne

> -----Original Message-----
> From: Houman Moshtagh [mailto:dev_wsdl@yahoo.de]
> Sent: Friday, August 30, 2002 7:41 AM
> To: soap-user@xml.apache.org
> Subject: XML Instance --> XML Schema ? (update)
> Importance: High
>
>
> Oopps. I ve made a mistake in my example.
>
> - The XML Schema: po1.xsd
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>         xmlns:po="http://www.example.com/PO1"
>         targetNamespace="http://www.example.com/PO1"
>
>
>
> - The XML Instance: po1.xml
>
> <?xml version="1.0"?>
> <apo:purchaseOrder xmlns:apo="http://www.example.com/PO1"
>
>
>
> I understand that the targetNamespace references to the customized XML
> Schema. But how can the parser looks after my customized XML Schema
> which is saved in the po1.xsd file?  How does it know where the XSD
file
> is located? As far as I understood the Namespaces, the URI of a
> Namespace is just there to mention a unique namespace.  The Parser
would
> not look after what's behind the URI.
>
> Maybe there is the need of using xsi:schemaLocation.  But there is no
> sign of this in the examples. Besides xsi:schemaLocation is also just
> there to give "hints" to the processor (validating).  It doesn't need
> them really for running.  So if it's optional so how can an instance
> find the customized Schema? This topic of XML is really weird. :)
>
>
> Could someone help me to understand this please? :o)
>
> Houman
>
>
> __________________________________________________________________
>
> Gesendet von Yahoo! Mail - http://mail.yahoo.de
> Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de
>
> --
> To unsubscribe, e-mail:
<mailto:soap-user-unsubscribe@xml.apache.org>
> For additional commands, e-mail:
<mailto:soap-user-help@xml.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:soap-user-unsubscribe@xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@xml.apache.org>

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Möchten Sie mit einem Gruß antworten? http://grusskarten.yahoo.de

--
To unsubscribe, e-mail:   <mailto:soap-user-unsubscribe@xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@xml.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic