Working with Secondary Data Source Results

D

Daniel

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

S.Y.M. Wong-A-Ton

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.
 
D

Daniel

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:dataFields><dfs:Contacts
First_Name="Daniel"
E-mail_Address="(e-mail address removed)"/></dfs:dataFields></dfs:myFields>

This could you help you?

Thank you again

S.Y.M. Wong-A-Ton said:
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


Daniel said:
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

S.Y.M. Wong-A-Ton

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.attributes[0].text);
XDocument.UI.Alert(RefNodes.attributes[1].text);
}

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


Daniel said:
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:dataFields><dfs:Contacts
First_Name="Daniel"
E-mail_Address="(e-mail address removed)"/></dfs:dataFields></dfs:myFields>

This could you help you?

Thank you again

S.Y.M. Wong-A-Ton said:
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


Daniel said:
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?
 
D

Daniel

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.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.




S.Y.M. Wong-A-Ton said:
Instead of

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

try

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

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


Daniel said:
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:dataFields><dfs:Contacts
First_Name="Daniel"
E-mail_Address="(e-mail address removed)"/></dfs:dataFields></dfs:myFields>

This could you help you?

Thank you again

S.Y.M. Wong-A-Ton said:
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
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

S.Y.M. Wong-A-Ton

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


Daniel said:
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.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.




S.Y.M. Wong-A-Ton said:
Instead of

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

try

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

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


Daniel said:
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:dataFields><dfs:Contacts
First_Name="Daniel"
E-mail_Address="(e-mail address removed)"/></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);

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
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

S.Y.M. Wong-A-Ton

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


Daniel said:
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.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.




S.Y.M. Wong-A-Ton said:
Instead of

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

try

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

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


Daniel said:
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:dataFields><dfs:Contacts
First_Name="Daniel"
E-mail_Address="(e-mail address removed)"/></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);

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
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top