Click here to Skip to main content
15,921,351 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Copy XML string into a node Pin
Paul Watson18-Sep-02 8:06
sitebuilderPaul Watson18-Sep-02 8:06 
GeneralRe: Copy XML string into a node Pin
Sascha18-Sep-02 8:57
Sascha18-Sep-02 8:57 
GeneralRe: Copy XML string into a node Pin
Anders Munk18-Sep-02 9:12
Anders Munk18-Sep-02 9:12 
GeneralXML validation Pin
Hans Ruck18-Sep-02 6:29
Hans Ruck18-Sep-02 6:29 
GeneralRe: XML validation Pin
Erik Westermann19-Sep-02 3:46
professionalErik Westermann19-Sep-02 3:46 
GeneralRe: XML validation Pin
Hans Ruck19-Sep-02 21:13
Hans Ruck19-Sep-02 21:13 
GeneralXML Schema and circular references Pin
Senkwe Chanda18-Sep-02 2:13
Senkwe Chanda18-Sep-02 2:13 
GeneralRe: XML Schema and circular references Pin
Erik Westermann18-Sep-02 3:22
professionalErik Westermann18-Sep-02 3:22 
Senkwe Chanda wrote:
how do I represent this in an XML Schema?

...like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="CarEngineComponent">
    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="CarEngineComponent"/>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>


Although technically allowed, having a structure like this undermines one of the the benefits that an XSD (XML Schema) provides, namely, strong types. What this schema essentially says is that a CarEngineComponent is a mixed type element that can contain a value and another element. Although there's noting wrong with that from a purely structural point of view, most XML documents don't use that structure prefering instead ot have elements that contain data or other elements.

A bettter structure could be to have <CarEngineComponents> (note the plural form of the word) that contain one or more <CarEngineComponent> types. The naming convention makes it clear that <CarEngineComponents> is a container for something else.

Erik Westermann
Author, Learn XML In A Weekend (October 2002)
GeneralRe: XML Schema and circular references Pin
Senkwe Chanda18-Sep-02 4:44
Senkwe Chanda18-Sep-02 4:44 
GeneralBegginer XML question. Pin
Chagit17-Sep-02 3:13
Chagit17-Sep-02 3:13 
GeneralRe: Begginer XML question. Pin
Christian Graus17-Sep-02 12:45
protectorChristian Graus17-Sep-02 12:45 
GeneralRe: Begginer XML question. Pin
Paul Watson17-Sep-02 21:47
sitebuilderPaul Watson17-Sep-02 21:47 
GeneralSOAP ... Pin
Kain16-Sep-02 12:03
Kain16-Sep-02 12:03 
GeneralA parent or not a parent, that is the question... Pin
Nood!e16-Sep-02 9:52
Nood!e16-Sep-02 9:52 
GeneralRe: A parent or not a parent, that is the question... Pin
Christian Graus17-Sep-02 12:46
protectorChristian Graus17-Sep-02 12:46 
GeneralRe: A parent or not a parent, that is the question... Pin
Nood!e17-Sep-02 21:19
Nood!e17-Sep-02 21:19 
QuestionXSD ??? Pin
Christian Graus9-Sep-02 14:12
protectorChristian Graus9-Sep-02 14:12 
AnswerRe: XSD ??? Pin
Michael A. Barnhart9-Sep-02 15:24
Michael A. Barnhart9-Sep-02 15:24 
GeneralRe: XSD ??? Pin
Christian Graus9-Sep-02 15:31
protectorChristian Graus9-Sep-02 15:31 
GeneralRe: XSD ??? Pin
Michael A. Barnhart9-Sep-02 15:57
Michael A. Barnhart9-Sep-02 15:57 
GeneralRe: XSD ??? Pin
Christian Graus9-Sep-02 16:10
protectorChristian Graus9-Sep-02 16:10 
GeneralRe: XSD ??? Pin
Michael A. Barnhart9-Sep-02 16:26
Michael A. Barnhart9-Sep-02 16:26 
GeneralRe: XSD ??? Pin
Christian Graus9-Sep-02 16:30
protectorChristian Graus9-Sep-02 16:30 
GeneralRe: XSD ??? Pin
Michael A. Barnhart9-Sep-02 16:35
Michael A. Barnhart9-Sep-02 16:35 
GeneralRe: XSD ??? Pin
Paul Watson11-Sep-02 8:11
sitebuilderPaul Watson11-Sep-02 8:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.