Examples



examples/person


examples/person/person.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >

  <xs:complexType name="personName">
    <xs:sequence>
      <xs:element name="title" type="xs:string" minOccurs="0"/>
      <xs:element name="forename" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="surname" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="simpleName">
    <xs:complexContent>
      <xs:restriction base="personName">
        <xs:sequence>
          <xs:element name="forename" type="xs:string" minOccurs="1" maxOccurs="1"/>
          <xs:element name="surname" type="xs:string"/>
        </xs:sequence>
      </xs:restriction>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="who" type="simpleName"/>

<!--
   <who>
    <forename>Bill</forename>
    <surname>Clinton</surname>
   </who>
-->

</xs:schema>


examples/person/valid.xml

<?xml version="1.0"?>
<who>
  <forename>Bill</forename>
  <surname>Clinton</surname>
</who>


examples/person/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{
  xsdDoc->element_who()->set_forename("Bill");
  xsdDoc->element_who()->set_surname("Clinton");
}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/chineseDoc_utf8


examples/chineseDoc_utf8/chineseDoc_utf8.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
  <xsd:element name="test" type="TestType"/>

  <xsd:complexType name="TestType">
    <xsd:sequence>
      <xsd:element name="name" type="NameType"/>
      <xsd:element name="data" type="DataType" maxOccurs="15"/>
    </xsd:sequence>
    <xsd:attribute name="type" type="xsd:string" use="required"/>
  </xsd:complexType>

  <xsd:complexType name="NameType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="id" type="xsd:string" use="required"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:complexType name="DataType">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
        <xsd:attribute name="char" type="xsd:string"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

</xsd:schema>



examples/chineseDoc_utf8/valid.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?xml-stylesheet type='text/css' href='http://www.ascc.net/xml/test/style.css' ?>
<!DOCTYPE test SYSTEM 'http://www.ascc.net/xml/test/test.dtd'>
<!-- Copyright 1998 Academia Sinica Computing Center -->
<!-- Permission to use and distribute granted under MPL -->
<!-- Email corrections to ricko@gate.sinica.net.tw -->
<test type="io13" xml:lang="en">
  <name id="中">Chinese Test #13: UTF-8</name>
  <data>
    This file collects the previous tests cases into a single file.
    It is suitable for a quick overview. 
  </data>
  <data>
    The XML header of this file is
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>.
  </data>
  <data char="The character is here: [中]." >
    The character is here as decimal NCR: [中].
    It is the Chinese character for middle.
    It should look like a box with a vertical
    line through its middle. 
  </data>
  <data char="The character is here: [中]." >
    The character is here as hexadecimal NCR: [中].
    It is the Chinese character for middle.
    It should look like a box with a vertical
    line through its middle. 
  </data>
  <data char="The character is here: [中]." >
    The direct character is here: [中].
    It is the Chinese character for middle.
    It should look like a box with a vertical
    line through its middle. 
  </data>
  <data char="The character is here: [究]." >The other direct character is here: [究]. </data>
</test>


examples/chineseDoc_utf8/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char** argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{
  NoNS::test* pElemTest = xsdDoc->element_test();
  
  cout << "test.name: [" << pElemTest->element_name()->stringValue() << "]" << endl
       << "       test.name.@id: ["
       << pElemTest->element_name()->get_attr_id_string() 
       << "]" << endl;
       
  
  unsigned int sizeDataArray = pElemTest->elements_data().size();
  for(unsigned int i=0; i<sizeDataArray; i++)
  {
    NoNS::Types::TestType::data* pElemData = pElemTest->element_data_at(i);
    cout << "test.data[" << i << "]: [" << 
        pElemTest->element_name()->stringValue() << "]" << endl;

    if(pElemData->attribute_attr_char())
    {
      cout << "     test.data[" << i << "].@char: [" 
        << pElemData->get_attr_char_string() << "]";
    }
    cout << endl;
  }
}

  



examples/library


examples/library/library.xsd

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="library">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="book" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="isbn" type="xs:integer"/>
              <xs:element name="title">
                <xs:complexType>
                 <xs:simpleContent>
                 <xs:extension base="xs:string">
                 <xs:attribute name="lang" type="xs:language"/>
                 </xs:extension>
                 </xs:simpleContent>
                </xs:complexType>
              </xs:element> 
              <xs:element name="author" minOccurs="0"
                maxOccurs="unbounded">
                <xs:complexType>
                 <xs:sequence>
                 <xs:element name="name" type="xs:string"/>
                 <xs:element name="born" type="xs:date"/>
                 <xs:element name="dead" type="xs:date"/>
                 </xs:sequence>
                 <xs:attribute name="id" type="xs:ID"/>
                </xs:complexType>
              </xs:element> 
              <xs:element name="character" minOccurs="0"
                maxOccurs="unbounded">
                <xs:complexType>
                 <xs:sequence>
                 <xs:element name="name" type="xs:string"/>
                 <xs:element name="born" type="xs:date"/>
                 <xs:element name="qualification" type="xs:string"/>
                 </xs:sequence>
                 <xs:attribute name="id" type="xs:ID"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:ID"/>
            <xs:attribute name="available" type="xs:boolean"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>



examples/library/valid.xml

<?xml version="1.0"?>
<library>
  <book id="b0836217462" available="true">
    <isbn>0836217462</isbn>
    <title lang="en"> Being a Dog Is a Full-Time Job </title>
    <author id="CMS">
      <name>Charles M. Schulz</name>
      <born>1922-11-26</born>
      <dead>2000-02-12</dead>
    </author>
    <character id="Snoopy">
      <name>Snoopy</name>
      <born>1950-10-04</born>
      <qualification>extroverted beagle</qualification>
    </character>
  </book>
</library>


examples/library/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char** argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/xmldsig


examples/xmldsig/xmldsig-core-schema.xsd

<?xml version="1.0" encoding="utf-8"?>

<!-- Schema for XML Signatures
    http://www.w3.org/2000/09/xmldsig#
    $Revision: 1.1 $ on $Date: 2002/02/08 20:32:26 $ by $Author: reagle $

    Copyright 2001 The Internet Society and W3C (Massachusetts Institute
    of Technology, Institut National de Recherche en Informatique et en
    Automatique, Keio University). All Rights Reserved.
    http://www.w3.org/Consortium/Legal/

    This document is governed by the W3C Software License [1] as described
    in the FAQ [2].

    [1] http://www.w3.org/Consortium/Legal/copyright-software-19980720
    [2] http://www.w3.org/Consortium/Legal/IPR-FAQ-20000620.html#DTD
-->


<schema xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
        targetNamespace="http://www.w3.org/2000/09/xmldsig#"
        version="0.1" elementFormDefault="qualified"> 

<!-- Basic Types Defined for Signatures -->

<simpleType name="CryptoBinary">
  <restriction base="base64Binary">
  </restriction>
</simpleType>

<!-- Start Signature -->

<element name="Signature" type="ds:SignatureType"/>
<complexType name="SignatureType">
  <sequence> 
    <element ref="ds:SignedInfo"/> 
    <element ref="ds:SignatureValue"/> 
    <element ref="ds:KeyInfo" minOccurs="0"/> 
    <element ref="ds:Object" minOccurs="0" maxOccurs="unbounded"/> 
  </sequence>  
  <attribute name="Id" type="ID" use="optional"/>
</complexType>

  <element name="SignatureValue" type="ds:SignatureValueType"/> 
  <complexType name="SignatureValueType">
    <simpleContent>
      <extension base="base64Binary">
        <attribute name="Id" type="ID" use="optional"/>
      </extension>
    </simpleContent>
  </complexType>

<!-- Start SignedInfo -->

<element name="SignedInfo" type="ds:SignedInfoType"/>
<complexType name="SignedInfoType">
  <sequence> 
    <element ref="ds:CanonicalizationMethod"/> 
    <element ref="ds:SignatureMethod"/> 
    <element ref="ds:Reference" maxOccurs="unbounded"/> 
  </sequence>  
  <attribute name="Id" type="ID" use="optional"/> 
</complexType>

  <element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/> 
  <complexType name="CanonicalizationMethodType" mixed="true">
    <sequence>
      <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
      <!-- (0,unbounded) elements from (1,1) namespace -->
    </sequence>
    <attribute name="Algorithm" type="anyURI" use="required"/> 
  </complexType>

  <element name="SignatureMethod" type="ds:SignatureMethodType"/>
  <complexType name="SignatureMethodType" mixed="true">
    <sequence>
      <element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>
      <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
      <!-- (0,unbounded) elements from (1,1) external namespace -->
    </sequence>
    <attribute name="Algorithm" type="anyURI" use="required"/> 
  </complexType>

<!-- Start Reference -->

<element name="Reference" type="ds:ReferenceType"/>
<complexType name="ReferenceType">
  <sequence> 
    <element ref="ds:Transforms" minOccurs="0"/> 
    <element ref="ds:DigestMethod"/> 
    <element ref="ds:DigestValue"/> 
  </sequence>
  <attribute name="Id" type="ID" use="optional"/> 
  <attribute name="URI" type="anyURI" use="optional"/> 
  <attribute name="Type" type="anyURI" use="optional"/> 
</complexType>

  <element name="Transforms" type="ds:TransformsType"/>
  <complexType name="TransformsType">
    <sequence>
      <element ref="ds:Transform" maxOccurs="unbounded"/>  
    </sequence>
  </complexType>

  <element name="Transform" type="ds:TransformType"/>
  <complexType name="TransformType" mixed="true">
    <choice minOccurs="0" maxOccurs="unbounded"> 
      <any namespace="##other" processContents="lax"/>
      <!-- (1,1) elements from (0,unbounded) namespaces -->
      <element name="XPath" type="string"/> 
    </choice>
    <attribute name="Algorithm" type="anyURI" use="required"/> 
  </complexType>

<!-- End Reference -->

<element name="DigestMethod" type="ds:DigestMethodType"/>
<complexType name="DigestMethodType" mixed="true"> 
  <sequence>
    <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
  </sequence>    
  <attribute name="Algorithm" type="anyURI" use="required"/> 
</complexType>

<element name="DigestValue" type="ds:DigestValueType"/>
<simpleType name="DigestValueType">
  <restriction base="base64Binary"/>
</simpleType>

<!-- End SignedInfo -->

<!-- Start KeyInfo -->

<element name="KeyInfo" type="ds:KeyInfoType"/> 
<complexType name="KeyInfoType" mixed="true">
  <choice maxOccurs="unbounded">     
    <element ref="ds:KeyName"/> 
    <element ref="ds:KeyValue"/> 
    <element ref="ds:RetrievalMethod"/> 
    <element ref="ds:X509Data"/> 
    <element ref="ds:PGPData"/> 
    <element ref="ds:SPKIData"/>
    <element ref="ds:MgmtData"/>
    <any processContents="lax" namespace="##other"/>
    <!-- (1,1) elements from (0,unbounded) namespaces -->
  </choice>
  <attribute name="Id" type="ID" use="optional"/> 
</complexType>

  <element name="KeyName" type="string"/>
  <element name="MgmtData" type="string"/>

  <element name="KeyValue" type="ds:KeyValueType"/> 
  <complexType name="KeyValueType" mixed="true">
   <choice>
     <element ref="ds:DSAKeyValue"/>
     <element ref="ds:RSAKeyValue"/>
     <any namespace="##other" processContents="lax"/>
   </choice>
  </complexType>

  <element name="RetrievalMethod" type="ds:RetrievalMethodType"/> 
  <complexType name="RetrievalMethodType">
    <sequence>
      <element ref="ds:Transforms" minOccurs="0"/> 
    </sequence>  
    <attribute name="URI" type="anyURI"/>
    <attribute name="Type" type="anyURI" use="optional"/>
  </complexType>

<!-- Start X509Data -->

<element name="X509Data" type="ds:X509DataType"/> 
<complexType name="X509DataType">
  <sequence maxOccurs="unbounded">
    <choice>
      <element name="X509IssuerSerial" type="ds:X509IssuerSerialType"/>
      <element name="X509SKI" type="base64Binary"/>
      <element name="X509SubjectName" type="string"/>
      <element name="X509Certificate" type="base64Binary"/>
      <element name="X509CRL" type="base64Binary"/>
      <any namespace="##other" processContents="lax"/>
    </choice>
  </sequence>
</complexType>

<complexType name="X509IssuerSerialType"> 
  <sequence> 
    <element name="X509IssuerName" type="string"/> 
    <element name="X509SerialNumber" type="integer"/> 
  </sequence>
</complexType>

<!-- End X509Data -->

<!-- Begin PGPData -->

