xsd - How to declare an xml:lang attribute in an XML Schema? -
i'm trying declare xml:lang
attribute in xml schema following sample instance:
<?xml version="1.0" encoding="utf-8"?> <database xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:nonamespaceschemalocation="xml-lang-1.xsd"> <entry> <language xml:lang="en"> <other_data/> </language> <language xml:lang="nl"> <other_data/> </language> </entry> </database>
for moment, got 2 solutions:
using:
<xs:attributegroup name="xmlnamespaceattrs"> <xs:anyattribute namespace="http://www.w3.org/xml/1998/namespace" processcontents="lax"/> </xs:attributegroup>
within same schema, or
using
xs:import
, importing:<xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified" targetnamespace="http://www.w3.org/xml/1998/namespace"> <xs:import schemalocation="xml-lang-2.xsd"/> <xs:attribute name="lang" type="xs:ncname"/> </xs:schema>
from external file.
my questions:
- are there other ways declare xml:lang attribute in xml schema?
- how can associate use attribute xml:lang attribute? in examples above, use attribute not allowed xs:anyattribute (solution 1) , xs:attribute (solution 2).
- is data type
xml:lang
in examples above handeled implicitelyxs:languag
e (or other) or needs be/can declared explicitely?
many in advance help.
i think in efficient way declare attribute in xml's namespace first option: first, declare attribute in different schema has xml's namespace target namespace, import
schema main schema , ref
attribute want use. way can use use
attribute along xml's schema attribute.
Comments
Post a Comment