Coder Social home page Coder Social logo

1.0-ml--utility-functions's People

Contributors

aclavio avatar prestonmcgowan avatar

Watchers

 avatar  avatar

Forkers

aclavio

1.0-ml--utility-functions's Issues

Not replacing or inserting elements which aren't direct decedents of the root

There appear to be issues when attempting to insert, or replace an element which is not a direct descendant of the root element.

Code to reproduce:

(: Create sample document :)
declare namespace ns1 = "some:name:space";
declare namespace ns2 = "some:name:space2";
xdmp:document-insert("/sample.xml", element ns1:root{ element ns1:e{ element ns1:x{"replace me"}}})
;
(: Print out the before :)
element before { fn:doc("/sample.xml") }
;
(: Run the tests :)
import module namespace utilities = "https://github.com/prestonmcgowan/1.0-ml--utility-functions" at "/app/lib/1.0-ml--utility-functions.xqy";
declare namespace ns1 = "some:name:space";
declare namespace ns2 = "some:name:space2";
let $doc := fn:doc("/sample.xml")
return (
  (: Replace Element :)
  utilities:node-insert-or-replace-child($doc, ("ns1", "some:name:space1", "ns2", "some:name:space2"), "/ns1:root/ns1:e", element ns1:x{ "yz" }),
  (: Insert Element :)
  utilities:node-insert-or-replace-child($doc, ("ns1", "some:name:space1", "ns2", "some:name:space2"), "/ns1:root/ns1:e", element ns2:x{ "yz" })
)
;
(: Print out the after :)
element after { fn:doc("/sample.xml") }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.