louismc
Programmer
- Jun 19, 2008
- 1
I have a project which consist to put the result of a form isong tinymce (and other forms controls) into a xml file...
My xml file look like this:
Code :
I want the form users to be able to enter text formated a bit like in Word to let them use underscore, bold, links, etc... Tinymce return the result in HTML format...
So when I receive a service description (from the form), I want my xml file to be able to include HTML4.01 or XHTML1.0 tags into it's nodes.
ex:
In my schema file, I've used xs:anyType instead of xs:string and I'm asking myself if this is the right thing to do...
I absolutly want to use a schema file because my application is better adapted to it than DTD, even if I import DTD so I don't have to convert special characters like "ç" into "ç" ...
Here is my schema:
Code :
Thanks in advance!
My xml file look like this:
Code :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY % HTML401 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<!ENTITY % test PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
%test;
<!ELEMENT html (head, body)>
<!ENTITY % HTMLlat1 PUBLIC
"-//W3C//ENTITIES Latin 1 for XHTML//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">[/URL]
%HTMLlat1;
<!ENTITY % HTMLspecial PUBLIC
"-//W3C//ENTITIES Special for XHTML//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">[/URL]
%HTMLspecial;
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">[/URL]
%HTMLsymbol;
]>
<Catalogue xmlns:xhtml="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL] xsi:noNamespaceSchemaLocation="Services.xsd">
<Categories>
<NomCat>SERVICES</NomCat>
<TelContactCat>(000) 000-0000</TelContactCat>
<IndexCat id="C">S</IndexCat>
<DescriptionCat>Regroupe les services ayant trait au service à la clientèle</DescriptionCat>
<Services>
<NomSrv>Gestion de l'intègration des applications</NomSrv>
<IndexSrv id="G">G</IndexSrv>
<IndexSrv id="I">I</IndexSrv>
<IndexSrv id="A">A</IndexSrv>
<NomContactSrv>Someone</NomContactSrv>
<TelContactSrv>(000) 000-0000</TelContactSrv>
<DescriptionSrv>...</DescriptionSrv>
<Englobage>...</Englobage>
<Cible>...</Cible>
<Financement>...</Financement>
<Attentes>...</Attentes>
<Contribution>...</Contribution>
<acces>...</acces>
<SiteWebSrv>[URL unfurl="true"]http://</SiteWebSrv>[/URL]
</Services>
<Categories>
</Catalogue>
I want the form users to be able to enter text formated a bit like in Word to let them use underscore, bold, links, etc... Tinymce return the result in HTML format...
So when I receive a service description (from the form), I want my xml file to be able to include HTML4.01 or XHTML1.0 tags into it's nodes.
ex:
Code:
<DescriptionSrv>this is <b>one</b> exemple</DescriptionSrv>
In my schema file, I've used xs:anyType instead of xs:string and I'm asking myself if this is the right thing to do...
I absolutly want to use a schema file because my application is better adapted to it than DTD, even if I import DTD so I don't have to convert special characters like "ç" into "ç" ...
Here is my schema:
Code :
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] elementFormDefault="qualified">
<xs:import namespace="[URL unfurl="true"]http://www.w3.org/XML/1998/namespace"/>[/URL]
<xs:complexType name="Catalogue">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Categories"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Catalogue" type="Catalogue"/>
<xs:complexType name="Categories">
<xs:sequence>
<xs:element ref="NomCat"/>
<xs:element ref="ContactCat"/>
<xs:element ref="TelContactCat"/>
<xs:sequence maxOccurs="26">
<xs:element ref="IndexCat"/>
</xs:sequence>
<xs:element ref="DescriptionCat"/>
<xs:element ref="SiteWebCat" minOccurs="0"/>
<xs:element ref="Services" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Categories" type="Categories" nillable="false"/>
<xs:element name="NomCat" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ContactCat" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TelContactCat" type="phoneType" nillable="false"/>
<xs:element name="DescriptionCat" type="xs:anyType" nillable="false"/>
<xs:complexType name="IndexCat" mixed="true">
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="A"/>
<xs:enumeration value="B"/>
<xs:enumeration value="C"/>
<xs:enumeration value="D"/>
<xs:enumeration value="E"/>
<xs:enumeration value="F"/>
<xs:enumeration value="G"/>
<xs:enumeration value="H"/>
<xs:enumeration value="I"/>
<xs:enumeration value="J"/>
<xs:enumeration value="K"/>
<xs:enumeration value="L"/>
<xs:enumeration value="M"/>
<xs:enumeration value="N"/>
<xs:enumeration value="O"/>
<xs:enumeration value="P"/>
<xs:enumeration value="Q"/>
<xs:enumeration value="R"/>
<xs:enumeration value="S"/>
<xs:enumeration value="T"/>
<xs:enumeration value="U"/>
<xs:enumeration value="V"/>
<xs:enumeration value="W"/>
<xs:enumeration value="X"/>
<xs:enumeration value="Y"/>
<xs:enumeration value="Z"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="IndexCat" type="IndexCat" nillable="false"/>
<xs:element name="SiteWebCat" type="xs:anyURI" default="[URL unfurl="true"]http://"[/URL] nillable="false"/>
<xs:complexType name="Services">
<xs:sequence>
<xs:element ref="NomSrv"/>
<xs:sequence maxOccurs="26">
<xs:element ref="IndexSrv"/>
</xs:sequence>
<xs:element ref="NomContactSrv"/>
<xs:element ref="TelContactSrv"/>
<xs:element ref="DescriptionSrv"/>
<xs:element ref="Englobage"/>
<xs:element ref="Cible"/>
<xs:element ref="Financement"/>
<xs:element ref="Attentes"/>
<xs:element ref="Contribution"/>
<xs:element ref="acces"/>
<xs:element ref="SiteWebSrv" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Services" type="Services" nillable="false"/>
<xs:element name="NomSrv" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="255"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DescriptionSrv" type="xs:anyType" nillable="false"/>
<xs:complexType name="IndexSrv" mixed="true">
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="A"/>
<xs:enumeration value="B"/>
<xs:enumeration value="C"/>
<xs:enumeration value="D"/>
<xs:enumeration value="E"/>
<xs:enumeration value="F"/>
<xs:enumeration value="G"/>
<xs:enumeration value="H"/>
<xs:enumeration value="I"/>
<xs:enumeration value="J"/>
<xs:enumeration value="K"/>
<xs:enumeration value="L"/>
<xs:enumeration value="M"/>
<xs:enumeration value="N"/>
<xs:enumeration value="O"/>
<xs:enumeration value="P"/>
<xs:enumeration value="Q"/>
<xs:enumeration value="R"/>
<xs:enumeration value="S"/>
<xs:enumeration value="T"/>
<xs:enumeration value="U"/>
<xs:enumeration value="V"/>
<xs:enumeration value="W"/>
<xs:enumeration value="X"/>
<xs:enumeration value="Y"/>
<xs:enumeration value="Z"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="IndexSrv" type="IndexSrv" nillable="false"/>
<xs:element name="NomContactSrv" nillable="false">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="TelContactSrv" type="phoneType" nillable="false"/>
<xs:element name="SiteWebSrv" type="xs:anyURI" default="[URL unfurl="true"]http://"[/URL] nillable="false"/>
<xs:element name="acces" type="xs:anyType" nillable="false"/>
<xs:element name="Financement" type="xs:anyType" nillable="false"/>
<xs:element name="Englobage" type="xs:anyType" nillable="false"/>
<xs:element name="Contribution" type="xs:anyType" nillable="false"/>
<xs:element name="Cible" type="xs:anyType" nillable="false"/>
<xs:element name="Attentes" type="xs:anyType" nillable="false"/>
<xs:simpleType name="phoneType">
<xs:restriction base="xs:string">
<xs:pattern value="\([0-9]{3}\) [0-9]{3}-[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
Thanks in advance!