[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Dicky

1/9/2003 5:01:00 PM

Hi,
I am writing an asp.net application, which will amend a xml file. In my
situation, i am not going to create a new XML file. Instead, i want to add
some elements at the particular position in the existing xml tree.

I know XMLTextWriter is a simple class, which provides non-caching
implementation in XML. That means it cannot jump to specific position of the
xml file.

In my situation, can i solve this problem? Any suitable class provided?

Thank you

Regards,
Dicky




5 Answers

Girish Bharadwaj

1/9/2003 5:09:00 PM

0

You might want to reconsider using code todo this kind of transformations.
You might want to use XSL. Its built for such modifications and it gives
you a lot of flexibility. BTW: You can use DOM calls to navigate to the
right position. and make edits there and then save it.
You might want to search around on gotdotnet.com for samples.


On Fri, 10 Jan 2003 00:01:10 +0800, Dicky <dicky_wong_hk@hotmail.com>
wrote:

> Hi,
> I am writing an asp.net application, which will amend a xml file. In my
> situation, i am not going to create a new XML file. Instead, i want to
> add
> some elements at the particular position in the existing xml tree.
>
> I know XMLTextWriter is a simple class, which provides non-caching
> implementation in XML. That means it cannot jump to specific position of
> the
> xml file.
>
> In my situation, can i solve this problem? Any suitable class provided?
>
> Thank you
>
> Regards,
> Dicky
>
>
>
>
>



--
Girish Bharadwaj

Peter Hurford

1/9/2003 7:26:00 PM

0

XMLDocument is your friend.

You're right - XMLTextWriter is analogous to a SAX parser,
it's quick but limited. XMLDocument is the DOM Document
implementation, full traversal functionality and ideal for
jumping around nodes.

Forget xsl - that's massive overkill when it sounds like
you want to cherry pick individual items. Square peg,
round hole.


>-----Original Message-----
>You might want to reconsider using code todo this kind of
transformations.
>You might want to use XSL. Its built for such
modifications and it gives
>you a lot of flexibility. BTW: You can use DOM calls to
navigate to the
>right position. and make edits there and then save it.
>You might want to search around on gotdotnet.com for
samples.
>
>
>On Fri, 10 Jan 2003 00:01:10 +0800, Dicky
<dicky_wong_hk@hotmail.com>
>wrote:
>
>> Hi,
>> I am writing an asp.net application, which will amend a
xml file. In my
>> situation, i am not going to create a new XML file.
Instead, i want to
>> add
>> some elements at the particular position in the
existing xml tree.
>>
>> I know XMLTextWriter is a simple class, which provides
non-caching
>> implementation in XML. That means it cannot jump to
specific position of
>> the
>> xml file.
>>
>> In my situation, can i solve this problem? Any suitable
class provided?
>>
>> Thank you
>>
>> Regards,
>> Dicky
>>
>>
>>
>>
>>
>
>
>
>--
>Girish Bharadwaj
>.
>

Girish Bharadwaj

1/9/2003 10:55:00 PM

0

When would you use XSL? I use it for anything that can be (and will be)
changed because the product management want to squeeze in *just* one more
piece of information.. :) So, I end up writing XSLs lot more often than
writing DOM parsers.
BTW: XMLDocument.. Man!! I did not put that in the initial post. Doh!

On Thu, 9 Jan 2003 10:26:32 -0800, Peter Hurford
<peter.hurford@microcrest.com> wrote:

> XMLDocument is your friend.
>
> You're right - XMLTextWriter is analogous to a SAX parser, it's quick but
> limited. XMLDocument is the DOM Document implementation, full traversal
> functionality and ideal for jumping around nodes.
>
> Forget xsl - that's massive overkill when it sounds like you want to
> cherry pick individual items. Square peg, round hole.
>

Peter Hurford

1/10/2003 12:32:00 PM

0

I know what you mean.

IMHO I think the question of when to use the DOM and when
to use XSLT is a matter of taste and probably scale.

I came across an example recently where I was getting
records from a database
<recordset>
<record id=1>...</.....>
<record id=2>....
...

and needed to display this as an html table

<table>
<tr>.......</tr>
<tr>.......</tr>
...

XSL was obviously ideal for this.

But if I had a document and wanted to change just a couple
of nodes? probably not. Plus, of course, to apply a
transform programmatically you need to go through the DOM
in any case, so you're bound to take a performance hit if
you use XSL.

Rgds
Pete




>-----Original Message-----
>When would you use XSL? I use it for anything that can be
(and will be)
>changed because the product management want to squeeze in
*just* one more
>piece of information.. :) So, I end up writing XSLs lot
more often than
>writing DOM parsers.
>BTW: XMLDocument.. Man!! I did not put that in the
initial post. Doh!
>
>On Thu, 9 Jan 2003 10:26:32 -0800, Peter Hurford
><peter.hurford@microcrest.com> wrote:
>
>> XMLDocument is your friend.
>>
>> You're right - XMLTextWriter is analogous to a SAX
parser, it's quick but
>> limited. XMLDocument is the DOM Document
implementation, full traversal
>> functionality and ideal for jumping around nodes.
>>
>> Forget xsl - that's massive overkill when it sounds
like you want to
>> cherry pick individual items. Square peg, round hole.
>>
>.
>

Zen

1/18/2003 3:31:00 AM

0

I used xsl when I want to display web pages differently
just change the xml through DHTML

--
Lawrence "Zen" Thurman
http://www.powe...
"Girish Bharadwaj" <girishb@gbvsoft.com> wrote in message
news:opriq5uhuoa2mtqj@msnews.microsoft.com...
> When would you use XSL? I use it for anything that can be (and will be)
> changed because the product management want to squeeze in *just* one more
> piece of information.. :) So, I end up writing XSLs lot more often than
> writing DOM parsers.
> BTW: XMLDocument.. Man!! I did not put that in the initial post. Doh!
>
> On Thu, 9 Jan 2003 10:26:32 -0800, Peter Hurford
> <peter.hurford@microcrest.com> wrote:
>
> > XMLDocument is your friend.
> >
> > You're right - XMLTextWriter is analogous to a SAX parser, it's quick
but
> > limited. XMLDocument is the DOM Document implementation, full traversal
> > functionality and ideal for jumping around nodes.
> >
> > Forget xsl - that's massive overkill when it sounds like you want to
> > cherry pick individual items. Square peg, round hole.
> >