EDN Admin
Well-known member
I am using Visual C++ 2005 and want to read typed data from a xml-file. In the XmlReader Class there is a function called "<span class=identifier>ReadElementContentAs" and in the documentation the function looks like this: <span class=identifier><pre><span class=keyword>public:
<span class=keyword>virtual Object^ <span class=identifier>ReadElementContentAs (
Type^ <span class=parameter>returnType,
<a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font color="#800080 IXmlNamespaceResolver</font></u> ^ <span class=parameter>namespaceResolver
)[/code]<pre><font face="Geneva, Arial, Sans-serif I am a little bit confused about what i am going to replace
"</font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font face="Geneva, Arial, Sans-serif" color="#800080 IXmlNamespaceResolver</font></u> <font face="Geneva, Arial, Sans-serif ^ </font><span class=parameter><font face="Geneva, Arial, Sans-serif namespaceResolver" with in my function-call??
My code looks like this:</font>[/code]<pre><span class=parameter> [/code]<pre><span class=parameter><font color="#008000" size=2> // creating schemaset-object </font><font size=2> XmlSchemaSet^ sSet = </font><font color="#0000ff" size=2>gcnew</font><font size=2> XmlSchemaSet;</font> <font size=2> </font><font color="#008000" size=2>// adding schema to set </font><font size=2> sSet->Add(</font><font color="#800000" size=2>"myNamespace"</font><font size=2>, "myschema.xsd"</font><font size=2>);</font> <font size=2> </font><font color="#008000" size=2>// set validating-settings </font><font size=2> XmlReaderSettings^ rSettings = </font><font color="#0000ff" size=2>gcnew</font><font size=2> XmlReaderSettings;</font><font size=2> rSettings->ValidationType = ValidationType::Schema; rSettings->Schemas = sSet; </font><font size=2> </font><font color="#008000" size=2>// creating XmlReader-object </font><font size=2> XmlReader^ reader = XmlReader::Create(</font><font color="#0000ff" size=2>"myXmlFile.xml"</font><font size=2>, rSettings);</font> <font size=2></font> <font size=2>//some code...</font> this is where I get confused about how to call the function in a right way. Here is what I want to
do but the question marks are the issue here... what am I going to put there instead
of them?? <font size=2> UInt32 myUInt = reader->ReadElementContentAs(UInt32::</font><font color="#0000ff" size=2>typeid</font><font size=2>, ????????? </font><font size=2>);</font> <font size=2></font> <font size=2></font> <font size=2>The reference says:</font> <font size=2></font> <font size=2><dt><font color="#0000ff <span class=parameter>namespaceResolver
An </font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font color="#0000ff IXmlNamespaceResolver</font></u> <font color="#0000ff object that is used to resolve any
namespace prefixes related to type conversion.</font><dt><font color="#0000ff </font></font>
<font face="Geneva, Arial, Sans-serif Where do I get this </font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font face="Geneva, Arial, Sans-serif" color="#0000ff" size=2>IXmlNamespaceResolver</font></u> <font color="#0000ff" size=2><font face="Geneva, Arial, Sans-serif object</font><font face="Geneva, Arial, Sans-serif" color="#000000 ?? I have been looking
in the reference a lot, but I can not find any examples or answers for
my questions! So please help me get clarity...</font></font></dt>[/code]
View the full article
<span class=keyword>virtual Object^ <span class=identifier>ReadElementContentAs (
Type^ <span class=parameter>returnType,
<a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font color="#800080 IXmlNamespaceResolver</font></u> ^ <span class=parameter>namespaceResolver
)[/code]<pre><font face="Geneva, Arial, Sans-serif I am a little bit confused about what i am going to replace
"</font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font face="Geneva, Arial, Sans-serif" color="#800080 IXmlNamespaceResolver</font></u> <font face="Geneva, Arial, Sans-serif ^ </font><span class=parameter><font face="Geneva, Arial, Sans-serif namespaceResolver" with in my function-call??
My code looks like this:</font>[/code]<pre><span class=parameter> [/code]<pre><span class=parameter><font color="#008000" size=2> // creating schemaset-object </font><font size=2> XmlSchemaSet^ sSet = </font><font color="#0000ff" size=2>gcnew</font><font size=2> XmlSchemaSet;</font> <font size=2> </font><font color="#008000" size=2>// adding schema to set </font><font size=2> sSet->Add(</font><font color="#800000" size=2>"myNamespace"</font><font size=2>, "myschema.xsd"</font><font size=2>);</font> <font size=2> </font><font color="#008000" size=2>// set validating-settings </font><font size=2> XmlReaderSettings^ rSettings = </font><font color="#0000ff" size=2>gcnew</font><font size=2> XmlReaderSettings;</font><font size=2> rSettings->ValidationType = ValidationType::Schema; rSettings->Schemas = sSet; </font><font size=2> </font><font color="#008000" size=2>// creating XmlReader-object </font><font size=2> XmlReader^ reader = XmlReader::Create(</font><font color="#0000ff" size=2>"myXmlFile.xml"</font><font size=2>, rSettings);</font> <font size=2></font> <font size=2>//some code...</font> this is where I get confused about how to call the function in a right way. Here is what I want to
do but the question marks are the issue here... what am I going to put there instead
of them?? <font size=2> UInt32 myUInt = reader->ReadElementContentAs(UInt32::</font><font color="#0000ff" size=2>typeid</font><font size=2>, ????????? </font><font size=2>);</font> <font size=2></font> <font size=2></font> <font size=2>The reference says:</font> <font size=2></font> <font size=2><dt><font color="#0000ff <span class=parameter>namespaceResolver
An </font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font color="#0000ff IXmlNamespaceResolver</font></u> <font color="#0000ff object that is used to resolve any
namespace prefixes related to type conversion.</font><dt><font color="#0000ff </font></font>
<font face="Geneva, Arial, Sans-serif Where do I get this </font><a title="ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref19/html/T_System_Xml_IXmlNamespaceResolver.htm <u><font face="Geneva, Arial, Sans-serif" color="#0000ff" size=2>IXmlNamespaceResolver</font></u> <font color="#0000ff" size=2><font face="Geneva, Arial, Sans-serif object</font><font face="Geneva, Arial, Sans-serif" color="#000000 ?? I have been looking
in the reference a lot, but I can not find any examples or answers for
my questions! So please help me get clarity...</font></font></dt>[/code]
View the full article