Все вопросы: [xquery]

76 вопросов

похожие теги: xquery-sqlxquery-updatexquery-3.0
2
голосов
2ответов
2238 просмотров

SQL Server 2005 Xquery namespaces

I'm trying to get some values out of an Xml Datatype. The data looks like: <Individual xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <FirstName xmlns="http://nswcc.org.au/BusinessEntities.Crm">Lirria</FirstName> &lt...

7
голосов
2ответов
6374 просмотров

How do I Pivot on an XML column's attributes in T-SQL

I need to perform a pivot on an XML column in a table, where the XML contains multiple elements with a number of attributes. The attributes in each element is always the same, however the number of elements will vary. Let me give an example... FormEntryId | FormXML ...

3
голосов
3ответов
1882 просмотров

Delphi and XQuery/XPath 2.0?

How do people use XQuery and/or XPath 2.0 from Delphi? I've got MSXML v6.0 working from Delphi, so any sufficiently documented COM-implementation will work. What's your favorite?

2
голосов
1ответов
866 просмотров

How to change matched element text with XQuery?

I'm trying to piece together all the examples I've seen for finding elements and modifying them, but I haven't come up with something that works yet. I created an example below of what I have so far, which I'm running in SQL Server 2005. I'm trying to change the ItemID 4 to 999: DECLARE @x XML...

3
голосов
1ответов
3929 просмотров

How to replace attribute value of *all* matching elements with XQuery?

I'm trying without luck to create a modify() statement to change the value of an attribute in all elements that have that attribute value -- so far I can only get it to change the value in the first matched element. I created an example below of what I have so far, which I'm running in SQL Serve...

38
голосов
2ответов
83308 просмотров

How to get a particular attribute from XML element in SQL Server

I have something like the following XML in a column of a table: <?xml version="1.0" encoding="utf-8"?> <container> <param name="paramA" value="valueA" /> <param name="paramB" value="valueB" /> ... </container> I am trying to get the valueB part out of the XM...

6
голосов
3ответов
35017 просмотров

SQL Server xml string parsing in varchar field

I have a varchar column in a table that is used to store xml data. Yeah I know there is an xml data type that I should be using, but I think this was set up before the xml data type was available so a varchar is what I have to use for now. :) The data stored looks similar to the following: <...

1
голосов
1ответов
2332 просмотров

Retrieve first value with Xquery using a wildcard

In an XmlData column in SQL Server 2008 that has no schema assigned to it, how can I pull the first item at a particular node level? For example, I have: SELECT XmlData.value('//*/*[1]','NVARCHAR(6)') FROM table where XmlData.Exist('//*/*[1]') = 1 I assume this does not work because if ther...

2
голосов
2ответов
4259 просмотров

Outputting CDATA in XQuery

How would I, using XQuery, transform <author>John Smith</author> to <author><![CDATA[John Smith]]></author> ? Also, how would I transform <content><p><em>Hello</em></p></content> to <co...

1
голосов
4ответов
2838 просмотров

Parse into HashMap using Commons Digester

I need to parse xml into a HashMap where the 'key' is the concatenation of two elements attributes. The xml looks like : <map> <parent key='p1'><child key='c1'> value1</child></parent> <parent key='p2'><child key='c2'> value1</child></parent...

0
голосов
1ответов
133 просмотров

C# What query language to specify in rule to pull out the two book nodes

<?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&...

0
голосов
1ответов
347 просмотров

UDF which auto-switches between text and base64 xml attributes

My application serializes data into various XML attributes, and depending on data it might send it as text, or as base64. In the latter case, attribute name will be "attribute-base64". So, on SQL server side it is possible to use following convention to decode XML: declare @DataXml xml set @Data...

8
голосов
3ответов
30072 просмотров

Getting multiple records from xml column with value() in SQL Server

This SQL only returns the first Activity element. How do I select them all? If I remove the [1] in the query I get an error that "value() requires a singleton". DECLARE @myDoc xml SET @myDoc = '<Root> <Activities> <Activity>This is activity one&...

5
голосов
2ответов
2957 просмотров

XQuery Insert without namespace SQL2008

