Closed sjordan1975 closed 6 years ago
Thnx!
@christyharagan what do you make of this?
Yup, again, just bad typing. I'll get a fix in.
Hang on a second... shouldn't that be:
fn.QName("")
@christyharagan Insert a document with the following:
declareUpdate();
xdmp.documentInsert('/test.xml', xdmp.unquote("<name>John Doe</name>"))
Then run the following query:
cts.search(cts.elementValueQuery(xs.QName("name")))
But I mean, isn't the QName function in the fn namespace, not xs.
xs.QName is the value, whereas fn.QName is the constructor.
I'm not sure about that. fn.QName is a function. xs.QName is a value ???:
https://docs.marklogic.com/fn/qname:
These built-in functions are XQuery functions defined to operate on qualified name (xs:QName) values. They are defined in XQuery 1.0 and XPath 2.0 Functions and Operators.
I think xs.QName is shorthand for fn.QName("",value) which can also be expressed simply as "value"
In QConsole, these are all equal:
cts.search(cts.elementValueQuery("name"))
cts.search(cts.elementValueQuery(xs.QName("name")))
cts.search(cts.elementValueQuery(fn.QName("","name")))
fn.QName is a function that takes ns + name. xs.QName is a constructor that takes a string which is local name or prefixed name. Prefix should be known. Then again not sure if xs.QName is avail at all in sjs. I mean how would one declare namespaces..
Hmmm, you are right. Looking a bit deeper it's a builtin Type Constructor, and our documentation doesn't talk about builtin constructors, hence we don't generate them.
@grtjn @jmakeig : If we're going to be complete here, we should probably generate all xs. type constructors. Any ideas on where we get this? Should our docs be updated?
@grtjn @jmakeig: If we're going to be complete here, we should probably generate all xs. type constructors. Any ideas on where we get this? Should our docs be updated?
Yes. We should aim for complete coverage of the entire public API surface area—in both the docs and the typings. I think the first step will be some gap analysis. Is there a classification scheme we can start with?
xdmp
, cts
)Not sure. Not even sure ML docs divides things in categories at all, other than perhaps by prefix, e.g. xdmp, cts, etc.
What do you mean by built-in?
“Built-in” means implemented in C++. The end-user doesn’t care where an API is implemented, but the details often matter for how we actually expose things.
Fair point, but the api docs don't bother to describe the built-in types like xs:QName
. We can only generate typedefs for what is provided in the apidocs. If you can get it added, then it will get included here as well.. :)
This also explains why all xs: types are translated to a primitive or Object
On second thought, seems like Christy did a lot of pre-work to manually add this. I'll look into making it more complete. xs.QName was already exposed in v0.3.0 of this types lib, but I'll try to add a few more..
xs namespace is missing from typings file.
See attached: