permaculture playing cards*
The moose likes XML and Related Technologies and the fly likes xml:lang and XML Schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml:lang and XML Schema" Watch "xml:lang and XML Schema" New topic
Author

xml:lang and XML Schema

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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

Joined: Nov 22, 2008
Posts: 18944
... 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
YanNaing WTint
Ranch Hand

Joined: Oct 30, 2001
Posts: 40
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


Yan Naing Wynn Tint (SCJP2, SCWCD)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Yan Naing,
thanks you very much. Tried it, works great. Excellent!
Have a nice day
Berny
YanNaing WTint
Ranch Hand

Joined: Oct 30, 2001
Posts: 40
I'm glad that I could help...
Have a good one
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xml:lang and XML Schema