Click here to Skip to main content
15,890,579 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralSorting parent child releationships Pin
Member 11446175-Dec-04 5:34
Member 11446175-Dec-04 5:34 
GeneralRe: Sorting parent child releationships Pin
DavidNohejl5-Dec-04 5:56
DavidNohejl5-Dec-04 5:56 
GeneralRe: Sorting parent child releationships Pin
Member 11446175-Dec-04 6:05
Member 11446175-Dec-04 6:05 
GeneralRe: Sorting parent child releationships Pin
DavidNohejl5-Dec-04 6:31
DavidNohejl5-Dec-04 6:31 
GeneralXML to Ecxel Pin
Marwa Bahaa5-Dec-04 4:13
Marwa Bahaa5-Dec-04 4:13 
Generaluse HTML tags in XML Pin
visitsaadi3-Dec-04 22:54
visitsaadi3-Dec-04 22:54 
GeneralXML structure - help Pin
john john mackey3-Dec-04 10:37
john john mackey3-Dec-04 10:37 
GeneralRe: XML structure - help Pin
Stuart Dootson3-Dec-04 22:35
professionalStuart Dootson3-Dec-04 22:35 
[EDIT]The indenting only comes out right in IE - not in Firefox[/EDIT]

You've got a *lot* of freedom with XML. You could do this:

<cars>
  <car>
    <make>Ford</make>
    <model>Mustang</model>
    <color R="255" G="0" B="0"/>
    <interior>
      <color R="0" G="0" B="0"/>
      <material>leather</material>
    </interior>
  </car>
  <!-- and do something similar for the VW -->
</cars>


There is no concept of data typing built into XML as it is into C/C++/Java. If you use some form of schema (XML Schemas or DTDs or RelaxNG, for example), you can apply data typing to XML and (with a suitably capable XML processor) validate the XML file against the schema.

For example (and it's quite a big one), here's an XML schema I knocked up in XMLSpy[^] (theres a free download). I've not encoded all your enums and things, but it gives you an idea of what's needed.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:element name="cars">
      <xs:annotation>
         <xs:documentation>Comment describing your root element</xs:documentation>
      </xs:annotation>
      <xs:complexType>
         <xs:sequence maxOccurs="unbounded">
            <xs:element name="car">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="make" type="MakeType"/>
                     <xs:element name="model"/>
                     <xs:element name="color" type="ColorType"/>
                     <xs:element name="interior">
                        <xs:complexType>
                           <xs:sequence>
                              <xs:element name="color" type="ColorType"/>
                              <xs:element name="material"/>
                           </xs:sequence>
                        </xs:complexType>
                     </xs:element>
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
   <xs:simpleType name="MakeType">
      <xs:restriction base="xs:string">
         <xs:enumeration value="Chevy"/>
         <xs:enumeration value="Ford"/>
         <xs:enumeration value="Oldsmobile"/>
         <xs:enumeration value="VW"/>
      </xs:restriction>
   </xs:simpleType>
   <xs:complexType name="ColorType">
      <xs:attribute name="R" type="xs:unsignedByte" use="required"/>
      <xs:attribute name="G" type="xs:unsignedByte" use="required"/>
      <xs:attribute name="B" type="xs:unsignedByte" use="required"/>
   </xs:complexType>
</xs:schema>


Stuart Dootson

'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
GeneralRe: XML structure - help Pin
john john mackey4-Dec-04 3:52
john john mackey4-Dec-04 3:52 
GeneralUnwanted junk... Pin
CherezZaboro3-Dec-04 8:45
CherezZaboro3-Dec-04 8:45 
GeneralRe: Unwanted junk... Pin
Stuart Dootson3-Dec-04 22:13
professionalStuart Dootson3-Dec-04 22:13 
GeneralUnwanted junk... Pin
CherezZaboro3-Dec-04 8:40
CherezZaboro3-Dec-04 8:40 
GeneralBuilding a 'skeletal' DOM based upon a schema Pin
Jnewg52-Dec-04 10:09
Jnewg52-Dec-04 10:09 
GeneralRe: Building a 'skeletal' DOM based upon a schema Pin
Stuart Dootson2-Dec-04 11:12
professionalStuart Dootson2-Dec-04 11:12 
Generalxml &amp; xsd question Pin
Shahin772-Dec-04 4:52
Shahin772-Dec-04 4:52 
Questionhow to get it? xml &amp; xsd Pin
Shahin772-Dec-04 4:49
Shahin772-Dec-04 4:49 
GeneralStreaming namespace replacing Pin
Member 15128341-Dec-04 23:41
Member 15128341-Dec-04 23:41 
GeneralXML template from xsd document Pin
Anonymous1-Dec-04 21:50
Anonymous1-Dec-04 21:50 
GeneralRe: XML template from xsd document Pin
Stuart Dootson2-Dec-04 1:07
professionalStuart Dootson2-Dec-04 1:07 
QuestionIs this legal, barely? Pin
john john mackey30-Nov-04 14:07
john john mackey30-Nov-04 14:07 
AnswerRe: Is this legal, barely? Pin
Christian Graus30-Nov-04 14:39
protectorChristian Graus30-Nov-04 14:39 
AnswerRe: Is this legal, barely? Pin
Michael A. Barnhart7-Dec-04 11:46
Michael A. Barnhart7-Dec-04 11:46 
AnswerRe: retrive the XML Data? Pin
DavidNohejl30-Nov-04 2:03
DavidNohejl30-Nov-04 2:03 
Questionretrive the XML Data? Pin
sudheerreddy30-Nov-04 1:51
sudheerreddy30-Nov-04 1:51 
GeneralTree View with text as nodes..help please Pin
help_cplus25-Nov-04 0:22
help_cplus25-Nov-04 0:22 

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.