[Xml-compile] adding xml:lang attribute
Petar Shangov
pshangov at yahoo.com
Fri Feb 27 16:18:36 GMT 2009
Hi,
I need to add the xml:lang attribute to an element, but I can't seem to figure out how to do it.
Here is what I have tried:
$schema->importDefinitions("path/to/xml.xsd");
$element->{'xml:lang'} = 'en';
# mistake: tag `xml:lang' not used
$schema->addKeyRewrite( pack_type('http://www.w3.org/XML/1998/namespace', 'lang') => 'xml_lang' );
$element->{'xml_lang'} = 'en';
# error: key rewrite `{http://www.w3.org/XML/1998/namespace}lang' not understood
$schema->addKeyRewrite( pack_type('xml', 'lang') => 'xml_lang' );
my $writer = $schema->compile( 'WRITER', $ns, prefixes => { 'http://www.w3.org/XML/1998/namespace' => 'xml' } );
$element->{'xml_lang'} = 'en';
# error: key rewrite `{xml}lang' not understood
Thanks!
Petar
More information about the Xml-compile
mailing list