Data Type? - InfoPath Dev
in

InfoPath Dev

Data Type?

Last post 03-13-2006 11:30 PM by potpourri. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 04-17-2005 06:18 PM

    Data Type?

    Currently i'm using <node>.dataType method to extract the data type.
    But strangely this only either "string" or "null".
    So it will regard image, date/time and rich XHTML as "null" data type.

    Does anyone know how to grab the precise data type of a control?
  • 04-19-2005 01:45 PM In reply to

    Only way that I found was to load the XML schema into a IXMLDOMDocument and check for the datatype of a specific node by querying the xml document with "selectSingleNode" method.

    IXMLDOMDocument xd = thisXDocument.CreateDOM();
    xd.load("myschema.xsd");
    string type = xd.selectSingleNode(<xpath>).text;

    This is not the best way but this is the only solution that I can think of.

    Agni
    InfopathDev India
  • 03-13-2006 11:30 PM In reply to

    hi again Agni,
    I kept forgetting to post this back :p

    If this is a snippet of my myschema.xsd file:

    <xsd:element name="grossEstimationItem">
    <xsd:complexType>
    <xsd:sequence/>
    <xsd:attribute ref="my:hourly_rate"/>
    <xsd:attribute ref="my:hours"/>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="Gross_Est_Cost" nillable="true" type="xsd:double"/>

    and in my code, i've defined the namespace to be:

    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-03-04T02:16:49" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsd="http://www.w3.org/2001/XMLSchema"');


    And later on, when I tried retrieve each node data type using:
    var schemaDOM = XDocument.CreateDOM();
    schemaDOM.load("myschema.xsd");
    var type = schemaDOM.selectSingleNode("xsd:"+fieldname).text;

    It would issue an error msg of:
    "Reference to undeclared namespace prefix: 'xsd'."


    Do you have any idea why trigger the error msg? I think I've declared the 'xsd' namespace correct, havent I?

Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.