alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (xenc-schema.rng)

This example Java source code file (xenc-schema.rng) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

agreementmethodtype, algorithm, cipherdatatype, digestmethodtype, encrypteddatatype, encryptedkeytype, encryptedtype, encryptionmethodtype, encryptionpropertiestype, keyinfotype, referencelisttype, uri

The xenc-schema.rng Java example source code

<?xml version="1.0" encoding="UTF-8"?>
<!-- http://www.xml.com/lpt/a/2002/01/23/relaxng.html -->
<!-- http://www.oasis-open.org/committees/relax-ng/tutorial-20011203.html -->
<!-- http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_wildcards_st8.html -->
<!-- http://lists.oasis-open.org/archives/relax-ng-comment/200206/maillist.html -->

<grammar xmlns='http://relaxng.org/ns/structure/1.0'
        xmlns:ds='http://www.w3.org/2000/09/xmldsig#'
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        ns="http://www.w3.org/2001/04/xmlenc#"
        datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

    <include href="http://www.w3.org/Signature/Drafts/xmldsig-core/xmldsig-core-schema.rng">
    <!-- Used for DigestMethod, KeyInfoType and anyThing -->
    <!-- Since xmldsig-core also has a start, I have to include it
        in the include for redefinition. -->
        <start>
            <choice>
                <!-- We get to define the permissible root elements! -->
                <element name="EncryptedData">
                <element name="EncryptedKey">
            </choice>
        </start>   
        
        <define name='anyThing'>
            <zeroOrMore>
                <choice>
                    <text/>
                    <element>
                        <anyName>
                            <except>
                                <nsName/>
                                <nsName ns='http://www.w3.org/2000/09/xmldsig#'/>
                            </except>
                        </anyName>
                        <ref name='anyThing'/>
                        <zeroOrMore>
                            <attribute>
                              <anyName/>
                            </attribute>
                        </zeroOrMore>
                    </element>
                </choice>
            </zeroOrMore>
            </define>
        
        
    </include>
    
        <!-- Import definitions from the xmldsig rng -->

        <define name="KeyInfoType" combine="interleave">
            <zeroOrMore>
                <choice>
                    <element name="EncryptedKey">
                    <element name="AgreementMethod">
                </choice>
            </zeroOrMore>    
        </define>

        <define name="DigestMethodType" combine="choice">
            <notAllowed/>
         </define>

        <define name="TransformType" combine="choice">
            <notAllowed/>
         </define>

    <!-- Now redefined in the include statement
        <define name="anyThing" combine="choice">
            <notAllowed/>
         </define>
    -->

    <!-- End import -->
        
  
    <define name="EncryptedDataType">
          <ref name="EncryptedType"/>
    </define>
  
  
    <define name="EncryptedKeyType">
            <ref name="EncryptedType"/>
            <optional>
                <ref name="ReferenceListType"/>
            </optional>
            <optional>
            <optional> 
    </define>

    
     <define name="EncryptedType">
        <element name="EncryptionMethod">
        <optional>
            <element name="KeyInfo" ns="http://www.w3.org/2000/09/xmldsig#">
                <ref name="KeyInfoType"/>
            </element>
        </optional>
        <optional>
            <element name="CipherData">
        </optional> 
        <optional>
             <element name="EncryptionProperties">
        </optional>
        <optional>
        <optional>
        <optional>
        <optional>
        <optional>
    </define> 

    <define name="EncryptionMethodType">
        <zeroOrMore>
            <choice>
                <element name="KeySize">
                    <data type="integer"/>
                </element>
                <element name="OAEPparams">
                    <data type="base64Binary"/>
                </element>
                <text/>
                <element name='DigestMethod' ns="http://www.w3.org/2000/09/xmldsig#">
                    <ref name="DigestMethodType"/>
                </element>
            </choice>
        </zeroOrMore>
        <attribute name="Algorithm">
    </define>

            
    <define name="AgreementMethodType">
        <zeroOrMore>
            <choice>
                <element name="KA-Nonce">
                    <data type="base64Binary"/>
                </element>
                <element name='DigestMethod' ns="http://www.w3.org/2000/09/xmldsig#">
                    <ref name="DigestMethodType"/>
                </element>
                <text/>
                <element>
                    <nsName ns="http://www.w3.org/2000/09/xmldsig#"/>
                    <ref name="anyThing"/>
                </element>
                <element name="OriginatorKeyInfo">
                <element name="RecipientKeyInfo">
            </choice>
        </zeroOrMore>
        <attribute name="Algorithm">
    </define>            
            
            
    <define name="ReferenceListType">
        <oneOrMore>
            <choice>
                <element name="DataReference">
                    <text/>
                    <attribute name="URI">
                </element>
                <element name="KeyReference">
                    <text/>
                    <attribute name="URI">
                </element>
            </choice>
        </oneOrMore>
    </define>
    
    
    <define name="CipherDataType">
        <choice>
            <element name="CipherValue">
            <element name="CipherReference">
                <element name="Transforms">
                  <oneOrMore>
                      <element name='Transform' ns="http://www.w3.org/2000/09/xmldsig#">
                          <ref name='TransformType'/>
                        </element>
                    </oneOrMore>
                </element>
                <attribute name="URI">
                    <data type="anyURI"/>
                </attribute>      
            </element>
        </choice>
    </define>
    
    
    <define name="EncryptionPropertiesType">        
        <element name="EncryptionProperty">
          <zeroOrMore>
                <element>
                    <anyName/>
                    <text/>
                </element>
            </zeroOrMore>
            <optional>
                <attribute name="Target">
                    <data type="anyURI"/>
                </attribute>  
            </optional>
            <optional>                
                <attribute name="Id">
                    <data type="ID"/>
                </attribute>    
            </optional>
        </element>
        
        <optional>
            <attribute name="Id">
                <data type="ID"/>
            </attribute>    
        </optional>
        <zeroOrMore>
            <attribute>
        </zeroOrMore>
    </define>

</grammar>

Other Java examples (source code examples)

Here is a short list of links related to this Java xenc-schema.rng source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.