<element name="PGPData" type="ds:PGPDataType"/> 
<complexType name="PGPDataType"> 
  <choice>
    <sequence>
      <element name="PGPKeyID" type="base64Binary"/> 
      <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/> 
      <any namespace="##other" processContents="lax" minOccurs="0"
       maxOccurs="unbounded"/>
    </sequence>
    <sequence>
      <element name="PGPKeyPacket" type="base64Binary"/> 
      <any namespace="##other" processContents="lax" minOccurs="0"
       maxOccurs="unbounded"/>
    </sequence>
  </choice>
</complexType>

<!-- End PGPData -->

<!-- Begin SPKIData -->

<element name="SPKIData" type="ds:SPKIDataType"/> 
<complexType name="SPKIDataType">
  <sequence maxOccurs="unbounded">
    <element name="SPKISexp" type="base64Binary"/>
    <any namespace="##other" processContents="lax" minOccurs="0"/>
  </sequence>
</complexType> 

<!-- End SPKIData -->

<!-- End KeyInfo -->

<!-- Start Object (Manifest, SignatureProperty) -->

<element name="Object" type="ds:ObjectType"/> 
<complexType name="ObjectType" mixed="true">
  <sequence minOccurs="0" maxOccurs="unbounded">
    <any namespace="##any" processContents="lax"/>
  </sequence>
  <attribute name="Id" type="ID" use="optional"/> 
  <attribute name="MimeType" type="string" use="optional"/> <!-- add a grep facet -->
  <attribute name="Encoding" type="anyURI" use="optional"/> 
</complexType>

<element name="Manifest" type="ds:ManifestType"/> 
<complexType name="ManifestType">
  <sequence>
    <element ref="ds:Reference" maxOccurs="unbounded"/> 
  </sequence>
  <attribute name="Id" type="ID" use="optional"/> 
</complexType>

<element name="SignatureProperties" type="ds:SignaturePropertiesType"/> 
<complexType name="SignaturePropertiesType">
  <sequence>
    <element ref="ds:SignatureProperty" maxOccurs="unbounded"/> 
  </sequence>
  <attribute name="Id" type="ID" use="optional"/> 
</complexType>

   <element name="SignatureProperty" type="ds:SignaturePropertyType"/> 
   <complexType name="SignaturePropertyType" mixed="true">
     <choice maxOccurs="unbounded">
       <any namespace="##other" processContents="lax"/>
       <!-- (1,1) elements from (1,unbounded) namespaces -->
     </choice>
     <attribute name="Target" type="anyURI" use="required"/> 
     <attribute name="Id" type="ID" use="optional"/> 
   </complexType>

<!-- End Object (Manifest, SignatureProperty) -->

<!-- Start Algorithm Parameters -->

<simpleType name="HMACOutputLengthType">
  <restriction base="integer"/>
</simpleType>

<!-- Start KeyValue Element-types -->

<element name="DSAKeyValue" type="ds:DSAKeyValueType"/>
<complexType name="DSAKeyValueType">
  <sequence>
    <sequence minOccurs="0">
      <element name="P" type="ds:CryptoBinary"/>
      <element name="Q" type="ds:CryptoBinary"/>
    </sequence>
    <element name="G" type="ds:CryptoBinary" minOccurs="0"/>
    <element name="Y" type="ds:CryptoBinary"/>
    <element name="J" type="ds:CryptoBinary" minOccurs="0"/>
    <sequence minOccurs="0">
      <element name="Seed" type="ds:CryptoBinary"/>
      <element name="PgenCounter" type="ds:CryptoBinary"/>
    </sequence>
  </sequence>
</complexType>

<element name="RSAKeyValue" type="ds:RSAKeyValueType"/>
<complexType name="RSAKeyValueType">
  <sequence>
    <element name="Modulus" type="ds:CryptoBinary"/> 
    <element name="Exponent" type="ds:CryptoBinary"/> 
  </sequence>
</complexType> 

<!-- End KeyValue Element-types -->

<!-- End Signature -->

</schema>


examples/xmldsig/nsaliases.xml

<nsaliases>
  <alias uri="http://www.w3.org/2000/09/xmldsig#" toUrn="urn:xmldsig"/>
</nsaliases>


examples/xmldsig/signature-example-dsa.xml

<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
  <SignedInfo>
    <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
    <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1" />
    <Reference URI="http://www.w3.org/TR/xml-stylesheet">
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>
    </Reference>
  </SignedInfo>
  <SignatureValue>
    qUADDMHZkyebvRdLs+6Dv7RvgMLRlUaDB4Q9yn9XoJA79a2882ffTg==
  </SignatureValue>
  <KeyInfo>
    <KeyValue>
      <DSAKeyValue>
        <P>
          2iY3w062sDB3/DIlLWOeG9+4UpmDZ0dyqRk9dLlNQ6qaXI7tOrjdIhm6n/eOw45AQtuYSp6spCt9cQcNBAj22KvygvfJIIXX9sSQrugfGqifeSvY3VX5Sd1j+z0MSZ/n5jNt88uh2C11SAqX6nrXTY/1RwkoWRN23SYhOlaG0hU=
        </P>
        <Q>
          9B5ypLY9pMOmtxCeTDHgwdNFeGs=
        </Q>
        <G>
          MuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMY=
        </G>
        <Y>
          ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ0=
        </Y>
      </DSAKeyValue>
    </KeyValue>
    <X509Data>
      <X509SubjectName>
        CN=Merlin Hughes,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
      </X509SubjectName>
      <X509IssuerSerial>
        <X509IssuerName>
          CN=Test DSA CA,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
        </X509IssuerName>
        <X509SerialNumber>970849936</X509SerialNumber>
      </X509IssuerSerial>
      <X509Certificate>
        MIIDNzCCAvWgAwIBAgIEOd3+kDAJBgcqhkjOOAQDMFsxCzAJBgNVBAYTAklFMQ8wDQYDVQQIEwZEdWJsaW4xJTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMsIEx0ZC4xFDASBgNVBAMTC1Rlc3QgRFNBIENBMB4XDTAwMTAwNjE2MzIxNVoXDTAxMTAwNjE2MzIxNFowXTELMAkGA1UEBhMCSUUxDzANBgNVBAgTBkR1YmxpbjElMCMGA1UEChMcQmFsdGltb3JlIFRlY2hub2xvZ2llcywgTHRkLjEWMBQGA1UEAxMNTWVybGluIEh1Z2hlczCCAbYwggErBgcqhkjOOAQBMIIBHgKBgQDaJjfDTrawMHf8MiUtY54b37hSmYNnR3KpGT10uU1Dqppcju06uN0iGbqf947DjkBC25hKnqykK31xBw0ECPbYq/KC98kghdf2xJCu6B8aqJ95K9jdVflJ3WP7PQxJn+fmM23zy6HYLXVICpfqetdNj/VHCShZE3bdJiE6VobSFQIVAPQecqS2PaTDprcQnkwx4MHTRXhrAoGAMuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMYDgYQAAoGActA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ2jRzBFMB4GA1UdEQQXMBWBE21lcmxpbkBiYWx0aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqACEJZQG0KwRbPMAkGByqGSM44BAMDMQAwLgIVAK4skWEFYgrggaJA8vYAwSjg12+KAhUAwHTo7wd4tENw9LAKPklQ/74fH18=
      </X509Certificate>
    </X509Data>
  </KeyInfo>
</Signature>



examples/xmldsig/signature-example-rsa.xml

<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
  <SignedInfo>
    <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
    <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
    <Reference URI="http://www.w3.org/TR/xml-stylesheet">
      <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</DigestValue>
    </Reference>
  </SignedInfo>
  <SignatureValue>
    juS5RhJ884qoFR8flVXd/rbrSDVGn40CapgB7qeQiT+rr0NekEQ6BHhUA8dT3+BCTBUQI0dBjlml9lwzENXvS83zRECjzXbMRTUtVZiPZG2pqKPnL2YU3A9645UCjTXU+jgFumv7k78hieAGDzNci+PQ9KRmm//icT7JaYztgt4=
  </SignatureValue>
  <KeyInfo>
    <KeyValue>
      <RSAKeyValue>
        <Modulus>
          uCiukpgOaOmrq1fPUTH3CAXxuFmPjsmS4jnTKxrv0w1JKcXtJ2M3akaV1d/karvJlmeao20jNy9r+/vKwibjM77F+3bIkeMEGmAIUnFciJkR+ihO7b4cTuYnEi8xHtu4iMn6GODBoEzqFQYdd8p4vrZBsvs44nTrS8qyyhba648=
        </Modulus>
        <Exponent>
          AQAB
        </Exponent>
      </RSAKeyValue>
    </KeyValue>
    <X509Data>
      <X509SubjectName>
        CN=Merlin Hughes,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
      </X509SubjectName>
      <X509IssuerSerial>
        <X509IssuerName>
          CN=Test RSA CA,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE
        </X509IssuerName>
        <X509SerialNumber>970849928</X509SerialNumber>
      </X509IssuerSerial>
      <X509Certificate>
        MIICeDCCAeGgAwIBAgIEOd3+iDANBgkqhkiG9w0BAQQFADBbMQswCQYDVQQGEwJJRTEPMA0GA1UECBMGRHVibGluMSUwIwYDVQQKExxCYWx0aW1vcmUgVGVjaG5vbG9naWVzLCBMdGQuMRQwEgYDVQQDEwtUZXN0IFJTQSBDQTAeFw0wMDEwMDYxNjMyMDdaFw0wMTEwMDYxNjMyMDRaMF0xCzAJBgNVBAYTAklFMQ8wDQYDVQQIEwZEdWJsaW4xJTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMsIEx0ZC4xFjAUBgNVBAMTDU1lcmxpbiBIdWdoZXMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALgorpKYDmjpq6tXz1Ex9wgF8bhZj47JkuI50ysa79MNSSnF7SdjN2pGldXf5Gq7yZZnmqNtIzcva/v7ysIm4zO+xft2yJHjBBpgCFJxXIiZEfooTu2+HE7mJxIvMR7buIjJ+hjgwaBM6hUGHXfKeL62QbL7OOJ060vKssoW2uuPAgMBAAGjRzBFMB4GA1UdEQQXMBWBE21lcmxpbkBiYWx0aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqACEngrZIVgu03MA0GCSqGSIb3DQEBBAUAA4GBAHJu4JVq/WnXK2oqqfLWqes5vHOtfX/ZhCjFyDMhzslI8am62gZedwZ9IIZIwlNRMvEDQB2zds/eEBnIAQPl/yRLCLOfZnbA8PXrbFP5igs3qQWScBUjZVjik748HU2sUVZOa90c0mJl2vJs/RwyLW7/uCAfC/I/k9xGr7fneoIW
      </X509Certificate>
    </X509Data>
  </KeyInfo>
</Signature>



examples/xmldsig/signature-example.xml

