blob: 8c2abfe64158c2b61aa160fe576ee54810f15370 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<LINK type="text/css" rel="stylesheet" href="http://incubator.apache.org/tuscany/stylesheets/default.css">
<LINK rel="SHORTCUT ICON" href="http://cwiki.apache.org/confluence/display/TUSCANY/$images/favicon.ico">
<TITLE>Tuscany SDO CPP - FAQ : Apache Tuscany</TITLE>
<META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
<BODY onload="init()">
<TABLE valign="top" border="0" cellspacing="0" cellpadding="0" width="100%" background="http://incubator.apache.org/tuscany/images/TuscanyLogoNEW_Text_120px_bg.jpg">
<TR>
<TD valing="top" align="left">
<A href="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=TUSCANY&title=$siteroot"><IMG src="http://incubator.apache.org/tuscany/images/TuscanyLogoNEW_Text_120px_bg.jpg" height="91" width="25" border="0"></A>
</TD>
<TD>
<A href="http://incubator.apache.org/tuscany/"><IMG src="http://incubator.apache.org/tuscany/images/TuscanyLogo.jpg" border="0"></A>
</TD>
<TD width="100%">
</TD>
<TD align="right">
<IMG src="http://incubator.apache.org/tuscany/images/apache-incubator-logo.png" border="0">
</TD>
<!-- Adds the edit page link to the top banner-->
<TD valign="bottom">
<DIV style="padding: 2px 10px; margin: 0px;">
<A href="http://cwiki.apache.org/confluence/pages/editpage.action?pageId=35043">
<IMG src="http://incubator.apache.org/tuscany/images/notep_16.gif" height="16" width="16" border="0" align="absmiddle" title="Edit Page"></A>
</DIV>
</TD>
</TR>
</TABLE>
<TABLE border="0" cellpadding="2" cellspacing="0" width="100%">
<TR class="topBar">
<TD align="left" valign="middle" class="topBarDiv" nowrap="true" width="100%">
<A href="home.html" title="Apache Tuscany">Apache Tuscany</A> > <A href="home.html" title="Home">Home</A> > <A href="sdo-overview.html" title="SDO Overview">SDO Overview</A> > <A href="sdo-cpp.html" title="SDO CPP">SDO CPP</A> > <A href="" title="Tuscany SDO CPP - FAQ">Tuscany SDO CPP - FAQ</A>
</TD>
<TD align="left" valign="middle" class="topBarDiv" nowrap="true">
<A href="http://mail-archives.apache.org/mod_mbox/ws-tuscany-user">User List</A> | <A href="http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev">Dev List</A> | <A href="http://issues.apache.org/jira/browse/Tuscany">Issue Tracker</A>
</TD>
</TR>
</TABLE>
<TABLE border="0" cellpadding="0" width="100%" bgcolor="#FFFFFF">
<TR>
<TD align="left" valign="top">
<DIV id="PageContent">
<DIV class="pagecontent">
<DIV class="wiki-content">
<H3><A name="TuscanySDOCPP-FAQ-TuscanySDOFrequentlyAskedQuestions"></A>Tuscany SDO - Frequently Asked Questions</H3>
<OL>
<LI><B>Does SDO for C++ provide a static interface as the Java implementation does?</B><BR>
No. It is not clear that this is a useful feature in a language like C++ so we have no plans to implement it.</LI>
<LI><B>How do I load an XML file using SDO static type?</B><BR>
The basic pattern is fairly simple.
<DIV class="preformatted"><DIV class="preformattedContent">
<PRE> // Get hold of a helper context. This holds an XMLHelper instance
HelperContext scope = SDOUtil.createHelperContext();
// Register all of the types we have generated into the HelperContext
GenerateFactory.INSTANCE.register(scope);
// A normal input stream to read the XML file
fis = new FileInputStream("some.xml");
// Use the HelperContext to get and XMLHelper and use this to load the XML
XMLDocument xmlDoc = scope.getXMLHelper().load(fis);
// Now we have a document we can get the root object and cast it to the expected type
GenerateType generateType = (GenerateType)xmlDoc.getRootObject();
</PRE>
</DIV></DIV>
<P>There are some unit tests that show how to do this. You have to look in the tools tests cases as the Java static generator is in the tools project. Try looking in sdo\tools\src\test\java\org\apache\tuscany\sdo\test*.java. </P></LI>
</OL>
</DIV>
</DIV>
</DIV>
</TD>
</TR>
</TABLE>
<SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</SCRIPT>
<SCRIPT type="text/javascript">
_uacct = "UA-1174707-5";
urchinTracker();
</SCRIPT>
<DIV class="footer">
Copyright © 2003-2007, The Apache Software Foundation
</DIV>
</BODY>
</HTML>
|