get xml schema of current node? - InfoPath Dev
in

InfoPath Dev

get xml schema of current node?

Last post 09-25-2011 10:41 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-25-2011 07:27 AM

    get xml schema of current node?

    Hi, I'm writing C# managed code and I would like a loop to traverse a repeating table, checking for three conditions of fields: 1) cannot be blank 2) Read only 3)can be blank Is there any way that my code can check the underlying xml schmea, to check, for instance if, a node is"RequiredString" for cannot be blank? THere's got to be, just not sure how! THANKS!
  • 09-25-2011 10:41 AM In reply to

    Re: get xml schema of current node?

    Assuming you're using the 2007 OM, you can use this code to get an XmlDocument containing the form's schema:

    XmlDocument doc = new XmlDocument();
    doc.Load(Template.OpenFileFromPackage(
    "myschema.xsd"));

     once you've got that, you can search it using the XPath //xsd:element[@name = 'fieldName'] to find the definition for a given field.  It could require some tricky handling depending on the fields' datatypes and whether they have their own attributes, but it should be possible.

     Best of luck!

     

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.