xml node and attribute

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

hovikav
Ebase User
Posts: 5
Joined: Tue May 23, 2017 2:47 pm

xml node and attribute

#1

Postby hovikav » Tue May 23, 2017 4:31 pm

Emailing xml schema separately.

The schema contains a repeating item, note, which has an attribute noteType.

Code: Select all

<xs&#58;element name="note" minOccurs="0" maxOccurs="unbounded">
	<xs&#58;annotation>
		<xs&#58;documentation>If Notes element exists then it must have an attribute of noteType. Only notes with a noteType of REASONS will be processed</xs&#58;documentation>
	</xs&#58;annotation>
	<xs&#58;complexType>
		<xs&#58;simpleContent>
			<xs&#58;extension base="xs&#58;string">
				<xs&#58;attribute name="noteType" type="xs&#58;string" use="required"/>
			</xs&#58;extension>
		</xs&#58;simpleContent>
	</xs&#58;complexType>
</xs&#58;element>
Importing this into an xml resource results in a table, note, which has a single column noteType.

But I need to populate note too. e.g.

Code: Select all

<note noteType="REASONS">First note - This is a note </note>
<note noteType="REASONS">Second note - This is a another note </note>
I expect it's a case of changing xpath, but not obvious where.

Any help will be appreciated.
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#2

Postby Steve » Wed May 24, 2017 8:44 am

Hi Hovik,

You need to have the xpath as follows:

/root/parent/note on the table source field, where root and parent are the other xpath location to node.

On the column source field it needs the xpath of .

So in the source field column e.g node.col it has an xpath of:

.

I hope this helps.

Steve
0 x

Steve
Moderator
Moderator
Posts: 414
Joined: Fri Sep 07, 2007 3:44 pm
Location: Sandy, UK
Contact:

#3

Postby Steve » Wed May 24, 2017 8:47 am

Sorry Hovik,

I misread this and I see it's an attribute...

so I suspect the xpath on the column is:

./[@nodeType]
0 x

hovikav
Ebase User
Posts: 5
Joined: Tue May 23, 2017 2:47 pm

#4

Postby hovikav » Wed May 24, 2017 1:56 pm

Thanks Steve.
As soon as I saw your suggestion I remembered the technique.

This is how I solved it.

Add a new column to the resource: noteValue
Set xpath of this to .
Import it into the form table so it can be populated

No need to touch noteType - it had the correct xpath of @noteType

So the key was the xpath of . for the new resource field.

Thanks again,
Hovik
0 x


Who is online

Users browsing this forum: No registered users and 111 guests