[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Partial update of server side XML documents
- From: Farrukh Najmi <farrukh@wellfleetsoftware.com>
- To: Manos Batsis <manos_lists@geekologue.com>
- Date: Wed, 24 Sep 2008 13:00:36 -0400
Thanks Manos for sharing your experience and insights.
An XML Db is not an option since the standard needs to support
relational persistence of the XML docs as well.
I am leaning towards your option 2.
What I am thinking is that the request will include a parameterize query
invocation (a regrep feature that is similar to stored query invocation
and does not expose query syntax) to select the objects to update. It
may also contain references to specific objects to update as another
element.
It will also contain an XPATH expression to select what attribute or
element is to be replaced. Finally it will contain a replacement for the
attribute value or element.
If multiple elements are matched by XPATH expression then that would be
a request error.
Thanks again.
Manos Batsis wrote:
> Farrukh Najmi wrote:
>> Another option might be to use simpler XPath/XSLT expressions to do
>> the same.
>>
>> Does any one have any experience or advice on how best to do this.
>
> A proper way to do this would be an XML store and xquery or whatnot.
> However, most project budgets do not include that and seek such
> solutions for a very small subset of what the project actually does.
>
> Couple of years ago i did this two ways for a server side java app. In
> the first approach, the request body was always an
> identity_transform_based XSLT document. An identity transform is one
> whose transformation result tree is the same as the input tree.
>
> So, besides the identity template, that XSLT had other templates as
> desired. For example, suppose you only wanted to change the first
> heading of a document you could just use two templates:
>
>
>
> <xsl:template match="@*|node()">
> <xsl:copy>
> <xsl:apply-templates select="@*|node()"/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="//heading[1]">
> <xsl:copy>
> <xsl:text> added text </xsl:text>
> </xsl:copy>
> </xsl:template>
>
> In the second approach, i was sending two things with each request: an
> HTTP param containing an XPath expression and a request body with the
> XML to replace the node matched by the XPath expression.
>
> Both where sort of quick and dirty solutions but worked. In the first
> approach, the downside was that you had to take some care with the
> templates to avoid changing the wrong nodes. In the second approach
> you had somewhat limited capabilities as you essentially just replaced
> a node or fragment in the target document.
>
> I intended to add a third hybrid approach where an XPath expression
> would be used to extract a fragment from the target document and an
> XSLT would be used to transform that before putting it back but the
> actual need never came up.
>
> All document changes were versioned ;-)
>
> Hope this helps.
>
> Cheers,
>
> Manos
>
--
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]