[xsd-users] RE: xsd-users Digest, Vol 77, Issue 2
Matt Royal
masyukun at gmail.com
Fri Nov 4 20:55:34 EDT 2011
unsubscribe
--Matthew
-------- Original message --------
Subject: xsd-users Digest, Vol 77, Issue 2
From: xsd-users-request at codesynthesis.com
To: xsd-users at codesynthesis.com
CC:
Send xsd-users mailing list submissions to
xsd-users at codesynthesis.com
To subscribe or unsubscribe via the World Wide Web, visit
http://codesynthesis.com/mailman/listinfo/xsd-users
or, via email, send a message with subject or body 'help' to
xsd-users-request at codesynthesis.com
You can reach the person managing the list at
xsd-users-owner at codesynthesis.com
When replying, please edit your Subject line so it is more specific
than "Re: Contents of xsd-users digest..."
Today's Topics:
1. Help needed - codesynthesis on HP-UX 11.31 with aC++ using
xsd:choice (Bhave, Abhay V)
2. Re: Help needed - codesynthesis on HP-UX 11.31 with aC++
using xsd:choice (Boris Kolpackov)
----------------------------------------------------------------------
Message: 1
Date: Thu, 3 Nov 2011 18:57:04 -0400
From: "Bhave, Abhay V" <abhave at telcordia.com>
Subject: [xsd-users] Help needed - codesynthesis on HP-UX 11.31 with
aC++ using xsd:choice
To: "'xsd-users at codesynthesis.com'" <xsd-users at codesynthesis.com>
Message-ID:
<90386C62D037DB46A02FEF929FB183702835C1C8AC at rrc-dte-exmb2.dte.telcordia.com>
Content-Type: text/plain; charset="us-ascii"
HP-UX B.11.31 U ia64
Generated hxx and cxx files from my XSDs.
I need help trying to parse a given XML.
The XSD is like below
------
<xsd:element name = "GetDetailsResp" type = "GetDetailsResp" />
<xsd:complexType name = "GetDetailsResp" >
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1" >
<xsd:element name = "Work" type = "GetJobWork" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WSFaults" type = "force:WSFaults" minOccurs="1" maxOccurs="1" >
</xsd:element>
</xsd:choice>
</xsd:sequence>
<xsd:attribute name="version" type="xsd:string" use="optional"/>
</xsd:complexType>
-----
<xsd:element name = "GetJobWork" type = "GetJobWork" />
<xsd:complexType name = "GetJobWork" >
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1" >
<xsd:element name = "WorkForLMOS" type = "WorkForLMOS" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForWFAC" type = "WorkForWFAC" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForWFACTIRKS" type = "WorkForWFACTIRKS" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForTIRKS" type = "WorkForTIRKS" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForTTM" type = "WorkForTTM" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForPROV" type = "WorkForProvisioning" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForGUI" type = "WorkForGUI" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForRWG" type = "WorkForRWG" minOccurs="1" maxOccurs="1" >
</xsd:element>
<xsd:element name = "WorkForFOMS" type = "WorkForFOMS" minOccurs="1" maxOccurs="1" >
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
---
Using the document and example as a guide my code like below
auto_ptr<Job::v1::GetDetailsResp> getDetailsRespPtr(0);
getDetailsRespPtr = Job::v1::GetDetailsResp_(argv[1], flags::dont_validate);
( getDetailsRespPtr.get())->Work();
Question: how do I figure out the type of Work?
Any help is appreciated.
Abhay
------------------------------
Message: 2
Date: Fri, 4 Nov 2011 15:34:39 +0200
From: Boris Kolpackov <boris at codesynthesis.com>
Subject: Re: [xsd-users] Help needed - codesynthesis on HP-UX 11.31
with aC++ using xsd:choice
To: "Bhave, Abhay V" <abhave at telcordia.com>
Cc: "'xsd-users at codesynthesis.com'" <xsd-users at codesynthesis.com>
Message-ID: <boris.20111104152604 at codesynthesis.com>
Content-Type: text/plain; charset=us-ascii
Hi Abhay,
Bhave, Abhay V <abhave at telcordia.com> writes:
> <xsd:complexType name = "GetDetailsResp" >
> <xsd:sequence>
> <xsd:choice minOccurs="1" maxOccurs="1" >
> <xsd:element name = "Work" type = "GetJobWork" minOccurs="1" maxOccurs="1" >
>
> [...]
>
> <xsd:complexType name = "GetJobWork" >
> <xsd:sequence>
> [...]
> </xsd:sequence>
> </xsd:complexType>
>
> Using the document and example as a guide my code like below
>
> auto_ptr<Job::v1::GetDetailsResp> getDetailsRespPtr(0);
> getDetailsRespPtr = Job::v1::GetDetailsResp_(argv[1], flags::dont_validate);
> ( getDetailsRespPtr.get())->Work();
>
> Question: how do I figure out the type of Work?
I am not sure I understand your question. From the schema you can
see that the Work element is of the GetJobWork type. So there will
be a C++ class Job::v1::GetJobWork.
Also note that in your schema the Work element is inside a choice
compositor. In the C++/Tree mapping this means that the resulting
C++ member will be of the "optional" cardinality. To access such
an element you would need to write something like this:
if (getDetailsRespPtr->Work ().present ())
{
Job::v1::GetJobWork& w (getDetailsRespPtr->Work ().get ());
}
For more information on different member cardinalities and how to
access them, please read the first two sections in Chapter 4,
"Working with Object Models" in the C++/Tree Mapping Getting
Started Guide:
http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#4
Boris
------------------------------
_______________________________________________
xsd-users mailing list
xsd-users at codesynthesis.com
http://codesynthesis.com/mailman/listinfo/xsd-users
End of xsd-users Digest, Vol 77, Issue 2
****************************************
More information about the xsd-users
mailing list