[Xml-compile] substitutionGroup

Mark Hofstetter mark.hofstetter at univie.ac.at
Tue Jun 25 10:53:29 GMT 2013


Hi All, Hi Mark!

I have a question regarding substitutionGroups
schemas used may be found at

http://tools.ietf.org/html/draft-arias-noguchi-dnrd-objects-mapping-03
http://tools.ietf.org/html/draft-arias-noguchi-registry-data-escrow-06

from
urn:ietf:params:xml:ns:rdeContact-1.0

...
   <element name="abstractContact" type="rdeContact:abstractContentType"
      substitutionGroup="rde:content" abstract="true"/>
    <element name="contact"
      substitutionGroup="rdeContact:abstractContact"/>
    <element name="delete" type="rdeContact:deleteType"
      substitutionGroup="rde:delete"/>

    <!-- Contact Type -->
    <complexType name="abstractContentType">
      <complexContent>
        <extension base="rde:contentType">
          <sequence>

...


(which I believe is not a good idea, but anyway)

I am not able to use

{urn:ietf:params:xml:ns:rdeContact-1.0}contact

because this turns out to be of type
# is a xs:anyType
"anything"

so I have to use

{urn:ietf:params:xml:ns:rdeContact-1.0}abstractContact'

which is a mess, see script below

So my question is, is this
1. my fault
2. or is the scheme "wrong" ie you shouldn't do this with substituionGroups

cheers & thx in advance
Mark




===

use strict;
use warnings;

use XML::Compile::Schema;
use XML::Compile::Cache;
use File::Find;

my $rde_xsd_dir = 'rde-xsd';
my $epp_xsd_dir = 'epp-xsd';

my $xsd = [];
find(\&get_xsd, ($rde_xsd_dir, $epp_xsd_dir));

sub get_xsd {
   if ($_ =~ /xsd$/) {
       push ($xsd, $File::Find::name);
     }
}

my $cache = XML::Compile::Cache->new($xsd);

my $rde_contact_content_ns = 
'{urn:ietf:params:xml:ns:rdeContact-1.0}abstractContact';
my $rde_frame_ns   = '{urn:ietf:params:xml:ns:rde-1.0}deposit';
my $prefixes = {
'urn:ietf:params:xml:ns:rdeContact-1.0'     => 'rdeContact',
'urn:ietf:params:xml:ns:rde-1.0'            => 'rde',
'urn:ietf:params:xml:ns:rdeDomain-1.0'      => 'rdeDomain',
'urn:ietf:params:xml:ns:rdeIDN-1.0'         => 'rdeIDN',
'urn:ietf:params:xml:ns:rdeRegistrar-1.0'   => 'rdeRegistrar',
'urn:ietf:params:xml:ns:rdeHost-1.0'        => 'rdeHost',
'urn:ietf:params:xml:ns:rdeEppParams-1.0'   => 'rdeEppParams',
                  };

$cache->declare(WRITER => [$rde_frame_ns, $rde_contact_content_ns ],
        (
         abstract_types => 'ACCEPT',
         prefixes => $prefixes,
         use_default_namespace => 1,
         include_namespaces => 1,
         )
       );

$cache->compileAll();

my $doc = XML::LibXML::Document->new('1.0', 'UTF-8');

$doc->setStandalone(0);
...




-- 
Mag. Mark Hofstetter
Zentraler Informatikdienst der Universität Wien
phone: +43 1 4277 14275  FAX: +43 1 4277 14279
mobil: +43 676 7345660




More information about the Xml-compile mailing list