Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » XML Manipulation API within WST
XML Manipulation API within WST [message #230111] Tue, 07 April 2009 12:53 Go to next message
Cristian Spiescu is currently offline Cristian SpiescuFriend
Messages: 100
Registered: July 2009
Senior Member
Hello,

I would like to manipulate XML files the same way Java source files can be
manipulated via JDT (using the Abstract Syntax Tree - AST). I understood
that there is an XML API in WST that cand be used for this purpose.

Do you know where I could find some documentation on how to use the XML
manipulation API that is included in WST (IStructuredModel, IDOMDocument,
IDOMElement).

Many thanks in advance.
Cristi.
Re: XML Manipulation API within WST [message #230120 is a reply to message #230111] Tue, 07 April 2009 14:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

For most functions, you can use the the standard DOM interferaces to
manipulate the code. Take at the org.eclise.wst.xml.core.tests plugin
and source for examples on how to use the IStructuredModel to get a
model of the document, and then retrieve the DOM document or
(IDOMDocument etc).

From there you can use either the standard DOM interfaces or the
extended IDOMDocument, IDOMNode, IDOMElement, etc interfaces to
manipulate the tree.

You can also use XPath to query and retrieve nodelists which may be
quicker in many cases than walking the tree yourself.

Dave


Cristian wrote:
> Hello,
>
> I would like to manipulate XML files the same way Java source files can
> be manipulated via JDT (using the Abstract Syntax Tree - AST). I
> understood that there is an XML API in WST that cand be used for this
> purpose.
>
> Do you know where I could find some documentation on how to use the XML
> manipulation API that is included in WST (IStructuredModel,
> IDOMDocument, IDOMElement).
>
> Many thanks in advance.
> Cristi.
>
>
>
Re: XML Manipulation API within WST [message #230127 is a reply to message #230120] Tue, 07 April 2009 16:27 Go to previous messageGo to next message
Cristian Spiescu is currently offline Cristian SpiescuFriend
Messages: 100
Registered: July 2009
Senior Member
Hello Dave,

And thank you for the hint.
I see that all the classes from
org.eclipse.wst.sse.core.internal.provisional package are marked with a
discouraged access. Is there another recommended way of iterating the
nodes (without making use of the classes in the above package)?

You have mentioned XPath. Is there an example on how to use XPath with
wst.xml infrastructure?

Best regards,
Cristian.
Re: XML Manipulation API within WST [message #230134 is a reply to message #230127] Tue, 07 April 2009 16:28 Go to previous messageGo to next message
Cristian Spiescu is currently offline Cristian SpiescuFriend
Messages: 100
Registered: July 2009
Senior Member
I am referring to the
org.eclipse.wst.xml.core.internal.provisional.document package as well.
Re: XML Manipulation API within WST [message #230140 is a reply to message #230134] Tue, 07 April 2009 18:59 Go to previous message
Eclipse UserFriend
Originally posted by: dcarver.starstandard.org

Cristian wrote:
> I am referring to the
> org.eclipse.wst.xml.core.internal.provisional.document package as well.
>

Provisional means it's being considered for API usage. You can use it
as it's been pretty stable for the last 4 years (that's about how long
it's been in provisional status).

Hopefully we can address some of this in the coming releases to remove
the internal.provisional package markers.

So even though it says discouraged access, you can use it, just realize
at some point the package name will probably change when we take it out
of provisional status.

The other way is to not use the IDOMDocument, IDOMElement, etc, unless
you need to and work off the org.w3c.dom interfaces, which the above extend.
Previous Topic:Project 'x' cannot reference itself
Next Topic:Start Server with Error Message
Goto Forum:
  


Current Time: Tue Apr 23 07:40:30 GMT 2024

Powered by FUDForum. Page generated in 0.03405 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top