Make sure to put the namespace on the replacement as well, or you will run into
issues on next replace:
xdmp:node-replace(doc("/data-sources/editorial-calendar/TheDrivetoThrive:CRECinderellaStories6321741.xml")/ec:calendar/ec:approval_status,
<ec:approval_status>true</ec:approval_status>);
Or:
xdmp:node-replace(doc("/data-sources/editorial-calendar/TheDrivetoThrive:CRECinderellaStories6321741.xml")/ec:calendar/ec:approval_status,
<approval_status
xmlns="http://www.alm.com/event-calendar">true</approval_status>);
Cheers,
Geert
From:
<[email protected]<mailto:[email protected]>>
on behalf of Kari Cowan <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Date: Tuesday, February 9, 2016 at 4:45 AM
To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] xdmp:node-replace
Thanks Chris – ok, so the node existed, but I had to call reference them with
the namespace.. not ‘calendar’ but ec:calendar
xdmp:node-replace(doc("/data-sources/editorial-calendar/TheDrivetoThrive:CRECinderellaStories6321741.xml")/ec:calendar/ec:approval_status,
<approval_status>true</approval_status>);
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Christopher
Hamlin
Sent: Monday, February 08, 2016 5:40 PM
To: MarkLogic Developer Discussion
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] xdmp:node-replace
I'd check that such a node exists:
fn:doc(...)/calendar/approval_status
It looks like you are missing the namespace on the element steps.
On Mon, Feb 8, 2016 at 8:37 PM, Kari Cowan
<[email protected]<mailto:[email protected]>> wrote:
I have used this node-replace statement on other types of records and it works
fine, but it doesn’t work for these, and it doesn’t return an error. Any idea
what silly error have I made?
xquery version "1.0-ml";
declare namespace ec = "http://www.alm.com/event-calendar";
xdmp:node-replace(doc("/data-sources/editorial-calendar/TheDrivetoThrive:CRECinderellaStories6321741.xml")/calendar/approval_status,
<approval_status>true</approval_status>);
>> your query returned an empty sequence
record node example:
<calendar source="local" xmlns="http://www.alm.com/event-calendar">
<ContentTitle>The Drive to Thrive: CRE Cinderella Stories</ContentTitle>
<doc-uri>/data-sources/editorial-calendar/TheDrivetoThrive:CRECinderellaStories6321741.xml</doc-uri>
<approval_status>false</approval_status>
… et cetera…
________________________________
Learn more about ALM, visit http://www.alm.com . – ALM, an Integrated Media
Company, is a leading provider of news and information for the legal and
commercial real estate markets. ALM’s market-leading brands include The
American Lawyer, Corporate Counsel, GlobeSt.com, Insight Conferences, Law.com,
Law Journal Press, LegalTech, The National Law Journal and Real Estate Forum.
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
________________________________
Learn more about ALM, visit http://www.alm.com . – ALM, an Integrated Media
Company, is a leading provider of news and information for the legal and
commercial real estate markets. ALM’s market-leading brands include The
American Lawyer, Corporate Counsel, GlobeSt.com, Insight Conferences, Law.com,
Law Journal Press, LegalTech, The National Law Journal and Real Estate Forum.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general