<game xmlns="http://my.name.space" ></game> This is my root element. I've written a stored procedure to insert elements into it. To sum up the stored procedure, here's the SQL UPDATE ChessGame SET GameHistory.modify('insert <move><player>black</player><piece&...

0
голосов
1ответов
361 просмотров

How do I build XQuerys to include/exclude rows based on the presence of certain tags and attributes?

I have an auditing/logging system that uses raw XML to represent actions taken out by an application. I'd like to improve on this system greatly by using an XML column in a table in the application's SQL Server database. Each row in the table would contain one log entry and each entry should co...

33
голосов
3ответов
36305 просмотров

XML query() works, value() requires singleton found xdt:untypedAtomic

I have a typed xml document stored as text. So I use CONVERT the data type to xml by using a Common Table Expression in order to be able to use XML methods: WITH xoutput AS ( SELECT CONVERT(xml, t.requestpayload) 'requestpayload' FROM TABLE t WHERE t.methodid = 1) SELECT x.requestpayloa...

5
голосов
1ответов
4580 просмотров

XML Query within SQL Server

I just starting to query XML within a SQL Server database. I am having trouble with the most basic query. Here is a simplified example. How do I return description? The SELECT statement below is what I am using, but it returns nothing. SELECT Incidents.IncidentXML.query ('data(/dsIncident/Inc...

2
голосов
2ответов
1574 просмотров

Getting location of XML document in XQuery

I'm using Oxygen XML to to work with an XML file that contains references to other XML files. These other XML files are stored in a subdirectory of the directory that contains the main XML file. Downloads/ directory1/ main.xml subdirectory1/ other1.xml other2.xml The locations of t...

2
голосов
3ответов
7947 просмотров

Function to achieve "Element does not have this child"?

I want to retrieve the documents in a collection which satisfy that a given element does not have a specific child element. For example, from the two "documents" below, I want to select doc 2, since it has the element child, but doc 1, since it does not. Doc 1: <doc> <element> &l...

5
голосов
1ответов
11641 просмотров

How to return the first result from XQuery

So I have an XQuery that looks something like this: for $i in /*:rootElement where $i/*:field = "test" return $i This query returns a lot of results, but I only really need one. How can I return just the first item in the result sequence?

0
голосов
2ответов
573 просмотров

Preserving HTML tags inside XQuery

I'm using eXist for a project at work, and I've run into a problem that I can't seem to figure out a solution for. I have an xquery script that is updating an existing document that is already in the database. Part of the data that needs to be updated contains HTML, specifically <p> and &...

0
голосов
1ответов
645 просмотров

Zorba (XQuery) - using print functions

I'm using Eclipse's XQDT with Zorba 0.9.5. I'm trying to call the Zorba internal function zorba:print(...) from within a FLWOR expression, but it gets ignored. Specifically, I'm doing something like the following import module namespace zorba = "http://www.zorba-xquery.com/zorba/internal-...

25
голосов
5ответов
44481 просмотров

XQuery: Return value of an element rather the element itself

I have an XML document that contains the following ... <foo>abc</foo> ... If I evaluate return $xml//foo I get back <foo>abc</foo> Is there any way to get just abc instead?

1
голосов
1ответов
563 просмотров

Eclipse: Show XQDT output in Eclipse's graphical XML editor?

I'm using the XQDT (XQuery Development Tools) plugin for Eclipse, and I'd like to view query results in Eclipse's graphical XML editor rather than in the console. Does anyone know of a way to redirect output in this way?

18
голосов
6ответов
15214 просмотров

Finding node order in XML document in SQL Server

How can I find the order of nodes in an XML document? What I have is a document like this: <value code="1"> <value code="11"> <value code="111"/> </value> <value code="12"> <value code="121"> <value code="1211"/> ...

0
голосов
2ответов
475 просмотров

Saxon на веб-сайте ASP.Net

Я хочу использовать класс Saxon-B XQuery на своем веб-сайте ASP.Net. Но мой хостинг-провайдер поддерживает только приложения со средним уровнем доверия. Кто-нибудь знает, можно ли использовать Saxon-B и IKVM.Net на среднем уровне доверия? окружающая среда? Или есть хороший альтернативный...

4
голосов
5ответов
13125 просмотров

Пример xquery в html

Может ли кто-нибудь привести пример html-страницы, использующей xquery, нужно ли вам что-то еще для запуска xquery. Я попытался запустить некоторый код xquery из w3schools, но он не оценивается на странице html. <html> <ul> { for $x in doc("books.xml")/bookstore/book/ti...

5
голосов
2ответов
9776 просмотров

Удаление нескольких узлов в одном XQuery для SQL Server

У меня есть: таблица со столбцом типа xml (список идентификаторов) параметр типа xml (также список идентификаторов) Как лучше всего удалить узлы из столбца, которые соответствуют узлам в параметре, оставив все несогласованные узлы нетронутыми? например declare @table table ( ...

2
голосов
4ответов
4389 просмотров

Как проверить пустой аргумент даты в функции XQuery?

Рассмотрим следующий код, который проверяет наличие пустой даты: declare xqse function tns:isEmptyDate($dob as xs:date) as xs:boolean { if(empty($dob)) then { } } Почему при выполнении в ALDSP появляется следующая ошибка: weblogic.xml.query.exceptions.XQueryDynamicException:...

2
голосов
6ответов
1749 просмотров

Могут ли парсеры dom читать внутри HTML-комментариев, или это единственный способ Regex

Я создаю очень простую CMS для своей организации. Моя стратегия - встраивать редактируемый контент между тегами под названием . Однако, чтобы скрыть это от браузера, я их комментирую. Пример редактируемой области будет выглядеть так. <!-- <editable name="news_item> Today's news is...