<?xml version='1.0'?>
<!DOCTYPE Signature SYSTEM "xmldsig-core-schema.dtd" [
<!ENTITY dsig "http://www.w3.org/2000/09/xmldsig#">
   <!ENTITY % SignatureProperty.ANY '| ts:timestamp'>
   <!ELEMENT ts:timestamp (#PCDATA)>
   <!ATTLIST ts:timestamp
             xmlns:ts	CDATA	#FIXED   'http://www.example.org/rfc/rfcxxxx.txt'>
   <!ATTLIST Signature
             xmlns:xsi  CDATA #FIXED   'http://www.w3.org/2001/XMLSchema-instance'
             xsi:schemaLocation	CDATA	#REQUIRED>
]>
<Signature Id="MyFirstSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.w3.org/2000/09/xmldsig#
   xmldsig-core-schema.xsd">
  <SignedInfo> 
	 <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2000/WD-xml-c14n-20000710">
	 </CanonicalizationMethod>
	 <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa">
	 </SignatureMethod>
	 <Reference URI="http://www.w3.org/TR/xml-stylesheet/"> 
		<Transforms> 
		  <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/>
		  <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#null"/>
		</Transforms> 
		<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"> 
		</DigestMethod>
		<DigestValue>j6lwx3rvEPO0vKtMup4NbeVu8nk=</DigestValue> 
	 </Reference> 
	 <Reference URI="http://www.w3.org/TR/REC-xml-names/"> 
		<Transforms> 
		  <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/> 
		</Transforms> 
		<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"> 
		</DigestMethod>
		<DigestValue>UrXLDLBIta6skoV5/A8Q38GEw44=</DigestValue> 
	 </Reference> 	 
  </SignedInfo> 
  <SignatureValue>MC0CFFrVLtRlkMc3Daon4BqqnkhCOlEaAhUAk8pH1iRNK+q1I+sisDTz2TFEALE=</SignatureValue> 
  <KeyInfo>
    <KeyValue>
      <DSAKeyValue>
        <P>...</P><Q>...</Q><G>...</G><Y>...</Y>
      </DSAKeyValue> 
    </KeyValue> 
  </KeyInfo>
  <Object>
     <SignatureProperties>
        <SignatureProperty Target="#MyFirstSignature">
          <ts:timestamp xmlns:ts="http://www.example.org/rfc/rfcxxxx.txt">
           this is a test of the mixed content model</ts:timestamp>
        </SignatureProperty>
      </SignatureProperties>
  </Object>
</Signature>


examples/xmldsig/valid.xml

<?xml version="1.0"?>
<ns1:Signature xmlns:ns1="http://www.w3.org/2000/09/xmldsig#">
  <ns1:SignedInfo>
    <ns1:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
    <ns1:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
    <ns1:Reference URI="http://www.w3.org/TR/xml-stylesheet">
      <ns1:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
      <ns1:DigestValue>60NvZvtdTB+7UnlLp/H24p7h4bs=</ns1:DigestValue>
    </ns1:Reference>
  </ns1:SignedInfo>
  <ns1:SignatureValue>qUADDMHZkyebvRdLs+6Dv7RvgMLRlUaDB4Q9yn9XoJA79a2882ffTg==</ns1:SignatureValue>
  <ns1:KeyInfo>
    <ns1:KeyValue>
      <ns1:DSAKeyValue>
        <ns1:P>2iY3w062sDB3/DIlLWOeG9+4UpmDZ0dyqRk9dLlNQ6qaXI7tOrjdIhm6n/eOw45AQtuYSp6spCt9cQcNBAj22KvygvfJIIXX9sSQrugfGqifeSvY3VX5Sd1j+z0MSZ/n5jNt88uh2C11SAqX6nrXTY/1RwkoWRN23SYhOlaG0hU=</ns1:P>
        <ns1:Q>9B5ypLY9pMOmtxCeTDHgwdNFeGs=</ns1:Q>
        <ns1:G>MuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMY=</ns1:G>
        <ns1:Y>ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ0=</ns1:Y>
      </ns1:DSAKeyValue>
    </ns1:KeyValue>
    <ns1:X509Data>
      <ns1:X509SubjectName>CN=Merlin Hughes,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE</ns1:X509SubjectName>
      <ns1:X509IssuerSerial>
        <ns1:X509IssuerName>CN=Test DSA CA,O=Baltimore Technologies\, Ltd.,ST=Dublin,C=IE</ns1:X509IssuerName>
        <ns1:X509SerialNumber>970849936</ns1:X509SerialNumber>
      </ns1:X509IssuerSerial>
      <ns1:X509Certificate>MIIDNzCCAvWgAwIBAgIEOd3+kDAJBgcqhkjOOAQDMFsxCzAJBgNVBAYTAklFMQ8wDQYDVQQIEwZEdWJsaW4xJTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMsIEx0ZC4xFDASBgNVBAMTC1Rlc3QgRFNBIENBMB4XDTAwMTAwNjE2MzIxNVoXDTAxMTAwNjE2MzIxNFowXTELMAkGA1UEBhMCSUUxDzANBgNVBAgTBkR1YmxpbjElMCMGA1UEChMcQmFsdGltb3JlIFRlY2hub2xvZ2llcywgTHRkLjEWMBQGA1UEAxMNTWVybGluIEh1Z2hlczCCAbYwggErBgcqhkjOOAQBMIIBHgKBgQDaJjfDTrawMHf8MiUtY54b37hSmYNnR3KpGT10uU1Dqppcju06uN0iGbqf947DjkBC25hKnqykK31xBw0ECPbYq/KC98kghdf2xJCu6B8aqJ95K9jdVflJ3WP7PQxJn+fmM23zy6HYLXVICpfqetdNj/VHCShZE3bdJiE6VobSFQIVAPQecqS2PaTDprcQnkwx4MHTRXhrAoGAMuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMYDgYQAAoGActA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ2jRzBFMB4GA1UdEQQXMBWBE21lcmxpbkBiYWx0aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqACEJZQG0KwRbPMAkGByqGSM44BAMDMQAwLgIVAK4skWEFYgrggaJA8vYAwSjg12+KAhUAwHTo7wd4tENw9LAKPklQ/74fH18=</ns1:X509Certificate>
    </ns1:X509Data>
  </ns1:KeyInfo>
</ns1:Signature>


examples/xmldsig/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "xmldsig/all-include.h"

void populateDocument(xmldsig::Document* xsdDoc);
void updateOrConsumeDocument(xmldsig::Document* xsdDoc);
  
void chooseDocumentElement(xmldsig::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<xmldsig::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  cbStruct.cbChooseDocumentElement      =  chooseDocumentElement;
  
  XSD::UserOps<xmldsig::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(xmldsig::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_Signature();
  
  //xsdDoc->set_root_SignatureValue();
  
  //xsdDoc->set_root_SignedInfo();
  
  //xsdDoc->set_root_CanonicalizationMethod();
  
  //xsdDoc->set_root_SignatureMethod();
  
  //xsdDoc->set_root_Reference();
  
  //xsdDoc->set_root_Transforms();
  
  //xsdDoc->set_root_Transform();
  
  //xsdDoc->set_root_DigestMethod();
  
  //xsdDoc->set_root_DigestValue();
  
  //xsdDoc->set_root_KeyInfo();
  
  //xsdDoc->set_root_KeyName();
  
  //xsdDoc->set_root_MgmtData();
  
  //xsdDoc->set_root_KeyValue();
  
  //xsdDoc->set_root_RetrievalMethod();
  
  //xsdDoc->set_root_X509Data();
  
  //xsdDoc->set_root_PGPData();
  
  //xsdDoc->set_root_SPKIData();
  
  //xsdDoc->set_root_Object();
  
  //xsdDoc->set_root_Manifest();
  
  //xsdDoc->set_root_SignatureProperties();
  
  //xsdDoc->set_root_SignatureProperty();
  
  //xsdDoc->set_root_DSAKeyValue();
  
  //xsdDoc->set_root_RSAKeyValue();
    
}
    

void populateDSADocument(xmldsig::Document* xsdDoc)
{
  xmldsig::Signature* pSig = xsdDoc->element_Signature();
  pSig->mark_present_KeyInfo();
  pSig->element_KeyInfo()->set_count_choiceList(2);

  xmldsig::SignedInfo* pSignedInfo = pSig->element_SignedInfo();
  pSignedInfo->element_CanonicalizationMethod()->set_attr_Algorithm("http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
  pSignedInfo->element_SignatureMethod()->set_attr_Algorithm("http://www.w3.org/2000/09/xmldsig#dsa-sha1");
  xmldsig::Reference* pRef = pSignedInfo->element_Reference_at(0);
  pRef->element_DigestMethod()->set_attr_Algorithm("http://www.w3.org/2000/09/xmldsig#sha1");
  pRef->set_DigestValue("60NvZvtdTB+7UnlLp/H24p7h4bs=");
  pRef->set_attr_URI("http://www.w3.org/TR/xml-stylesheet");


  pSig->element_SignatureValue()->stringValue("qUADDMHZkyebvRdLs+6Dv7RvgMLRlUaDB4Q9yn9XoJA79a2882ffTg==");

  // KeyInfo -> choice1
  pSig->element_KeyInfo()->choice_at(0)->choose_KeyValue()->get_choice()->choose_DSAKeyValue();
  xmldsig::DSAKeyValue* pDSA_KV = pSig->element_KeyInfo()->choice_at(0)->element_KeyValue()->element_DSAKeyValue();
  
  // DSAKeyValue -> sequence1
  pDSA_KV->get_sequence()->mark_present_sequence1();
  pDSA_KV->set_P("2iY3w062sDB3/DIlLWOeG9+4UpmDZ0dyqRk9dLlNQ6qaXI7tOrjdIhm6n/eOw45AQtuYSp6spCt9cQcNBAj22KvygvfJIIXX9sSQrugfGqifeSvY3VX5Sd1j+z0MSZ/n5jNt88uh2C11SAqX6nrXTY/1RwkoWRN23SYhOlaG0hU=");
  pDSA_KV->set_Q("9B5ypLY9pMOmtxCeTDHgwdNFeGs=");

  pDSA_KV->set_G("MuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMY=");        
  pDSA_KV->set_Y("ctA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ0=");        

  xmldsig::X509Data* pX509Data = pSig->element_KeyInfo()->choice_at(1)->choose_X509Data();
  pX509Data->set_count_sequenceList(3);

  //pX509Data->sequence_at(0)->get_choice1()->choose_X509SubjectName()->stringValue("CN=Merlin Hughes,O=Baltimore Technologies\\, Ltd.,ST=Dublin,C=IE");
  pX509Data->sequence_at(0)->get_choice1()->set_X509SubjectName("CN=Merlin Hughes,O=Baltimore Technologies\\, Ltd.,ST=Dublin,C=IE");
  
  xmldsig::Types::X509IssuerSerialType* pIS = pX509Data->sequence_at(1)->get_choice1()->choose_X509IssuerSerial();
  pIS->set_X509IssuerName("CN=Test DSA CA,O=Baltimore Technologies\\, Ltd.,ST=Dublin,C=IE");
  pIS->set_X509SerialNumber("970849936");


  pX509Data->sequence_at(2)->get_choice1()->choose_X509Certificate()->stringValue("MIIDNzCCAvWgAwIBAgIEOd3+kDAJBgcqhkjOOAQDMFsxCzAJBgNVBAYTAklFMQ8wDQYDVQQIEwZEdWJsaW4xJTAjBgNVBAoTHEJhbHRpbW9yZSBUZWNobm9sb2dpZXMsIEx0ZC4xFDASBgNVBAMTC1Rlc3QgRFNBIENBMB4XDTAwMTAwNjE2MzIxNVoXDTAxMTAwNjE2MzIxNFowXTELMAkGA1UEBhMCSUUxDzANBgNVBAgTBkR1YmxpbjElMCMGA1UEChMcQmFsdGltb3JlIFRlY2hub2xvZ2llcywgTHRkLjEWMBQGA1UEAxMNTWVybGluIEh1Z2hlczCCAbYwggErBgcqhkjOOAQBMIIBHgKBgQDaJjfDTrawMHf8MiUtY54b37hSmYNnR3KpGT10uU1Dqppcju06uN0iGbqf947DjkBC25hKnqykK31xBw0ECPbYq/KC98kghdf2xJCu6B8aqJ95K9jdVflJ3WP7PQxJn+fmM23zy6HYLXVICpfqetdNj/VHCShZE3bdJiE6VobSFQIVAPQecqS2PaTDprcQnkwx4MHTRXhrAoGAMuGAlqeB1ax+vyO2+Osubjhl7pHxLu47RIH+/M52DjESA9KMSrwzsYx8yNR2WooByrE0t6fu0VncK7UK8olO4t7wpv2z4AFQPRVCKFwo0qgn5aKIkICGMlrRy81avb27wGcWothx3iPPMtFXtoDqK0JItaI9R8zc1msFhM1GKMYDgYQAAoGActA8YGxrtngg/zKVvqEOefnwmViFztcnPBYPlJsvh6yKI4iDm68fnp4Mi3RrJ6bZAygFrUIQLxLjV+OJtgJAEto0xAs+Mehuq1DkSFEpP3oDzCTOsrOiS1DwQe4oIb7zVk/9l7aPtJMHW0LVlMdwZNFNNJoqMcT2ZfCPrfvYvQ2jRzBFMB4GA1UdEQQXMBWBE21lcmxpbkBiYWx0aW1vcmUuaWUwDgYDVR0PAQH/BAQDAgeAMBMGA1UdIwQMMAqACEJZQG0KwRbPMAkGByqGSM44BAMDMQAwLgIVAK4skWEFYgrggaJA8vYAwSjg12+KAhUAwHTo7wd4tENw9LAKPklQ/74fH18=");
  
}
    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(xmldsig::Document* xsdDoc)
{
  populateDSADocument(xsdDoc);
}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(xmldsig::Document* xsdDoc)
{

}

  



examples/org


examples/org/engg.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:ns1="urn:org:engg"
  xmlns:ns2="urn:org:hr"
  targetNamespace="urn:org:engg"
>
  <xsd:import namespace="urn:org:hr" schemaLocation="hr.xsd"/>

  <xsd:complexType name="EnggDept">
    <xsd:sequence>
      <xsd:element ref="ns2:leaderId"/>
      <xsd:element name="project" type="ns1:EnggProject" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:token" use="required"/>
  </xsd:complexType>

  <xsd:complexType name="EnggProject">
    <xsd:sequence>
      <xsd:element ref="ns2:leaderId"/>
      <xsd:element name="projectName" type="xsd:string"/>
      <xsd:element name="engineers" type="ns2:UserIdList"/>
    </xsd:sequence>
  </xsd:complexType>



</xsd:schema>


examples/org/hr.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:ns1="urn:org:hr"
  targetNamespace="urn:org:hr"
>

  <xsd:element name="userId" type="ns1:UserId" />
  <xsd:element name="leaderId" type="ns1:UserId" />

  <xsd:simpleType name="UserId">
    <xsd:restriction base='xsd:token'>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:complexType name="UserIdList">
    <xsd:sequence>
      <xsd:element ref="ns1:userId" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Employee">
    <xsd:sequence>
      <xsd:element ref="ns1:userId"/>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="title" type="xsd:string"/>
      <xsd:element name="joiningDate" type="xsd:date"/>
      <xsd:element name="reportsTo" type="ns1:UserId" minOccurs="0"/>
      <xsd:element name="reportees" type="ns1:UserIdList"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="AllEmployees">
    <xsd:sequence>
      <xsd:element name="employee" type="ns1:Employee" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>


</xsd:schema>



examples/org/legal.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:ns1="urn:org:legal"
  xmlns:ns2="urn:org:hr"
  targetNamespace="urn:org:legal"
>
  <xsd:import namespace="urn:org:hr" schemaLocation="hr.xsd"/>

  <xsd:complexType name="LegalDept">
    <xsd:sequence>
      <xsd:element ref="ns2:leaderId"/>
      <xsd:element name="legalAdvisors" type="ns2:UserIdList"/>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:token" use="required"/>
  </xsd:complexType>

</xsd:schema>


examples/org/org.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  xmlns:ns1="urn:org"
  xmlns:ns2="urn:org:engg"
  xmlns:ns3="urn:org:legal"
  xmlns:ns4="urn:org:hr"
  targetNamespace="urn:org"
>

  <xsd:import namespace="urn:org:engg" schemaLocation="engg.xsd"/>
  <xsd:import namespace="urn:org:legal" schemaLocation="legal.xsd"/>
  <xsd:import namespace="urn:org:hr" schemaLocation="hr.xsd"/>

  <xsd:element name="organization">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="ns4:leaderId"/>
        <xsd:element name="name" type="xsd:string"/>
        <xsd:element name="departments" type="ns1:Departments"/>
        <xsd:element name="allEmployees" type="ns4:AllEmployees"/>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:token" use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:complexType name="Departments">
    <xsd:sequence>
      <xsd:element name="engineering" type="ns2:EnggDept"/>
      <xsd:element name="legal" type="ns3:LegalDept"/>
    </xsd:sequence>
  </xsd:complexType>

</xsd:schema>


examples/org/valid.xml

<?xml version="1.0"?>
<ns1:organization id="nasa" xmlns:ns1="urn:org" xmlns:ns2="urn:org:hr">
  <ns2:leaderId>jimb</ns2:leaderId>
  <name>NASA</name>
  <departments>
    <engineering id="nasa.deperatments.engineering">
      <ns2:leaderId>paulb</ns2:leaderId>
      <project>
        <ns2:leaderId>allenb</ns2:leaderId>
        <projectName>The unmanned moon mission 2015</projectName>
        <engineers>
          <ns2:userId>charlese</ns2:userId>
          <ns2:userId>waynec</ns2:userId>
        </engineers>
      </project>
      <project>
        <ns2:leaderId>leeb</ns2:leaderId>
        <projectName>The manned moon mission 2020</projectName>
        <engineers>
          <ns2:userId>peterc</ns2:userId>
          <ns2:userId>davidc</ns2:userId>
        </engineers>
      </project>
    </engineering>
    <legal id="nasa.deperatments.legal">
      <ns2:leaderId>donb</ns2:leaderId>
      <legalAdvisors>
        <ns2:userId>danc</ns2:userId>
        <ns2:userId>ugoc</ns2:userId>
      </legalAdvisors>
    </legal>
  </departments>
  <allEmployees>
    <employee>
      <ns2:userId>jimb</ns2:userId>
      <name>Jim Barnette</name>
      <title>org head</title>
      <joiningDate>1978-02-11</joiningDate>
      <reportees>
        <ns2:userId>paulb</ns2:userId>
        <ns2:userId>donb</ns2:userId>
      </reportees>
    </employee>
    <employee>
      <ns2:userId>paulb</ns2:userId>
      <name>Paul V. Biron</name>
      <title>Engg head</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>jimb</reportsTo>
      <reportees>
        <ns2:userId>allenb</ns2:userId>
        <ns2:userId>leeb</ns2:userId>
      </reportees>
    </employee>
    <employee>
      <ns2:userId>donb</ns2:userId>
      <name>Don Box</name>
      <title>Legal head</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>jimb</reportsTo>
      <reportees>
        <ns2:userId>danc</ns2:userId>
        <ns2:userId>ugoc</ns2:userId>
      </reportees>
    </employee>
    <employee>
      <ns2:userId>allenb</ns2:userId>
      <name>Allen Brown</name>
      <title>Proj1 head</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>paulb</reportsTo>
      <reportees>
        <ns2:userId>charlese</ns2:userId>
        <ns2:userId>waynec</ns2:userId>
      </reportees>
    </employee>
    <employee>
      <ns2:userId>leeb</ns2:userId>
      <name>Lee Buck</name>
      <title>Proj2 head</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>paulb</reportsTo>
      <reportees>
        <ns2:userId>peterc</ns2:userId>
        <ns2:userId>davidc</ns2:userId>
      </reportees>
    </employee>
    <employee>
      <ns2:userId>charlese</ns2:userId>
      <name>Charles E Campbell</name>
      <title>SMTS</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>allenb</reportsTo>
      <reportees/>
    </employee>
    <employee>
      <ns2:userId>waynec</ns2:userId>
      <name>Wayne Carr</name>
      <title>SMTS</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>allenb</reportsTo>
      <reportees/>
    </employee>
    <employee>
      <ns2:userId>peterc</ns2:userId>
      <name>Peter Chen</name>
      <title>SMTS</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>leeb</reportsTo>
      <reportees/>
    </employee>
    <employee>
      <ns2:userId>davidc</ns2:userId>
      <name>David Cleary</name>
      <title>SMTS</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>leeb</reportsTo>
      <reportees/>
    </employee>
    <employee>
      <ns2:userId>danc</ns2:userId>
      <name>Dan Connolly</name>
      <title>Legal Advisor</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>donb</reportsTo>
      <reportees/>
    </employee>
    <employee>
      <ns2:userId>ugoc</ns2:userId>
      <name>Ugo Corda</name>
      <title>Legal Advisor</title>
      <joiningDate>1978-02-15</joiningDate>
      <reportsTo>donb</reportsTo>
      <reportees/>
    </employee>
  </allEmployees>
</ns1:organization>


examples/org/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "org/all-include.h"

void populateDocument(org::Document* xsdDoc);
void updateOrConsumeDocument(org::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<org::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<org::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(org::Document* xsdDoc)
{
  /*
  Jim Barnette    : org head

  Engg:  
      Paul V. Biron : engg head
   
    Project1: 
        Allen Brown : proj1 head
        Charles E. Campbell
        Wayne Carr

    Project2:
        Lee Buck : proj2 head
        Peter Chen
        David Cleary

  
  Legal:
      Don Box :legal head
      Dan Connolly
      Ugo Corda

  */

  org::organization* pOrgn = xsdDoc->element_organization();
  pOrgn->set_leaderId("jimb");
  pOrgn->set_attr_id("nasa");
  pOrgn->set_name("NASA");

  // all employees
  pOrgn->element_allEmployees()->set_count_employee(11);
  org::hr::Types::Employee* pEmpl = NULL;
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(0);
  pEmpl->set_name("Jim Barnette");
  pEmpl->set_userId("jimb");
  pEmpl->set_joiningDate("1978-02-11");
  pEmpl->set_title("org head");
  pEmpl->element_reportees()->add_userId_string("paulb");
  pEmpl->element_reportees()->add_userId_string("donb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(1);
  pEmpl->set_name("Paul V. Biron");
  pEmpl->set_userId("paulb");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Engg head");
  pEmpl->element_reportees()->add_userId_string("allenb");
  pEmpl->element_reportees()->add_userId_string("leeb");
  pEmpl->set_reportsTo("jimb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(2);
  pEmpl->set_name("Don Box");
  pEmpl->set_userId("donb");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Legal head");
  pEmpl->element_reportees()->add_userId_string("danc");
  pEmpl->element_reportees()->add_userId_string("ugoc");
  pEmpl->set_reportsTo("jimb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(3);
  pEmpl->set_name("Allen Brown");
  pEmpl->set_userId("allenb");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Proj1 head");
  pEmpl->element_reportees()->add_userId_string("charlese");
  pEmpl->element_reportees()->add_userId_string("waynec");
  pEmpl->set_reportsTo("paulb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(4);
  pEmpl->set_name("Lee Buck");
  pEmpl->set_userId("leeb");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Proj2 head");
  pEmpl->element_reportees()->add_userId_string("peterc");
  pEmpl->element_reportees()->add_userId_string("davidc");
  pEmpl->set_reportsTo("paulb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(5);
  pEmpl->set_name("Charles E Campbell");
  pEmpl->set_userId("charlese");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("SMTS");
  pEmpl->set_reportsTo("allenb");

  pEmpl = pOrgn->element_allEmployees()->element_employee_at(6);
  pEmpl->set_name("Wayne Carr");
  pEmpl->set_userId("waynec");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("SMTS");
  pEmpl->set_reportsTo("allenb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(7);
  pEmpl->set_name("Peter Chen");
  pEmpl->set_userId("peterc");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("SMTS");
  pEmpl->set_reportsTo("leeb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(8);
  pEmpl->set_name("David Cleary");
  pEmpl->set_userId("davidc");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("SMTS");
  pEmpl->set_reportsTo("leeb");

  pEmpl = pOrgn->element_allEmployees()->element_employee_at(9);
  pEmpl->set_name("Dan Connolly");
  pEmpl->set_userId("danc");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Legal Advisor");
  pEmpl->set_reportsTo("donb");
  
  pEmpl = pOrgn->element_allEmployees()->element_employee_at(10);
  pEmpl->set_name("Ugo Corda");
  pEmpl->set_userId("ugoc");
  pEmpl->set_joiningDate("1978-02-15");
  pEmpl->set_title("Legal Advisor");
  pEmpl->set_reportsTo("donb");
  

  org::Types::Departments::engineering* pEnggDept = pOrgn->element_departments()->element_engineering();
  pEnggDept->set_attr_id("nasa.deperatments.engineering");
  pEnggDept->set_leaderId("paulb");
  pEnggDept->set_count_project(2);

  org::engg::Types::EnggDept::project* pProj = NULL;
  
  pProj = pEnggDept->element_project_at(0);
  pProj->set_leaderId("allenb");
  pProj->element_engineers()->add_userId_string("charlese");
  pProj->element_engineers()->add_userId_string("waynec");
  pProj->set_projectName("The unmanned moon mission 2015");

  pProj = pEnggDept->element_project_at(1);
  pProj->set_leaderId("leeb");
  pProj->element_engineers()->add_userId_string("peterc");
  pProj->element_engineers()->add_userId_string("davidc");
  pProj->set_projectName("The manned moon mission 2020");

  org::Types::Departments::legal* pLegalDept = pOrgn->element_departments()->element_legal();
  pLegalDept->set_attr_id("nasa.deperatments.legal");
  pLegalDept->set_leaderId("donb");
  pLegalDept->element_legalAdvisors()->add_userId_string("danc");
  pLegalDept->element_legalAdvisors()->add_userId_string("ugoc");
}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(org::Document* xsdDoc)
{

}

  



examples/japaneseDoc_utf8


examples/japaneseDoc_utf8/japaneseDoc_utf8.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
  <xsd:element name="document" type="documentType"/>

  <xsd:complexType name="documentType">
    <xsd:sequence>
      <xsd:element name="para" type="xsd:string" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

</xsd:schema>



examples/japaneseDoc_utf8/valid.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
  Courtesy: http://www.w3.org/Submission/japanese-xml
-->
<document>
  <para xml:lang="ja">これは段落です。</para>
  <para xml:lang="en">This is a paragraph.</para>
</document>



examples/japaneseDoc_utf8/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char** argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/helloWorld


examples/helloWorld/helloWorld.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
 <xsd:element name="msg" type="xsd:string"/>

</xsd:schema>



examples/helloWorld/valid.xml

<?xml version="1.0"?>
<msg>Hello World</msg>


examples/helloWorld/main.cpp

#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here
void populateDocument(NoNS::Document* xsdDoc)
{
  xsdDoc->element_msg()->stringValue("Hello World");
}

// write code to operate(update/consume/test etc.) on the Document, which is already
// populated(eg. read from an input xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/mails


examples/mails/mails.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:element name="mails" type="mailsType" />
  <xsd:element name="header" type="xsd:string"/>
  <xsd:element name="Date" type="xsd:dateTime" />
  <xsd:attribute name="name" type="xsd:string" />

<!--
 <xsd:element name="header">
  <xsd:complexType>
   <xsd:simpleContent>
    <xsd:extension base="xsd:string">
     <xsd:attribute ref="name" use="required" />
    </xsd:extension>
   </xsd:simpleContent>
  </xsd:complexType>
 </xsd:element>
-->

 <xsd:complexType name="mailsType">
  <xsd:sequence minOccurs="1" maxOccurs="unbounded">
   <xsd:element name="mail" type="mailType"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="mailType">
  <xsd:sequence>
   <xsd:element name="envelope" type="envelopeType" />
   <xsd:element name="body" type="bodyType" />
   <xsd:element name="attachment" type="attachmentType" minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>
  <xsd:attribute use="required" name="id" type="xsd:integer" />
 </xsd:complexType>

 <xsd:complexType name="envelopeType">
  <xsd:sequence>
   <xsd:element name="From" type="xsd:string" />
   <xsd:element name="To" type="xsd:string" />
   <xsd:element ref="Date" />
   <xsd:element name="Subject" type="xsd:string" />
   <xsd:element ref="header" minOccurs="0" maxOccurs="unbounded" />
  </xsd:sequence>
 </xsd:complexType>

 <xsd:simpleType name="bodyType">
  <xsd:restriction base="xsd:string" />
 </xsd:simpleType>

 <xsd:complexType name="attachmentType">
  <xsd:sequence>
   <xsd:element name="mimetype" type="xsd:string"/>
   <xsd:element name="content" type="xsd:base64Binary" minOccurs="0" />
  </xsd:sequence>
  <xsd:attribute ref="name" use="required" />
 </xsd:complexType>

 <xsd:simpleType name="mimeTopLevelType">
  <xsd:restriction base="xsd:string">
   <xsd:enumeration value="text" />
   <xsd:enumeration value="multipart" />
   <xsd:enumeration value="application" />
   <xsd:enumeration value="message" />
   <xsd:enumeration value="image" />
   <xsd:enumeration value="audio" />
   <xsd:enumeration value="video" />
  </xsd:restriction>
 </xsd:simpleType>

</xsd:schema>


examples/mails/valid.xml

<?xml version="1.0"?>
<mails>
  <mail id="101">
    <envelope>
      <From>tom@mgm.com</From>
      <To>jerry@mgm.com</To>
      <Date>1978-07-04T14:50:59Z</Date>
      <Subject>this shouldn't happen to dogs</Subject>
    </envelope>
    <body>Heard that the dogs are chained these days.
	Who is going to save you now? :)</body>
  </mail>
  <mail id="131">
    <envelope>
      <From>jerry@mgm.com</From>
      <To>tom@mgm.com</To>
      <Date>1978-07-04T23:50:59Z</Date>
      <Subject>Re: this shouldn't happen to dogs</Subject>
    </envelope>
    <body>>Heard that the dogs are chained these days.
	>Who is going to save you now? :)

	Hmmm... I am in trouble now, I guess :(</body>
  </mail>
</mails>


examples/mails/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
  
void chooseDocumentElement(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  
  cbStruct.cbChooseDocumentElement    =  chooseDocumentElement;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(NoNS::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_mails();
  
  //xsdDoc->set_root_header();
  
  //xsdDoc->set_root_Date();
    
}
    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{
  NoNS::mails* pMails = xsdDoc->element_mails();
  pMails->set_count_sequenceList(2);
  
  NoNS::mails::sequenceList::sequence* pSeq =NULL;
  NoNS::mails::mail* pMail = NULL;
  
  pSeq = pMails->sequence_at(0);
  pMail= pSeq->element_mail(); 
  pMail->set_attr_id(101);
  pMail->element_envelope()->set_From("tom@mgm.com");
  pMail->element_envelope()->set_To("jerry@mgm.com");
  pMail->element_envelope()->set_Date("1978-07-04T14:50:59Z");
  pMail->element_envelope()->set_Subject("this shouldn't happen to dogs");
  pMail->set_body("\n\tHeard that the dogs are chained these days.\n\tWho is going to save you now? :)\n");

  pSeq = pMails->sequence_at(1);
  pMail= pSeq->element_mail(); 
  pMail->set_attr_id(131);
  pMail->element_envelope()->set_From("jerry@mgm.com");
  pMail->element_envelope()->set_To("tom@mgm.com");
  pMail->element_envelope()->set_Date("1978-07-04T23:50:59Z");
  pMail->element_envelope()->set_Subject("Re: this shouldn't happen to dogs");
  pMail->set_body("\n\t>Heard that the dogs are chained these days.\n\t>Who is going to save you now? :)\n\n\tHmmm... I am in trouble now, I guess :(\n");

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/simpleTypesDemo


examples/simpleTypesDemo/simpleTypesDemo.xsd

<?xml version="1.0" encoding="UTF-8" ?>

<!--
// This file is part of XmlPlus package
// 
// Copyright (C)   2010   Satya Prakash Tripathi
// All rights reserved.
//
-->

<xsd:schema
elementFormDefault="qualified"
attributeFormDefault="qualified"
targetNamespace="http://www.example.com/STDemo"
xmlns:tns="http://www.example.com/STDemo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>

  <!-- 
            1. global element/attribute declarations 
  -->

  <xsd:element name="myComplexTypeElem" type="tns:MyComplexType"/>
  <xsd:element name="globalWaterTemp" type="tns:CelciusWaterTemp"/>
  <xsd:attribute name="globalStringAttr">
    <xsd:simpleType>
      <xsd:restriction base='xsd:string'>
        <xsd:length value='3'/>
      </xsd:restriction>
    </xsd:simpleType>
  </xsd:attribute>


  <!-- 
          2. global simpleType/complexType declarations
  -->

  <xsd:complexType name="MyComplexType" mixed="true">
    <xsd:sequence>
      
      <!-- 2.1 atomic, builtin simpleTypes  -->
      <xsd:element name="xBoolean" type="xsd:boolean" fixed="false"/>
      <xsd:element name="xDecimal" type="xsd:decimal" default="-1.23e-6"/>
      <xsd:element name="xFloat" type="xsd:float" default="-1.23e-3"/>
      <xsd:element name="xDouble" type="xsd:double" default="-1.23e-5"/>
      <xsd:element name="xInteger" type="xsd:integer" default="-12678967543233"/>
      <xsd:element name="xPositiveInteger" type="xsd:positiveInteger" default="12678967543233"/>
      <xsd:element name="xNonPositiveInteger" type="xsd:nonPositiveInteger" default="-12678967543233"/>
      <xsd:element name="xNegativeInteger" type="xsd:negativeInteger" default="-12678967543233"/>
      <xsd:element name="xNonNegativeInteger" type="xsd:nonNegativeInteger" default="12678967543233"/>
      <xsd:element name="xLong" type="xsd:long" default="-9223372036854775808"/>
      <xsd:element name="xInt" type="xsd:int" default="-2147483648"/>
      <xsd:element name="xShort" type="xsd:short" default="-32768"/>
      <xsd:element name="xByte" type="xsd:byte" default="-127"/>
      <xsd:element name="xUnsignedLong" type="xsd:unsignedLong" default="18446744073709551615"/>
      <xsd:element name="xUnsignedInt" type="xsd:unsignedInt" default="4294967295"/>
      <xsd:element name="xUnsignedShort" type="xsd:unsignedShort" default="65535"/>
      <xsd:element name="xUnsignedByte" type="xsd:unsignedByte" default="255"/>
      <xsd:element name="xHexBinary" type="xsd:hexBinary" default="FEFF"/>
      <xsd:element name="xBase64Binary" type="xsd:base64Binary" default="ZXF+NAQF/d"/>
      <xsd:element name="xUri" type="xsd:anyURI" default="http://www.example.com/xmlplus"/>
      <xsd:element name="xNormalizedString" type="xsd:normalizedString" default="no CR LF TAB"/>
      <xsd:element name="xToken" type="xsd:token" default=" xs:hexBinary "/>
      <xsd:element name="xLanguage" type="xsd:language" default="english"/>
      <xsd:element name="xName" type="xsd:Name" default=":colonToken"/>
      <xsd:element name="xNCName" type="xsd:NCName" default="noColonToken"/>
      <xsd:element name="xQName" type="xsd:QName" default="xsi:schemaLocation"/>
      <xsd:element name="xDateTime" type="xsd:dateTime" default="2001-07-04T14:50:59Z"/>
      <xsd:element name="xDate" type="xsd:date" default="2010-01-04"/>
      <xsd:element name="xYearMonth" type="xsd:gYearMonth" default="1980-11"/>
      <xsd:element name="xYear" type="xsd:gYear" default="1978"/>
      <xsd:element name="xMonthDay" type="xsd:gMonthDay" default="12-30"/>
      <xsd:element name="xMonth" type="xsd:gMonth" default="7"/>
      <xsd:element name="xDay" type="xsd:gDay" default="30"/>
      <xsd:element name="xTime" type="xsd:time" default="14:59:57"/>
      <xsd:element name="xDuration" type="xsd:duration" default="P1Y2M3DT10H30M40S"/>

      <!-- 2.2 atomic, derived(non-builtin) simpleTypes  -->
      <xsd:element name="anIntMax10" minOccurs="3" maxOccurs="5">
        <xsd:simpleType>
          <xsd:restriction base='xsd:int'>
            <xsd:maxInclusive value='10'/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>
      <xsd:element name="anIntMax5k" type="tns:IntMax5k"/>
      <xsd:element ref="tns:globalWaterTemp"/>
      <xsd:element name="aSKU" type="tns:SKU"/>
      <xsd:element name="aDateTime" type="tns:DateTimeInARange"/>
      <xsd:element name="aDate" type="tns:DateInARange" default="2010-01-04"/>
      <xsd:element name="aYear" type="tns:YearInARange"/>
      <xsd:element name="aCommonName">
        <xsd:simpleType>
          <xsd:restriction base='xsd:string'>
            <xsd:length value='5'/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>

      <!-- 2.3 list simpleTypes -->
      <xsd:element name="aListOfIntMax5k" type="tns:ListOfIntMax5k"/>
      <xsd:element name="aListOfFourIntMax500" type="tns:ListOfFourIntMax500"/>
      <xsd:element name="aListOfTwoIntMax3k" type="tns:ListOfTwoIntMax3k"/>

      <!-- 2.4 union simpleTypes -->
      <xsd:element name="aFont" type="tns:Font"/>
      <xsd:element name="anotherFont" type="tns:Font"/>

    </xsd:sequence>

    <xsd:attribute name="xID" type="xsd:ID" default="NMTOKENS.minLength" use="optional"/>
    <xsd:attribute name="xIDREF" type="xsd:IDREF" use="optional"/>
    <xsd:attribute name="xIDREFS" type="xsd:IDREFS" use="optional"/>
    <xsd:attribute name="xENTITY" type="xsd:ENTITY" use="optional"/>
    <xsd:attribute name="xENTITIES" type="xsd:ENTITIES" use="optional"/>
    <xsd:attribute name="xNMTOKEN" type="xsd:NMTOKEN" default="prohibited" use="optional"/>
    <xsd:attribute name="xNMTOKENS" type="xsd:NMTOKENS" default="optional prohibited required" use="optional"/>
    <xsd:attribute ref="tns:globalStringAttr" use="required"/>
    <xsd:attribute name="aNOTATION" type="tns:PictureNotationType"/>
    <xsd:attribute name="aNNI" type="tns:EnumNNI" use="required"/>
    <xsd:attribute name="anotherNNI" type="tns:EnumNNI" use="required"/>
    <xsd:attribute name="aCommonName" use="required">
      <xsd:simpleType>
        <xsd:restriction base='xsd:string'>
          <xsd:length value='5'/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:simpleType name="CelciusWaterTemp">
   <xsd:restriction base="xsd:decimal">
    <xsd:fractionDigits value="2"/>
    <xsd:minExclusive value="0.00"/>
    <xsd:maxExclusive value="100.00"/>
   </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="SKU">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{3}-[A-Z]{2}"/>
    </xsd:restriction>
  </xsd:simpleType>


  <xsd:simpleType name="DateTimeInARange">
   <xsd:restriction base="xsd:dateTime">
    <xsd:minInclusive value="2010-01-01T12:00:00Z"/>
    <xsd:maxInclusive value="2010-05-31T23:00:00Z"/>
   </xsd:restriction>
  </xsd:simpleType>
  
  <xsd:simpleType name="DateInARange">
   <xsd:restriction base="xsd:date">
    <xsd:minInclusive value="2010-01-01Z"/>
    <xsd:maxInclusive value="2010-01-31Z"/>
   </xsd:restriction>
  </xsd:simpleType>
  
  
  <xsd:simpleType name="YearInARange">
   <xsd:restriction base="xsd:gYear">
    <xsd:minExclusive value="2005"/>
    <xsd:maxInclusive value="2010"/>
   </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name='IntMax5k'>
    <xsd:restriction base='xsd:int'>
      <xsd:maxExclusive value='5000'/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name='ListOfIntMax5k'>
    <xsd:list itemType='tns:IntMax5k'/>
  </xsd:simpleType>

  <xsd:simpleType name='ListOfIntMax500'>
    <xsd:list>
      <xsd:simpleType>
        <xsd:restriction base='xsd:int'>
          <xsd:maxExclusive value='500'/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:list>  
  </xsd:simpleType>

  <xsd:simpleType name='ListOfFourIntMax500'>
    <xsd:restriction base='tns:ListOfIntMax500'>
      <xsd:maxLength value='4'/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name='ListOfIntMax3k'>
    <xsd:list>
      <xsd:simpleType>
        <xsd:restriction>
          <xsd:simpleType>
            <xsd:restriction base='tns:IntMax5k'>
              <xsd:maxExclusive value='4000'/>
            </xsd:restriction>
          </xsd:simpleType>
          <xsd:maxExclusive value='3000'/>
        </xsd:restriction>
      </xsd:simpleType>
    </xsd:list>  
  </xsd:simpleType>

  <xsd:simpleType name='ListOfTwoIntMax3k'>
    <xsd:restriction base='tns:ListOfIntMax3k'>
      <xsd:maxLength value='2'/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="Font">
    <xsd:union memberTypes="tns:Fontbynumber tns:Fontbystringname"/>
  </xsd:simpleType>

  <xsd:simpleType name="Fontbynumber">
    <xsd:restriction base="xsd:positiveInteger">
      <xsd:maxInclusive value="72"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="Fontbystringname">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="small"/>
      <xsd:enumeration value="medium"/>
      <xsd:enumeration value="large"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="EnumNNI">
    <xsd:union memberTypes="xsd:nonNegativeInteger">
     <xsd:simpleType>
      <xsd:restriction base="xsd:NMTOKEN">
       <xsd:enumeration value="unbounded"/>
      </xsd:restriction>
     </xsd:simpleType>
    </xsd:union>
  </xsd:simpleType>


  <xsd:notation name="jpeg" public="JPG"/>
  <xsd:notation name="gif" public="GIF"/>
  <xsd:simpleType name="PictureNotationType">
    <xsd:restriction base="xsd:NOTATION">
      <xsd:enumeration value="jpeg"/>
      <xsd:enumeration value="gif"/>
    </xsd:restriction>
  </xsd:simpleType>


</xsd:schema>


examples/simpleTypesDemo/nsaliases.xml

<nsaliases>
  <alias uri="http://www.example.com/STDemo" toUrn="urn:STDemo"/>
</nsaliases>


examples/simpleTypesDemo/valid.xml

<?xml version="1.0"?>
<ns1:myComplexTypeElem ns1:globalStringAttr="abc" ns1:aNNI="unbounded" ns1:anotherNNI="100" ns1:aCommonName="abcde" xmlns:ns1="http://www.example.com/STDemo">
  Here you will see some examples of simpleType elements

    Following are examples of -atomic- simpleType elements
  <ns1:xBoolean>false</ns1:xBoolean>
      <ns1:xDecimal>-1.23e-6</ns1:xDecimal>
  <ns1:xFloat>-1.23e-3</ns1:xFloat>
  <ns1:xDouble>-1.23e-5</ns1:xDouble>
  <ns1:xInteger>-12678967543233</ns1:xInteger>
  <ns1:xPositiveInteger>12678967543233</ns1:xPositiveInteger>
  <ns1:xNonPositiveInteger>-12678967543233</ns1:xNonPositiveInteger>
  <ns1:xNegativeInteger>-12678967543233</ns1:xNegativeInteger>
  <ns1:xNonNegativeInteger>12678967543233</ns1:xNonNegativeInteger>
  <ns1:xLong>-9223372036854775808</ns1:xLong>
  <ns1:xInt>-2147483648</ns1:xInt>
  <ns1:xShort>-32768</ns1:xShort>
  <ns1:xByte>-127</ns1:xByte>
  <ns1:xUnsignedLong>18446744073709551615</ns1:xUnsignedLong>
  <ns1:xUnsignedInt>4294967295</ns1:xUnsignedInt>
  <ns1:xUnsignedShort>65535</ns1:xUnsignedShort>
  <ns1:xUnsignedByte>255</ns1:xUnsignedByte>
  <ns1:xHexBinary>FEFF</ns1:xHexBinary>
  <ns1:xBase64Binary>ZXF+NAQF/d</ns1:xBase64Binary>
  <ns1:xUri>http://www.example.com/xmlplus</ns1:xUri>
  <ns1:xNormalizedString>no CR LF TAB</ns1:xNormalizedString>
  <ns1:xToken>xs:hexBinary</ns1:xToken>
  <ns1:xLanguage>english</ns1:xLanguage>
  <ns1:xName>:colonToken</ns1:xName>
  <ns1:xNCName>noColonToken</ns1:xNCName>
  <ns1:xQName>xsi:schemaLocation</ns1:xQName>
  <ns1:xDateTime>2001-07-04T14:50:59Z</ns1:xDateTime>
  <ns1:xDate>2010-01-04</ns1:xDate>
  <ns1:xYearMonth>1980-11</ns1:xYearMonth>
  <ns1:xYear>1978</ns1:xYear>
  <ns1:xMonthDay>12-30</ns1:xMonthDay>
  <ns1:xMonth>7</ns1:xMonth>
  <ns1:xDay>30</ns1:xDay>
  <ns1:xTime>14:59:57</ns1:xTime>
  <ns1:xDuration>P1Y2M3DT10H30M40S</ns1:xDuration>
  <ns1:anIntMax10>10</ns1:anIntMax10>
  <ns1:anIntMax10>10</ns1:anIntMax10>
  <ns1:anIntMax10>10</ns1:anIntMax10>
  <ns1:anIntMax5k>4999</ns1:anIntMax5k>
  <ns1:globalWaterTemp>30</ns1:globalWaterTemp>
  <ns1:aSKU>123-AB</ns1:aSKU>
  <ns1:aDateTime>2010-01-04T12:00:00Z</ns1:aDateTime>
  <ns1:aDate>2010-01-04</ns1:aDate>
  <ns1:aYear>2009</ns1:aYear>
  <ns1:aCommonName>abcde</ns1:aCommonName>
    End of -atomic- simpleType elements

    Following are examples of -list- simpleType elements
  <ns1:aListOfIntMax5k>0 1000 2000 3000 4000</ns1:aListOfIntMax5k>
  <ns1:aListOfFourIntMax500>100 200 300 400</ns1:aListOfFourIntMax500>
  <ns1:aListOfTwoIntMax3k>1000 2000</ns1:aListOfTwoIntMax3k>
    End of -list- simpleType elements

    Following are examples of -union- simpleType elements
  <ns1:aFont>medium</ns1:aFont>
  <ns1:anotherFont>72</ns1:anotherFont>
    End of -union- simpleType elements

  End of all example elements
</ns1:myComplexTypeElem>


examples/simpleTypesDemo/main.cpp

#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "STDemo/all-include.h"

void populateDocument(STDemo::Document* xsdDoc);
void updateOrConsumeDocument(STDemo::Document* xsdDoc);
  
void chooseDocumentElement(STDemo::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<STDemo::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  
  cbStruct.cbChooseDocumentElement    =  chooseDocumentElement;
  

  XSD::UserOps<STDemo::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(STDemo::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_myComplexTypeElem();
  
  //xsdDoc->set_root_globalWaterTemp();
    
}
    

// template function to populate the Tree with values
// write code to populate the Document here
void populateDocument(STDemo::Document* xsdDoc)
{
  //
  // Noteworthy Things:
  //
  // - aCommonName : both an element and an attribute share this name, please 
  //                 note the namespace/naming differences in generated classes
  //                 corresponding to these two 
  //
  // - many elements inside MyComplexType are not populated here, they would 
  //   show up in the xml with their default/fixed values
  //

  DOM::Node* markerNode = NULL;

  STDemo::myComplexTypeElem *rootElem = xsdDoc->element_myComplexTypeElem();
  
  // set attributes
  rootElem->set_attr_aCommonName("abcde");
  rootElem->set_attr_globalStringAttr("abc");
  rootElem->set_attr_aNNI("unbounded");
  rootElem->set_attr_anotherNNI("100");

  //  begin : atomic simpleType elements        
  rootElem->set_anIntMax10(0, 10);
  rootElem->set_anIntMax10(1, 10);
  rootElem->set_anIntMax10(2, 10);
  rootElem->set_anIntMax5k(4999);
  rootElem->set_aSKU("123-AB");
  rootElem->set_globalWaterTemp(30.00);
  rootElem->set_aDateTime("2010-01-04T12:00:00Z");
  // let default show up
  //rootElem->set_aDate("2009");
  rootElem->set_aYear(2009);
  rootElem->set_aCommonName("abcde");
  //  end : atomic simpleType elements

  //  begin : list simpleType elements        
  rootElem->set_aListOfIntMax5k("0 1000 2000 3000 4000");
  rootElem->set_aListOfFourIntMax500("100 200 300 400");
  rootElem->set_aListOfTwoIntMax3k("1000 2000");
  //  end : list simpleType elements

  
  //  begin : union simpleType elements        
  //rootElem->set_aNNI("unbounded");
  //rootElem->set_anotherNNI("100");


  rootElem->set_aFont("medium");
  rootElem->set_anotherFont("72");
  //  end : union simpleType elements

  // set some text nodes which also do the job of describing the element sections
  rootElem->setTextAmongChildrenAt("\nHere you will see some examples of simpleType elements", 0);
  rootElem->setTextAmongChildrenAt("\nFollowing are examples of -atomic- simpleType elements", 1);
  markerNode = rootElem->element_aCommonName();
  rootElem->setTextAfterNode("End of -atomic- simpleType elements\n  Following are examples of -list- simpleType elements", markerNode);
  markerNode = rootElem->element_aListOfTwoIntMax3k();
  rootElem->setTextAfterNode("End of -list- simpleType elements\n Following are examples of -union- simpleType elements", markerNode);
  rootElem->setTextEnd("End of -union- simpleType elements\nEnd of all example elements");

}

// write code to operate(update/consume/test etc.) on the Document, which is already
// populated(eg. read from an input xml file)
void updateOrConsumeDocument(STDemo::Document* xsdDoc)
{

}

  



examples/simplest


examples/simplest/simplest.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
  targetNamespace="http://www.example.com/simplest"
  elementFormDefault="qualified"
  >

  <xsd:element name="items">
    <xsd:complexType mixed="true">
      <xsd:sequence>
        <xsd:element name="item" type="xsd:string" minOccurs="0" maxOccurs="5"/>
      </xsd:sequence>
      <xsd:attribute name="id" type="xsd:string" default="102" use="optional"/>
    </xsd:complexType>
  </xsd:element>

</xsd:schema>



examples/simplest/nsaliases.xml

<nsaliases>
  <alias uri="http://www.example.com/simplest" toUrn="urn:simplest"/>
</nsaliases>


examples/simplest/valid.xml

<?xml version="1.0"?>
<ns1:items xmlns:ns1="http://www.example.com/simplest">
  text content1
  <ns1:item>one</ns1:item>
  text content2
  <ns1:item>two</ns1:item>
</ns1:items>


examples/simplest/main.cpp


#include <iostream>
#include <string>

extern "C" {
#include <getopt.h>
}
#include "simplest/all-include.h"

void populateDocument(simplest::Document xsdDoc);
void updateOrConsumeDocument(simplest::Document xsdDoc);
void writePopulatedDoc();
void writeSample();
void readUpdateWriteFile(string inFilePath);
void roundtripFile(string inFilePath);
void validateFile(string inFilePath);

void writePopulatedDoc()
{
  cout << "Going to populate Document and write xml file..." << endl;
  string outFile="t.xml";
  try 
  {
    simplest::Document xsdDoc(true);
    xsdDoc.prettyPrint(true);
    populateDocument(xsdDoc);
    ofstream ofs(outFile.c_str());
    ofs << xsdDoc;
    cout << "  => wrote file:" << outFile << " (using DOM Document)" 
      << endl << endl;

  }
  catch(XPlus::Exception& ex) {
    cerr << "  => write failed" << endl;
    cerr << endl << "{" << endl;
    cerr << ex.msg();
    cerr << endl << "}" << endl;
    exit(1);
  }
}

void writeSample()
{
  cout << "writeSample:" << endl;
  string outFile = "sample.xml";

  //write the Document back to a file
  simplest::Document xsdDoc(true);
  xsdDoc.prettyPrint(true);
  ofstream ofs(outFile.c_str());
  ofs << xsdDoc;
  cout << "  => wrote file:" << outFile << " (using DOM Document)" 
    << endl << endl;

}

void readUpdateWriteFile(string inFilePath)
{
  cout << "readUpdateWriteFile:" << inFilePath << endl;
  cout << "Going to: \n"
    << "  1) read input-xml-file\n"
    "  2) update the read Document with user-supplied function updateOrConsumeDocument()\n"
    "  3) write xml file..." 
    << endl << endl;
  string outFile = inFilePath+ ".row.xml";
  try 
  {
    //read the file into the Document
    ifstream is(inFilePath.c_str());
    simplest::Document xsdDoc(false);
    is >> xsdDoc; 

    xsdDoc.prettyPrint(true);
    updateOrConsumeDocument(xsdDoc);
    
    //write the Document back to a file
    ofstream ofs(outFile.c_str());
    ofs << xsdDoc;
    cout << "  => wrote file:" << outFile << " (using DOM Document)" 
    << endl << endl;
  }
  catch(XPlus::Exception& ex) {
    cerr << "  => write failed" << endl;
    cerr << endl << "{" << endl;
    cerr << ex.msg();
    cerr << endl << "}" << endl;
    exit(1);
  }
}

void roundtripFile(string inFilePath)
{
  cout << "Going to roundtrip file:" << inFilePath << endl;
  try 
  {
    //read the file into the Document
    ifstream is(inFilePath.c_str());
    simplest::Document xsdDoc(false);
    is >> xsdDoc; 

    //write the Document back to a file
    xsdDoc.prettyPrint(true);
    string outFile = inFilePath + ".rt.xml";
    ofstream ofs(outFile.c_str());
    ofs << xsdDoc;

    cout << "  => wrote file:" << outFile << " (using DOM Document)" 
      << endl << endl;
  }
  catch(XPlus::Exception& ex) {
    cerr << "Error:\n" << ex.msg() << endl;
    exit(1);
  }
}

void validateFile(string inFilePath)
{
  cout << "validating file:" << inFilePath << endl;
  // this is one way of validation:
  // when the Document is built from a xml-file, the file
  // does get validated. Any errors(exception) thrown, would
  // be reported in the catch block
  try
  {
    //read the file into the Document
    ifstream is(inFilePath.c_str());
    simplest::Document xsdDoc(false);
    is >> xsdDoc; 
  }
  catch(XPlus::Exception& ex)
  {
    ex.setContext("file", inFilePath);
    cerr << "  => validation failed" << endl;
    cerr << endl << "Error: {" << endl;
    cerr << ex.msg();
    cerr << endl << "}" << endl;
    exit(1);
  }
  catch(std::exception& ex) {
    cerr << " unknown error" << endl;
  }
  catch(...) {
    cerr << " unknown error" << endl;
  }
  cout << "  => validated successfully"
    << endl << endl;

}

void printHelp(string argv0)
{
  cout << "Usage: " << argv0 << " [options] XMLfiles ..." << endl;
  cout << "Options:" << endl;  
  cout << " -s, --sample\n"
    << "            create a schema-driven sample xml-file\n" 
    << endl;
  cout << " -w, --write\n"
    << "            write a xml-file using populated Document\n" 
    << "            Note: populateDocument() function in main.cpp template,\n"
    << "            must be used to populate the Document"
    << endl;
  cout << " -v, --validate\n"
    << "            validate input xml-file(against compiled schema)"
    << endl;
  cout << " -r, --roundtrip\n"
    << "            roundtrip (read->write) input xml-file"
    << endl;
  cout << " -u, --row\n"
    << "         perform read->update->write operations on input xml-file"
    << endl;
  cout << " -h, --help\n"
    << "         print help"
    << endl;
  cout << endl;
}


int main (int argc, char**argv)
{
  int c;

  /* Flag set by ‘--verbose’. */
  int verbose_flag=0;
  string inFile;

  while (1)
  {
    static struct option long_options[] =
    {
      /* These options set a flag. */
      {"verbose", no_argument,       &verbose_flag, 1},
      /* These options don't set a flag.
         We distinguish them by their indices. */
      {"help",   no_argument,        0, 'h'},
      {"sample",     no_argument,       0, 's'},
      {"write",      no_argument,       0, 'w'},
      {"validate",   required_argument, 0, 'v'},
      {"roundtrip",  required_argument, 0, 'r'},
      {"row",        required_argument, 0, 'u'},
      {0, 0, 0, 0}
    };
    /* getopt_long stores the option index here. */
    int option_index = 0;

    c = getopt_long (argc, argv, "hr:su:v:w",
        long_options, &option_index);

    /* Detect the end of the options. */
    if (c == -1)
      break;

    switch (c)
    {
      case 0:
        /* If this option set a flag, do nothing else now. */
        if (long_options[option_index].flag != 0)
          break;
        printf ("option %s", long_options[option_index].name);
        if (optarg)
          printf (" with arg %s", optarg);
        printf ("\n");
        break;

      case 'h':
        printHelp(argv[0]);
        break;

      case 's':
        writeSample();
        break;

      case 'w':
        writePopulatedDoc();
        break;

      case 'r':
        inFile = optarg;
        roundtripFile(inFile);
        break;

      case 'v':
        inFile = optarg;
        validateFile(inFile);
        break;

      case 'u':
        inFile = optarg;
        readUpdateWriteFile(inFile);
        break;

      case '?':
        /* getopt_long already printed an error message. */
        break;

      default:
        abort();
    }
  }

  if (verbose_flag) {
    //cout << "verbose flag is set" << endl;;
  }

  if (optind < argc)
  {
    cout << "Invalid arguments: " << endl;
    while (optind < argc)
      cout <<  argv[optind++] << " ";

    cout << endl;
    exit(1);
  }
}



//
// Following functions are templates.
// You need to put code in the context
//



// template function to populate the Tree with values
void populateDocument(simplest::Document xsdDoc)
{
  // write code to populate the Document here
  simplest::items *pItems = xsdDoc.element_items();
  pItems->setTextAmongChildrenAt("text content1", 0);

  if(1)
  {
    pItems->add_item_string("one");
    pItems->add_item_string("two");
  }
  else
  {
    XPlus::List<simplest::items::item_ptr>  list_items2 = pItems->set_count_item(2);
    list_items2.at(0)->stringValue("one");
    list_items2.at(1)->stringValue("two");
  }
  pItems->setTextAmongChildrenAt("text content2", 2);
}

void updateOrConsumeDocument(simplest::Document xsdDoc)
{
  // write code to update the populated-Document here
  simplest::items *pItems = xsdDoc.element_items();
  pItems->replaceTextAt("updated text content2", 1);
}










examples/ipo


examples/ipo/address.xsd

<schema targetNamespace="http://www.example.com/IPO"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:ipo="http://www.example.com/IPO">

  <annotation>
    <documentation xml:lang="en">
      Addresses for International Purchase order schema
      Copyright 2000 Example.com. All rights reserved.
    </documentation>
  </annotation>

  <complexType name="Address">
    <sequence>
      <element name="name"   type="string"/>
      <element name="street" type="string"/>
      <element name="city"   type="string"/>
    </sequence>
  </complexType>

  <complexType name="USAddress">
    <complexContent>
      <extension base="ipo:Address">
        <sequence>
          <element name="state" type="ipo:USState"/>
          <element name="zip"   type="positiveInteger"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>

  <simpleType name="USState">
    <restriction base="string">
      <enumeration value="AK"/>
      <enumeration value="AL"/>
      <enumeration value="AR"/>
      <enumeration value="PA"/>
      <!-- and so on ... -->
    </restriction>
  </simpleType>

  <complexType name="UKAddress">
    <complexContent>
      <extension base="ipo:Address">
        <sequence>
          <element name="postcode" type="ipo:UKPostcode"/>
        </sequence>
        <attribute name="exportCode" type="positiveInteger" fixed="1"/>
      </extension>
    </complexContent>
  </complexType>

  <simpleType name="UKPostcode">
    <restriction base="string">
    </restriction>
  </simpleType>

</schema>


examples/ipo/ipo.xsd

<schema targetNamespace="http://www.example.com/IPO"
        xmlns="http://www.w3.org/2001/XMLSchema"
        xmlns:ipo="http://www.example.com/IPO">

  <annotation>
    <documentation xml:lang="en">
      International Purchase order schema for Example.com
      Copyright 2000 Example.com. All rights reserved.
    </documentation>
  </annotation>

  <!-- include address constructs -->
  <include
    schemaLocation="address.xsd"/>

  <element name="purchaseOrder" type="ipo:PurchaseOrderType"/>

  <element name="comment" type="string"/>

  <complexType name="PurchaseOrderType">
    <sequence>
      <element name="shipTo"     type="ipo:Address"/>
      <element name="billTo"     type="ipo:Address"/>
      <element ref="ipo:comment" minOccurs="0"/>
      <element name="items"      type="ipo:Items"/>
    </sequence>
    <attribute name="orderDate" type="date"/>
  </complexType>

  <complexType name="Items">
    <sequence>
      <element name="item" minOccurs="0" maxOccurs="unbounded">
        <complexType>
          <sequence>
            <element name="productName" type="string"/>
            <element name="quantity">
              <simpleType>
                <restriction base="positiveInteger">
                  <maxExclusive value="100"/>
                </restriction>
              </simpleType>
            </element>
            <element name="USPrice"    type="decimal"/>
            <element ref="ipo:comment" minOccurs="0"/>
            <element name="shipDate"   type="date" minOccurs="0"/>
          </sequence>
          <attribute name="partNum" type="ipo:SKU" use="required"/>
        </complexType>
      </element>
    </sequence>
  </complexType>

  <simpleType name="SKU">
    <restriction base="string">
      <pattern value="\d{3}-[A-Z]{2}"/>
    </restriction>
  </simpleType>

</schema>


examples/ipo/ipo.xml

<?xml version="1.0"?>
<ipo:purchaseOrder
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ipo="http://www.example.com/IPO"
  orderDate="1999-12-01">

  <shipTo exportCode="1" xsi:type="ipo:UKAddress">
    <name>Helen Zoe</name>
    <street>47 Eden Street</street>
    <city>Cambridge</city>
    <postcode>CB1 1JR</postcode>
  </shipTo>

  <billTo xsi:type="ipo:USAddress">
    <name>Robert Smith</name>
    <street>8 Oak Avenue</street>
    <city>Old Town</city>
    <state>PA</state>
    <zip>95819</zip>
  </billTo>

  <items>
    <item partNum="833-AA">
      <productName>Lapis necklace</productName>
      <quantity>1</quantity>
      <USPrice>99.95</USPrice>
      <ipo:comment>Want this for the holidays</ipo:comment>
      <shipDate>1999-12-05</shipDate>
    </item>
  </items>
</ipo:purchaseOrder>


examples/ipo/nsaliases.xml

<nsaliases>
  <alias uri="http://www.example.com/IPO" toUrn="urn:IPO"/>
</nsaliases>


examples/ipo/valid2.xml

<?xml version="1.0"?>
<ipo:purchaseOrder
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ipo="http://www.example.com/IPO"
  orderDate="1999-12-01">

  <shipTo exportCode="1" xsi:type="ipo:UKAddress">
    <name>Helen Zoe</name>
    <street>47 Eden Street</street>
    <city>Cambridge</city>
    <postcode>CB1 1JR</postcode>
  </shipTo>

  <billTo xsi:type="ipo:USAddress">
    <name>Robert Smith</name>
    <street>8 Oak Avenue</street>
    <city>Old Town</city>
    <state>PA</state>
    <zip>95819</zip>
  </billTo>

  <items>
    <item partNum="833-AA">
      <productName>Lapis necklace</productName>
      <quantity>1</quantity>
      <USPrice>99.95</USPrice>
      <ipo:comment>Want this for the holidays</ipo:comment>
      <shipDate>1999-12-05</shipDate>
    </item>
  </items>
</ipo:purchaseOrder>


examples/ipo/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "XSD/TypeDefinitionFactory.h"
#include "IPO/all-include.h"

void populateDocument(IPO::Document* xsdDoc);
void updateOrConsumeDocument(IPO::Document* xsdDoc);
  
void chooseDocumentElement(IPO::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<IPO::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  cbStruct.cbChooseDocumentElement      =  chooseDocumentElement;

  XSD::UserOps<IPO::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(IPO::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_purchaseOrder();
  
  //xsdDoc->set_root_comment();
    
}
    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(IPO::Document* xsdDoc)
{

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(IPO::Document* xsdDoc)
{

}

  



examples/netEnabled


examples/netEnabled/netEnabled.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.w3.org/2002/ws/databinding/examples/6/05/"
  xmlns="http://www.w3.org/2002/ws/databinding/examples/6/05/"
  xmlns:ns1="http://www.w3.org/2002/ws/databinding/examples/6/05/"
  >

  <xsd:include schemaLocation="http://www.w3.org/2002/ws/databinding/examples/6/05/HexBinaryElement/echoHexBinaryElement.xsd"/>

  
  <xsd:element name="echo"> 
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="ns1:echoHexBinaryElement"/> 
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

</xsd:schema>


examples/netEnabled/echoHexBinaryElement-HexBinaryElement01.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2006 W3C (R) (MIT ERCIM Keio), All Rights Reserved.
    W3C liability, trademark and document use rules apply.

    http://www.w3.org/Consortium/Legal/ipr-notice
    http://www.w3.org/Consortium/Legal/copyright-documents

    $Header: /w3ccvs/WWW/2002/ws/databinding/examples/6/05/HexBinaryElement/echoHexBinaryElement-HexBinaryElement01.xml,v 1.1 2006/09/05 15:07:00 pdowney Exp $

-->
<ex:echoHexBinaryElement xmlns:ex="http://www.w3.org/2002/ws/databinding/examples/6/05/">
  <ex:hexBinaryElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">76</ex:hexBinaryElement>
</ex:echoHexBinaryElement>


examples/netEnabled/echoHexBinaryElement-HexBinaryElement02.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2006 W3C (R) (MIT ERCIM Keio), All Rights Reserved.
    W3C liability, trademark and document use rules apply.

    http://www.w3.org/Consortium/Legal/ipr-notice
    http://www.w3.org/Consortium/Legal/copyright-documents

    $Header: /w3ccvs/WWW/2002/ws/databinding/examples/6/05/HexBinaryElement/echoHexBinaryElement-HexBinaryElement02.xml,v 1.1 2006/09/05 15:07:00 pdowney Exp $

-->
<ex:echoHexBinaryElement xmlns:ex="http://www.w3.org/2002/ws/databinding/examples/6/05/">
  <ex:hexBinaryElement xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">77696f646d6f6e7974637174716a7169696e6b65616f76786f746e66716b707875757261736e686469796b65706c656d7465626661637661646e6b65636662647669726d6f6e757361</ex:hexBinaryElement>
</ex:echoHexBinaryElement>


examples/netEnabled/nsaliases.xml

<nsaliases>
  <alias uri="http://www.w3.org/2002/ws/databinding/examples/6/05/" toUrn="urn:examples_6_05"/>
</nsaliases>


examples/netEnabled/valid.xml

<?xml version="1.0"?>
<ns1:echo xmlns:ns1="http://www.w3.org/2002/ws/databinding/examples/6/05/">
  <ns1:echoHexBinaryElement>
    <ns1:hexBinaryElement>77696f646d6f6e7974637174716a7169696e6b65616f76786f746e66716b707875757261736e686469796b65706c656d7465626661637661646e6b65636662647669726d6f6e757361</ns1:hexBinaryElement>
  </ns1:echoHexBinaryElement>
</ns1:echo>


examples/netEnabled/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "examples_6_05/all-include.h"

void populateDocument(examples_6_05::Document* xsdDoc);
void updateOrConsumeDocument(examples_6_05::Document* xsdDoc);
  
void chooseDocumentElement(examples_6_05::Document* xsdDoc);
    

int main (int argc, char** argv)
{
  XSD::UserOps<examples_6_05::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  cbStruct.cbChooseDocumentElement      =  chooseDocumentElement;

  XSD::UserOps<examples_6_05::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(examples_6_05::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_echo();
  
  //xsdDoc->set_root_hexBinaryElement();
    
  //xsdDoc->set_root_echoHexBinaryElement();
      
}
    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(examples_6_05::Document* xsdDoc)
{
  xsdDoc->element_echo()->element_echoHexBinaryElement()->set_hexBinaryElement("77696f646d6f6e7974637174716a7169696e6b65616f76786f746e66716b707875757261736e686469796b65706c656d7465626661637661646e6b65636662647669726d6f6e757361");
}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(examples_6_05::Document* xsdDoc)
{

}

  



examples/po


examples/po/po.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  >

  <xsd:annotation>
    <xsd:documentation xml:lang="en">
     Purchase order schema for Example.com.
     Copyright 2000 Example.com. All rights reserved.
    </xsd:documentation>
  </xsd:annotation>

  <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>

  <xsd:element name="comment" type="xsd:string"/>

  <xsd:complexType name="PurchaseOrderType">
    <xsd:sequence>
      <xsd:element name="shipTo" type="USAddress"/>
      <xsd:element name="billTo" type="USAddress"/>
      <xsd:element ref="comment" minOccurs="0"/>
      <xsd:element name="items"  type="Items"/>
    </xsd:sequence>
    <xsd:attribute name="orderDate" type="xsd:date"/>
  </xsd:complexType>

  <xsd:complexType name="USAddress">
    <xsd:sequence>
      <xsd:element name="name"   type="xsd:string"/>
      <xsd:element name="street" type="xsd:string"/>
      <xsd:element name="city"   type="xsd:string"/>
      <xsd:element name="state"  type="xsd:string"/>
      <xsd:element name="zip"    type="xsd:decimal"/>
    </xsd:sequence>
    <xsd:attribute name="country" type="xsd:NMTOKEN"
                   fixed="US"/>
  </xsd:complexType>

  <xsd:complexType name="Items">
    <xsd:sequence>
      <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="productName" type="xsd:string"/>
            <xsd:element name="quantity">
              <xsd:simpleType>
                <xsd:restriction base="xsd:positiveInteger">
                  <xsd:maxExclusive value="100"/>
                </xsd:restriction>
              </xsd:simpleType>
            </xsd:element>
            <xsd:element name="USPrice"  type="xsd:decimal"/>
            <xsd:element ref="comment"   minOccurs="0"/>
            <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
          </xsd:sequence>
          <xsd:attribute name="partNum" type="SKU" use="required"/>
        </xsd:complexType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>

  <!-- Stock Keeping Unit, a code for identifying products -->
  <xsd:simpleType name="SKU">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d{3}-[A-Z]{2}"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>



examples/po/valid.xml

<?xml version="1.0"?>
<purchaseOrder orderDate="1999-10-20">
  <shipTo country="US">
    <name>Alice Smith</name>
    <street>123 Maple Street</street>
    <city>Mill Valley</city>
    <state>CA</state>
    <zip>90952</zip>
  </shipTo>
  <billTo country="US">
    <name>Robert Smith</name>
    <street>8 Oak Avenue</street>
    <city>Old Town</city>
    <state>PA</state>
    <zip>95819</zip>
  </billTo>
  <comment>Hurry, my lawn is going wild!</comment>
  <items>
    <item partNum="872-AA">
      <productName>Lawnmower</productName>
      <quantity>1</quantity>
      <USPrice>148.95</USPrice>
      <comment>Confirm this is electric</comment>
    </item>
    <item partNum="926-AA">
      <productName>Baby Monitor</productName>
      <quantity>1</quantity>
      <USPrice>39.98</USPrice>
      <shipDate>1999-05-21</shipDate>
    </item>
  </items>
</purchaseOrder>


examples/po/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
  
void chooseDocumentElement(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  
  cbStruct.cbChooseDocumentElement    =  chooseDocumentElement;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

  
// choose the element inside Document that you want as root using
// a call like : xsdDoc->set_root_xyz();
void chooseDocumentElement(NoNS::Document* xsdDoc)
{
  // uncomment one of folowing to choose root
  
  xsdDoc->set_root_purchaseOrder();
  
  //xsdDoc->set_root_comment();
    
}
    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{
  NoNS::purchaseOrder* pPO = xsdDoc->element_purchaseOrder();
  pPO->set_attr_orderDate("1999-10-20");

  NoNS::purchaseOrder::shipTo* pShipTo = pPO->element_shipTo();
  pShipTo->set_name("Alice Smith");
  pShipTo->set_street("123 Maple Street");
  pShipTo->set_city("Mill Valley");
  pShipTo->set_state("CA");
  pShipTo->set_zip("90952");

  NoNS::purchaseOrder::shipTo* pBillTo = pPO->element_billTo();
  pBillTo->set_name("Robert Smith");
  pBillTo->set_street("8 Oak Avenue");
  pBillTo->set_city("Old Town");
  pBillTo->set_state("PA");
  pBillTo->set_zip("95819");

  pPO->set_comment("Hurry, my lawn is going wild!");

  pPO->element_items()->set_count_item(2);
  NoNS::Types::Items::item* pItem = NULL;

  pItem = pPO->element_items()->element_item_at(0);
  pItem->set_attr_partNum("872-AA");
  pItem->set_productName("Lawnmower");
  pItem->set_quantity(1);
  pItem->set_USPrice(148.95);
  pItem->set_comment("Confirm this is electric");

  pItem = pPO->element_items()->element_item_at(1);
  pItem->set_attr_partNum("926-AA");
  pItem->set_productName("Baby Monitor");
  pItem->set_quantity(1);
  pItem->set_USPrice(39.98);
  pItem->set_shipDate("1999-05-21");

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/helloWorldWide


examples/helloWorldWide/helloWorldWide.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
 <xsd:element name="msg" type="MsgChars"/>

  <xsd:simpleType name="MsgChars">
    <xsd:restriction base='xsd:string'>
      <xsd:length value='11'/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>



examples/helloWorldWide/valid.xml

<?xml version="1.0" encoding="UTF-8"?>
<msg>Hellø Wø®l∂</msg>


examples/helloWorldWide/main.cpp

#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here
void populateDocument(NoNS::Document* xsdDoc)
{
  xsdDoc->encoding(TextEncoding::UTF_8);
  xsdDoc->element_msg()->stringValue("Hellø Wø®l∂");
}

// write code to operate(update/consume/test etc.) on the Document, which is already
// populated(eg. read from an input xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/rss


examples/rss/main.cpp


 //
 //  This file was automatically generated using XmlPlus xsd2cpp tool.
 //  On subsequent "xsd2cpp" invocations, this file would not be overwritten.
 //  You can edit this file.
 //
  
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char** argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here ...
void populateDocument(NoNS::Document* xsdDoc)
{

}

// write code to operate(update/consume/test etc.) on the Document here...
// This Document is typically already populated(eg. read from an input
// xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}

  



examples/includeDemo


examples/includeDemo/files.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:complexType name="Files">
    <xsd:sequence>
      <xsd:element name="fileName" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

   <xsd:complexType name="Directory">
    <xsd:sequence>
      <xsd:element name="path"  type="xsd:string" />
      <xsd:element name="files" type="Files"/>
    </xsd:sequence>
    <xsd:attribute name="numberOfFiles" type="xsd:int" />
  </xsd:complexType>

</xsd:schema>


examples/includeDemo/includeDemo.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:include schemaLocation="files.xsd"/>

  <xsd:element name="myProject">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="description" type="xsd:string" />
        <xsd:element name="directory" type="Directory"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>  
    
  
</xsd:schema>



examples/includeDemo/simplest.xml

<?xml version="1.0" ?>
<items>
  
 text content1   
  <item>one</item>
  
 text content2   
  <item>two</item>
</items>


examples/includeDemo/valid.xml

<?xml version="1.0"?>
<myProject>
  <description>my summer project and it's contents in a directory</description>
  <directory numberOfFiles="3">
    <path>/home/gilbert/summer_projects/project1/</path>
    <files>
      <fileName>a.xml</fileName>
      <fileName>b.xml</fileName>
      <fileName>c.xml</fileName>
    </files>
  </directory>
</myProject>


examples/includeDemo/main.cpp

#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

void populateDocument(NoNS::Document* xsdDoc);
void updateOrConsumeDocument(NoNS::Document* xsdDoc);
    

int main (int argc, char**argv)
{
  XSD::UserOps<NoNS::Document>::UserOpsCbStruct cbStruct;
  cbStruct.cbPopulateDocument           =  populateDocument;
  cbStruct.cbUpdateOrConsumeDocument    =  updateOrConsumeDocument;
  

  XSD::UserOps<NoNS::Document> opHandle(cbStruct);
  opHandle.run(argc, argv);
}

//
// Following functions are use case templates.
// You need to put "code" in the respective contexts.
//

    

// template function to populate the Tree with values
// write code to populate the Document here
void populateDocument(NoNS::Document* xsdDoc)
{
  NoNS::myProject* pMyProj = xsdDoc->element_myProject();
  
  pMyProj->element_description()->stringValue("my summer project and it's contents in a directory");

  NoNS::myProject::directory_p pDir = pMyProj->element_directory();
  pDir->element_path()->stringValue("/home/gilbert/summer_projects/project1/");
  
  pDir->mark_present_attr_numberOfFiles();
  pDir->attribute_attr_numberOfFiles()->stringValue("3");

  List<NoNS::myProject::directory::files::fileName_ptr> fileNames = pMyProj->element_directory()->element_files()->set_count_fileName(3);
  fileNames.at(0)->stringValue("a.xml");
  fileNames.at(1)->stringValue("b.xml");
  fileNames.at(2)->stringValue("c.xml");
}

// write code to operate(update/consume/test etc.) on the Document, which is already
// populated(eg. read from an input xml file)
void updateOrConsumeDocument(NoNS::Document* xsdDoc)
{

}