Binary Docs

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Binary Docs

Jonathan Rowell

Hi,


can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.


The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().

According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?

I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.


regards


Jonathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Joe Wicentowski
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.

Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,


can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.


The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().

According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?

I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.


regards


Jonathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Jonathan Rowell

Hi Joe,


that's a lovely XML file. It is available somewhere in a standard eXist collection?


because if so, I can take the extension, find the relevant entry and extract the type attribute and the choose the relevant function.

Then it would work for any "file" that eXist deemed to store!


hopefully


Jonathan




From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 2:27 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.
github.com
exist - eXist Native XML Database and Application Platform


Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,


can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.


The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().

According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?

I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.


regards


Jonathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Joe Wicentowski
Just remember that while file extension determines the mime type by default, it can be overridden when a resource is stored - see the function documentation for xmldb:store(). So you can't always count on file extension. 

Sent from my iPhone




On Sun, Feb 5, 2017 at 10:03 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi Joe,


that's a lovely XML file. It is available somewhere in a standard eXist collection?


because if so, I can take the extension, find the relevant entry and extract the type attribute and the choose the relevant function.

Then it would work for any "file" that eXist deemed to store!


hopefully


Jonathan




From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 2:27 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.
github.com
exist - eXist Native XML Database and Application Platform


Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,


can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.


The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().

According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?

I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.


regards


Jonathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Jonathan Rowell

Hi Joe,


Hmmm. Just looked at mime-types.xml stored under c:/exist-db and gets "loaded: on start up, viz:


2017-02-05 16:39:03,244 [main] INFO  (MimeTable.java [load]:244) - Loading mime table from file C:\eXist-db\.\mime-types.xml 

Is this actually used internally? And where would I find the implementation for util:binary-doc-available() and doc-available() since I seem to be getting false for .xsd files on both calls (maybe my fault though)?


Since I'm checking the "files" after loading a package with Grunt, there isn't going to be any xmldb: store type operations.

This is working out quite well, since I compile the xql and xqm files which catches errors which linting doesn't.


less hopefully


Jonathan




From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 3:21 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Just remember that while file extension determines the mime type by default, it can be overridden when a resource is stored - see the function documentation for xmldb:store(). So you can't always count on file extension. 

Sent from my iPhone




On Sun, Feb 5, 2017 at 10:03 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi Joe,


that's a lovely XML file. It is available somewhere in a standard eXist collection?


because if so, I can take the extension, find the relevant entry and extract the type attribute and the choose the relevant function.

Then it would work for any "file" that eXist deemed to store!


hopefully


Jonathan




From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 2:27 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.
github.com
exist - eXist Native XML Database and Application Platform


Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,


can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.


The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().

According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?

I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.


regards


Jonathan



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Alister Pillow-3
Hi Jonathan,

Can you try xmldb:get-mime-type(xs:anyURI($path-to-doc))
This is where the mime-types table is used.

Regards,
Alister

On 6 Feb 2017, at 2:19 am, Jonathan Rowell <[hidden email]> wrote:

Hi Joe,

Hmmm. Just looked at mime-types.xml stored under c:/exist-db and gets "loaded: on start up, viz:

2017-02-05 16:39:03,244 [main] INFO  (MimeTable.java [load]:244) - Loading mime table from file C:\eXist-db\.\mime-types.xml 

Is this actually used internally? And where would I find the implementation for util:binary-doc-available() and doc-available() since I seem to be getting false for .xsd files on both calls (maybe my fault though)?


Since I'm checking the "files" after loading a package with Grunt, there isn't going to be any xmldb: store type operations.
This is working out quite well, since I compile the xql and xqm files which catches errors which linting doesn't.

less hopefully

Jonathan



From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 3:21 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Just remember that while file extension determines the mime type by default, it can be overridden when a resource is stored - see the function documentation for xmldb:store(). So you can't always count on file extension. 

Sent from my iPhone




On Sun, Feb 5, 2017 at 10:03 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi Joe,

that's a lovely XML file. It is available somewhere in a standard eXist collection?

because if so, I can take the extension, find the relevant entry and extract the type attribute and the choose the relevant function.
Then it would work for any "file" that eXist deemed to store!

hopefully

Jonathan



From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 2:27 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.
exist - eXist Native XML Database and Application Platform


Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,

can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.

The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().
According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?
I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.

regards

Jonathan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|

Re: Binary Docs

Jonathan Rowell

Hi,


Thanks Alister, I had already found that one last night and have built-it into my script. I now get the .xsd file extension right.


Jonathan




From: Alister Pillow <[hidden email]>
Sent: Sunday, February 5, 2017 10:01 PM
To: Jonathan Rowell
Cc: Joe Wicentowski; exist-open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Can you try xmldb:get-mime-type(xs:anyURI($path-to-doc))
This is where the mime-types table is used.

Regards,
Alister

On 6 Feb 2017, at 2:19 am, Jonathan Rowell <[hidden email]> wrote:

Hi Joe,

Hmmm. Just looked at mime-types.xml stored under c:/exist-db and gets "loaded: on start up, viz:

2017-02-05 16:39:03,244 [main] INFO  (MimeTable.java [load]:244) - Loading mime table from file C:\eXist-db\.\mime-types.xml 

Is this actually used internally? And where would I find the implementation for util:binary-doc-available() and doc-available() since I seem to be getting false for .xsd files on both calls (maybe my fault though)?


Since I'm checking the "files" after loading a package with Grunt, there isn't going to be any xmldb: store type operations.
This is working out quite well, since I compile the xql and xqm files which catches errors which linting doesn't.

less hopefully

Jonathan



From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 3:21 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Just remember that while file extension determines the mime type by default, it can be overridden when a resource is stored - see the function documentation for xmldb:store(). So you can't always count on file extension. 

Sent from my iPhone




On Sun, Feb 5, 2017 at 10:03 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi Joe,

that's a lovely XML file. It is available somewhere in a standard eXist collection?

because if so, I can take the extension, find the relevant entry and extract the type attribute and the choose the relevant function.
Then it would work for any "file" that eXist deemed to store!

hopefully

Jonathan



From: Joe Wicentowski <[hidden email]>
Sent: Sunday, February 5, 2017 2:27 PM
To: Jonathan Rowell; eXist open
Subject: Re: [Exist-open] Binary Docs
 
Hi Jonathan,

Yes, I think you'll need to 'or' fn:doc-available() and util:binary-doc-available().

A binary doc is any non-XML resource. If you want to know which file extensions and mime types are mapped to XML, you should reference https://github.com/eXist-db/exist/blob/develop/mime-types.xml.tmpl.
exist - eXist Native XML Database and Application Platform


Joe

Sent from my iPhone




On Sun, Feb 5, 2017 at 8:24 AM -0500, "Jonathan Rowell" <[hidden email]> wrote:

Hi,

can anyone tell me what is a binary doc and what is not? I have looked at the documentation (also that from Mark Logic) and it seems that a binary doc is one which isn't XML. This is sort of intuitively obvious but of no help in programming. Thus binary-docs are not XML, XSL nor XCONF, because doc-available() returns true and util:binary-doc-available() returns false on all of these I have tested so far.

The reason I ask is to determine whether a given "file" is recorded in eXist. It seems that since util:binary-doc-available() returns false for XSL and XCONF, I must use doc-available().
According to Priscilla Walmsley book doc-available() applies to XML documents, so it must apply to XSD files. But what about HTML5 , XHTML or XLIFF and so on?
I could of course use the "or"-ed result of both functions, but that seems to me a little like a kludge.

regards

Jonathan

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open