Can not reach a node - InfoPath Dev
in

InfoPath Dev

Can not reach a node

Last post 11-14-2006 10:29 AM by Shiva. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 11-10-2006 06:29 AM

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37

    Can not reach a node

    Hello,
    i have a form from my designer, Primary datasource looks like this:
    -myFields
    |-queryFields
    |-dataFields
    |-my:test
    (this is my text filed)
    and i can not, get to this, i tried:
    IXMLDOMNode test=thisXDocument.DOM.selectSingleNode("my:myFields/my:test");
    IXMLDOMNode test=thisXDocument.DOM.selectSingleNode("myFields/test");
    and so on... When i use fake namespaces, it creates an error.
    When my code is in: 'blablabla=test.text' i get
    'Object reference not set to an instance of an object'.
    What is going on in here?
  • 11-10-2006 10:04 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694
    Hi mar,

    Can you try once this Xpath, Your Xpath should be like “/my:myFields/my:test”.
    If above Xpath also doesn#%92t work then you need to set the property of your DOM by using below code:

    thisXDocument.DOM.setProperty( "SelectionNamespaces", "Namespace of your DOM");

    After this you can try to get the node. And you need to check your Xpath once again.
  • 11-10-2006 11:02 AM In reply to

    Hi Shiva,

    This did not work for me. Is XDocument the name of the file? Maybe that is why it's not working? Can I send you the xsn file? That may be faster.
  • 11-10-2006 11:05 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37
    Ther is no such method/property in thisXdocument.DOM as setProperty. And this my: prefix doesn't generate an error, any other does.
  • 11-11-2006 03:47 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694
    Hi mar,

    I am sorry for I had given above line code. Here is the code for setting the property of the node.

    XDocument.GetDOM("DOMName").setProperty("SelectionNamespaces","Namespace of the your DOM");

    Can you check once in debug mode if you are getting the DOM and also need to check n that DOM your node is present or not. If your node is present then you have to check once again of your field xpath.
  • 11-12-2006 11:47 PM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37
    Well, XDocument has only 'Equals' and 'ReferenceEquals properties'. I do not why, but i think, that my problem is caused by queryFields and dataFields. In normal, blank document (not from a data connection), with this structure:
    -myFields
    |-my:test
    IXMLDOMNode test=thisXDocument.DOM.selectSingleNode("my:myFields/my:test"); works perfectly...
  • 11-13-2006 01:09 AM In reply to

    • mar
    • Top 500 Contributor
    • Joined on 09-04-2005
    • Poland
    • Posts 37
    I solved my problem.
    IXMLDOMNode test=thisXDocument.DOM.selectSingleNode("dfs:myFields/my:test");
    works perfectly.
    Thanks for your help Shiva.
  • 11-13-2006 08:02 AM In reply to

    Mar (or Shiva),

    I've been following your conversation here becuase I'm trying to solve the same thing. When you finally solved it Mar, I see that you have "dfs". What is dfs?
  • 11-14-2006 10:29 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694
    Hi Joel Allen,

    Here ‘dfs#%92 is the prefix of the node. Each prefix has its own namespace. If you want to change the prefix name also we can change in code, whenever we are setting the property of DOM.

    Also, see this HowTo for more info on namespaces:http://www.infopathdev.com/howto/tutorials/default.aspx?i=ed2cf0c5895f468995cdd081cf17fead

    If you want to get more information then you can start new forum for this.
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.