Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2006

Tip: Looking for answers? Try searching our database.

Working with Secondary Data Source Results

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 15 Mar 2006 13:07 GMT
Actually I'm working with a secondary data source that points to a Windows
SharePoint list, but how I'm newbie with XML I'm having a lot of trouble
working with the resuts, in fact I can't see nothing about my list.

I connect to SharePoint using a JScript:

var objSPSList = XDocument.DataObjects["Contacts"].DOM;

objSPSList.setProperty("SelectionNamespaces",'xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +
                                           
'xmlns:dsf="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" ' +
                                           
'xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" ' +
                                           
'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-15T04:09:05"');
                                             

var RefNodes =
objSPSList.selectNodes("/dfs:myFields/dfs:dataFields/dfs:Contacts")

But after this point I don't know how to map any the two values of my list:
NAME and EMAIL

I tried with:

for(i=0;i<=RefNodes.length -1;i++)
{
XDocument.DOM.selectSingleNode("//my:group2/my:field1").text =
objSelectedItems(i).attributes(0).text;
}

But was not good, so.

Could someboy help me with some code to resolve this?
S.Y.M. Wong-A-Ton - 15 Mar 2006 14:33 GMT
Add the following line to your code:
XDocument.UI.Alert(XDocument.DataObjects["Contacts"].DOM.xml);

And post part of the XML that it returns, so that we can see what the
structure is of the data source.
---
S.Y.M. Wong-A-Ton

> Actually I'm working with a secondary data source that points to a Windows
> SharePoint list, but how I'm newbie with XML I'm having a lot of trouble
[quoted text clipped - 30 lines]
>
> Could someboy help me with some code to resolve this?
Daniel - 15 Mar 2006 17:18 GMT
Hello.-

Thank you for your answer. This is the result of my XML:

<dfs:MyFields
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"><dfs:dataFie
lds><dfs:Contacts

First_Name="Daniel"
E-mail_Address="mail@mailserver.com"/></dfs:dataFields></dfs:myFields>

This could you help you?

Thank you again

> Add the following line to your code:
> XDocument.UI.Alert(XDocument.DataObjects["Contacts"].DOM.xml);
[quoted text clipped - 38 lines]
> >
> > Could someboy help me with some code to resolve this?
S.Y.M. Wong-A-Ton - 15 Mar 2006 19:27 GMT
Instead of

for(i=0;i<=RefNodes.length -1;i++)
{
 XDocument.DOM.selectSingleNode("//my:group2/my:field1").text =
 objSelectedItems(i).attributes(0).text;
}

try

for(i = 0; i < RefNodes.length; i++)
{
 XDocument.UI.Alert(RefNodes[i].attributes[0].text);
 XDocument.UI.Alert(RefNodes[i].attributes[1].text);
}

What do these two lines return?
---
S.Y.M. Wong-A-Ton

> Hello.-
>
[quoted text clipped - 51 lines]
> > >
> > > Could someboy help me with some code to resolve this?
Daniel - 15 Mar 2006 21:26 GMT
Thank you again.-

I´m almost done, That works fine, but now I'm receiving an error message whe
try to do this:

 XDocument.DOM.selectSingleNode("//my:group2/my:field1").text =
  RefNodes[i].attributes[0].text;

The message is:

Element 'group2' is unexpected according to content of parent element
'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-15T04:09:05}myFields',
Expecting:{http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-15T04:09:05}group2.

myschema.xsd is:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema
targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-15T04:09:05"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution"
xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-03-15T04:09:05"
xmlns:xd="http://schemas.microsoft.com/office/infopath/2003"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="myFields">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="my:group2" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:anyAttribute processContents="lax"
namespace="http://www.w3.org/XML/1998/namespace"/>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="group2">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element ref="my:field1" minOccurs="0"/>
                <xsd:element ref="my:field2" minOccurs="0"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="field1" type="xsd:string"/>
    <xsd:element name="field2" type="xsd:string"/>
</xsd:schema>

What could be happend?
I don't see a difference.



> Instead of
>
[quoted text clipped - 71 lines]
> > > >
> > > > Could someboy help me with some code to resolve this?
S.Y.M. Wong-A-Ton - 17 Mar 2006 17:48 GMT
Not sure what might have gone wrong. I myself have never gotten an error like
that. The code looks fine to me. Perhaps you can search on Google and see if
you can find something on it?
---
S.Y.M. Wong-A-Ton

> Thank you again.-
>
[quoted text clipped - 121 lines]
> > > > >
> > > > > Could someboy help me with some code to resolve this?
S.Y.M. Wong-A-Ton - 19 Mar 2006 19:40 GMT
Encountered this error myself now. It occurs when you are trying to add an
XML node to the schema while the schema expects a node of a different type.
Are you trying to insert or add nodes anywhere in your code? Or did you
manually edit the form files? If you aren't or haven't, I would recommend
recreating your form from scratch, so start over with a new form.
---
S.Y.M. Wong-A-Ton

> Thank you again.-
>
[quoted text clipped - 121 lines]
> > > > >
> > > > > Could someboy help me with some code to resolve this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.