• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

xml:lang and XML Schema

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I do have a xml file using the xml:lang attribute:
<Text>
<Para xml:lang="en">this is some text</Para>
</Text>
The DTD for this file contained the following, which validates my XML file correctly:
<!ELEMENT Text (Para+) >
<!ELEMENT Para (#PCDATA) >
<!ATTLIST Para xml:lang (en | de | ko) >
Now I want to change my DTD in a XML Schema:
...
<xsd:complexType name="ParaType" mixed="true">
<xsd:attribute name="xml:lang" default="en">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="en"/>
<xsd:enumeration value="de"/>
<xsd:enumeration value="ko"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
... oops, that was sent too fast... here part 2:
My xsv validator tells me that the Schema file is all right. But I do get an error message if I include the xsd in my xml file:
'unexpected attribute xml:lang in <Para> (the Tag wherein I use the ParaType)
- Is my approach converting xml:lang from DTD to XML Schema wrong?
- Where can I find some resources about how to use xml:lang in conjunction with XML Schema?
- Should I omit the xml:lang in my XML file and rather use a common attribute...
Thanks for a little help...
Bye
Berny
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Berny,
follow the link, http://www.xfront.com/xml-schema.html and download the tutorial, unzip it.
Check the slide no. 80 of xml-schemas2.ppt under the .....\xml-schemas\xml-course\xml-schemas directory. I hope it'll give you a little help.
Bye
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yan Naing,
thanks you very much. Tried it, works great. Excellent!
Have a nice day
Berny
 
YanNaing WTint
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad that I could help...
Have a good one
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic