xquery

Nightmarish, valid Error: [XPTY0004] Single item expected, (element x { … }, element x { … }, …) found

人走茶凉 提交于 2020-01-03 04:13:05
问题 In my most recent attempt to access the XML database from my nightmares, I've come very close. I actually succeeded, using the test database; however, when I apply it to the database I'm actually trying to access, rather than the BaseX sample database, I get a special brand of error, which is a valid complaint about the XML file: via http://basex.org/products/live-demo/ doc('test') := <item> <item_number>1171270</item_number> <seller_info> <seller_company_id>6356</seller_company_id> <seller

Can dom parsers read inside HTML comments, or is Regex the only way

僤鯓⒐⒋嵵緔 提交于 2020-01-02 18:04:15
问题 I am creating very simple CMS for my organisation. My strategy is to embed editable content between tags called < editable >. However to hide these from the browser I am commenting them out. So an example of an editable region will look like this. <!-- <editable name="news_item> Today's news is ... </editable> --> With the content "Today's news is ... " being picked up by the CMS and made editable in the online HTML editor. I would like to be able to "grab" the name attribute's value as well

shredding xml recursively into the database

社会主义新天地 提交于 2020-01-02 04:54:06
问题 I have the following XML data and the Element table. DECLARE @input XML = '<root> <C1> <C2> <C3> <C4>data1</C4> </C3> </C2> <C2> <C3>data2</C3> </C2> </C1> <D1> <D2>data3</D2> <D2>data4</D2> </D1> </root>' Element table:( this is just an example so can be changed to match an appropriate solution.) CREATE TABLE Element ( elementId INT IDENTITY PRIMARY KEY, elementName VARCHAR (200) NOT NULL, parentId INT, data VARCHAR(300) ); According to @input the root element is parent of C1 and D1, then C1

Insertion of an data in an XML using Basex

我的梦境 提交于 2020-01-02 03:40:08
问题 I am storing two XML documents, namely hospital and office, in BaseX. The following is the office xml: <Staff> <Employee Name="Brian"> <Personal> <SSN> 666-66-6666 </SSN> </Personal> <StaffInfo> <Position> Doctor </Position> <AccountableTo> David </AccountableTo> </StaffInfo> </Employee> <Employee Name="David"> <Personal> <SSN> 555-55-5555 </SSN> </Personal> <StaffInfo> <Position> Doctor </Position> <AccountableTo /> </StaffInfo> </Employee> </Staff> In this XML I want to add one or more

XQuery library under Python [closed]

浪尽此生 提交于 2019-12-29 05:08:20
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Is there any existing way to run XQuery under python? (not starting to build a parser yourself in other words). I got a ton of legacy XQuery that I want to port to our new system, or rather I want to port the framework and not XQuery. Therefore: Is there any library that allows me to run XQuery under python? 回答1:

XQuery library under Python [closed]

笑着哭i 提交于 2019-12-29 05:06:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . Is there any existing way to run XQuery under python? (not starting to build a parser yourself in other words). I got a ton of legacy XQuery that I want to port to our new system, or rather I want to port the framework and not XQuery. Therefore: Is there any library that allows me to run XQuery under python? 回答1:

Use of xml.modify to insert parameters into specific element of an xml column

随声附和 提交于 2019-12-29 04:45:07
问题 I would like to use a stored procedure to insert some values passed in as parameters into elements in the xml of a column. I have this so far The following parameters: @profile_id int, @user_id nvarchar(50), @activity_name nvarchar(50), @display_name nvarchar(50) Retrieve the desired xml: DECLARE @profiles_xml xml SET @profiles_xml = (SELECT profiles from tbl_applied_profiles WHERE profiles.value('(Profile/ID)[1]','int')= @profile_id) The xml from the column inside the @profiles_xml looks

SQL Server query xml attribute for an element value

倾然丶 夕夏残阳落幕 提交于 2019-12-29 01:36:14
问题 Sorry if this is somewhere else, I have found a lot of similar examples but I have been unable to get it working with my data. 2 days later and I need an answer :( Basically have a SQL Server table with a column containing XML data. This data contains values I need to extract. Here is my XML. <CustomFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.kaseya.com/vsa/2007/12/ServiceDeskDefinition.xsd"> <Field fieldName=

XQuery retrieval of a value

心已入冬 提交于 2019-12-25 16:55:42
问题 I have the following T-SQL that determines if a row exists using two criteria: Declare @x xml = ' <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="page" itemValue="Confirmation" itemType="string" /> <row ParentID="45" ObjectID="0" Node="root.local.navigation[7]" itemKey="visited" itemValue="false" itemType="bool" />' SELECT @x.exist('/row[@Node eq "root.local.navigation[7]"] and /row[@itemValue eq "Confirmation"]') Question: Given the above SELECT, how can I SELECT the

Is it possible to retrieve the namespace of a raised error?

╄→尐↘猪︶ㄣ 提交于 2019-12-25 08:57:40
问题 When I raise an error from within an XQuery query, for instance with: error( fn:QName( 'http://example.com', 'XMPL0001' ), 'Conflict' ) ... the following is returned by BaseX (be it when communicating with the server, or from within the GUI) Stopped at ., 1/7: [XMPL0001] Conflict Is it somehow possible to retrieve the namespace of the error (in this case http://example.com ) as well? I'm using a customized PHP client and I would like to use this information to prevent possible (future)