exist-db

Can XQuery regex match a null character?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 08:14:16
I'd like to remove all NULL characters from the string. I know that the right regex match should be \x00 and I've tried the following XQuery: replace($message, '\x00', '') It results in the error: exerr:ERROR Conversion from XPath2 to Java regular expression syntax failed: Error at character 1 in regular expression \x00: invalid escape sequence Is there any quick solution or workaround for this issue? I use eXist-db 2.2. Jens Erat The short version: you can't, at least not within the boundaries of the XQuery and XML specifications. There may be an eXist-DB-proprietary method I am not aware of

Does eXist-db compression:zip function add XML declaration

谁说胖子不能爱 提交于 2019-12-01 23:18:12
I have an XQuery function to convert a group of XML files to HTML and Zip them. It runs a trasform on each file to create <entry> elements. Starting with that function: declare function xport:make-sources( $path as xs:string) as item()* { for $article in collection(xmldb:encode-uri($path)) let $docnum := $article/article/div[@class = 'content']/@doc/string() return <entry name="{concat($docnum,'.html')}" type='text' method='store'> {transform:transform($article, doc("/db/EIDO/data/edit/xsl/doc-html.xsl"), <parameters/>)} </entry> } ; Given the input, I run the XQuery to just show me the result

Why doesn't xmlstarlet select all nodes?

我只是一个虾纸丫 提交于 2019-11-29 15:04:14
Consider this example from w3schools : <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt Cagle</author> <author>James Linn</author> <author>Vaidyanathan

Why doesn't xmlstarlet select all nodes?

痴心易碎 提交于 2019-11-28 08:55:43
问题 Consider this example from w3schools: <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="WEB"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per