Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » The problem of <c:dump/> tag in jet2
The problem of <c:dump/> tag in jet2 [message #42585] Mon, 03 March 2008 06:07 Go to next message
Benjamin is currently offline BenjaminFriend
Messages: 6
Registered: July 2009
Junior Member
Hi, guys,
I use <c:dump/> tag to generate the content of the entire input xml file,
but I found some content can not be generated into the output file.
Here is the template:
<root>
<aggregated>
<query language="sql">
<![CDATA[
// The data access script
]]>
</query>
</aggregated>
</root>

here is the dump.jet
<?xml version="1.0" encoding="utf-8"?>
<c:dump select="/*" format="true" entities="true"/>

And, here is the result:
<?xml version="1.0" encoding="utf-8"?>
<root>
<level1/>
<aggregated>
<query language="sql">

// The data access script

</query>
</aggregated>
</root>
the string "<![CDATA[" and "]]>" are missing in the result file.

Why the strings are filtered? Is the problem a bug?
Re: The problem of <c:dump/> tag in jet2 [message #42799 is a reply to message #42585] Wed, 05 March 2008 16:44 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Benjamin:

The <![CDATA[...]]> is lost because JET does not know it existed in the
first place. JET uses EMF to load XML documents, and EMF turns all text,
whether CDATA or not into a simple text node.

<c:dump> was intended to be an aid to debugging. At times, it completely
fails to accurately represent the input (since c:dump is trying to produce
XML, but the input can be something completely different).

Question: Is the <![CDATA[...]]> really necessary in your context? It is
just an XML construct to save you from typing a few XML entities (&lt; comes
to mind).

To get high fidelity rendering of the XML, I think two things would have to
happen:

1) JET would have to load the original document using the XML DOM - I hope
to commit this after EclipseCon
2) A XML DOM-specific XML serialization technique would need to be used. I'd
suggest writing a custom tag that used the Xerces XMLSerilizer to do this.

Paul

"Benjamin Fu" <benjamin.fubin@gmail.com> wrote in message
news:860058074377d3d4d0d2b013fc240bc8$1@www.eclipse.org...
> Hi, guys,
> I use <c:dump/> tag to generate the content of the entire input xml file,
> but I found some content can not be generated into the output file.
> Here is the template:
> <root>
> <aggregated>
> <query language="sql">
> <![CDATA[
> // The data access script
> ]]>
> </query>
> </aggregated>
> </root>
>
> here is the dump.jet
> <?xml version="1.0" encoding="utf-8"?>
> <c:dump select="/*" format="true" entities="true"/>
>
> And, here is the result:
> <?xml version="1.0" encoding="utf-8"?>
> <root>
> <level1/>
> <aggregated>
> <query language="sql">
> // The data access script
> </query>
> </aggregated>
> </root>
> the string "<![CDATA[" and "]]>" are missing in the result file.
>
> Why the strings are filtered? Is the problem a bug?
>
Re: The problem of <c:dump/> tag in jet2 [message #42829 is a reply to message #42799] Fri, 07 March 2008 06:32 Go to previous message
Benjamin is currently offline BenjaminFriend
Messages: 6
Registered: July 2009
Junior Member
Thanks for your explanation Paul,
Our case is generating a html file to describe specific xml file, one of
the requirment is generating all the xml source code into the html file,
so, all the content of the xml file (include the <![CDATA[...]]>, and the
format of the xml) should be remained in the result html.

As you said, I guess the existing model loaders may not fit our
requirement, right?
Previous Topic:ws:project tag: How to specify a project type?
Next Topic:Re: Jet Editor and Argument variable
Goto Forum:
  


Current Time: Thu Mar 28 23:21:04 GMT 2024

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

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

Back to the top