You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Charles N. Harvey III" <ch...@alloy.com> on 2002/09/11 22:39:39 UTC

1 xml file to many

Hello,
I have a very large XML file that I filled by extracting data from a
database.
Now, I want to turn that very large XML file into many smaller ones.
I am trying to figure out which Velocity subproject to use and need some
help
since I have not yet toyed with any of them.

Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a one
time thing that I will run from the command line so servlets necessary.

Thanks.


Charlie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by Bill Burton <bi...@progress.com>.
Hello,

"Charles N. Harvey III" wrote:
> 
> Hello,
> I have a very large XML file that I filled by extracting data from a
> database.
> Now, I want to turn that very large XML file into many smaller ones.
> I am trying to figure out which Velocity subproject to use and need some
> help
> since I have not yet toyed with any of them.
> 
> Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a one
> time thing that I will run from the command line so servlets necessary.

Suggest you try DVSL but need the help of a simple tool class.  The same
may apply to Anakia but I'm not sure.  For an appropriate tool, look in
the e-mail archives at
http://marc.theaimsgroup.com/?l=velocity-user&m=101286017924770&w=2. 

-Bill

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by Bill Burton <bi...@progress.com>.
"Geir Magnusson Jr." wrote:
> 
> On 9/11/02 4:39 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:
> 
> > Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a one
> > time thing that I will run from the command line so servlets necessary.
> 
> I'd go for DVSL, and then add any tools that you might need for cutting up
> files or whathaveyou.
> 
> I know Bill noted the same thing - and gave a link to the archive.  Just
> adding my vote of confidence for DVSL... :)

And you vote counts for a lot!  :)

-Bill

> 
> --
> Geir Magnusson Jr.
> Research & Development, Adeptra Inc.
> geirm@adeptra.com
> +1-203-247-1713

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: 1 xml file to many

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Thanks guys for the tips.  I am looking into DVSL now to see what I can
figure
out.  And thanks for the link too - it is helping.

Oh yeah, the http://jakarta.apache.org/velocity/dvsl/index.html page has a
busted
logo.  The image is pointing to apache.org/images/logo.gif instead of
apache.org/velocity/images/logo.gif.  Just a little heads up.


Charlie


-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Thursday, September 12, 2002 7:56 AM
To: velocity-user@jakarta.apache.org
Subject: Re: 1 xml file to many


On 9/11/02 4:39 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:

> Hello,
> I have a very large XML file that I filled by extracting data from a
> database.
> Now, I want to turn that very large XML file into many smaller ones.
> I am trying to figure out which Velocity subproject to use and need some
> help
> since I have not yet toyed with any of them.
>
> Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a
one
> time thing that I will run from the command line so servlets necessary.


I'd go for DVSL, and then add any tools that you might need for cutting up
files or whathaveyou.

I know Bill noted the same thing - and gave a link to the archive.  Just
adding my vote of confidence for DVSL... :)

--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by Denis <ji...@respublica.fr>.
On Friday, September 13, 2002, at 12:23  am, Charles N. Harvey III 
wrote:

>> There's no DVSL switch.  The problem is that you are escaping the
> entities.
>>
>> If you do something like :
>>
>>
>>  <foo><![CDATA[&lt;p&gt;&amp;nbspSome 
>> Text&amp;nbsp;&lt;/p&gt;]]></foo>
>>
>> That should solve it.  I am assuming much here, but I think this 
>> is what
> you
>> want...
>>
>

You could also escape the & with &amp;:

<foo>&amp;lt;p&amp;gt;&amp;amp;nbspSome 
Text&amp;amp;nbsp;&amp;lt;/p&amp;gt;></foo>


>
>
> One more question...
>
> $variable.toString.substring(0,5)	-	works!
> $variable.toString.replace('a','b')	-	does not.  And I cannot 
> figure out
> why.
>
> I keep getting "is not a valid reference" in the output.  I can do 
> every
> operation
> on a string except replace?  Is there something I don't know.  
> I've been
> killing
> myself over this for two hours now.  :)

Because there are no chars in the template.
Velocity doesn't try to coerce the strings 'a' and 'b' to chars, so 
the call fails.

You could do:

#set ($replace = "ab")
$variable.toString.replace($replace.charAt(0), $replace.charAt(1))

Cheers,

-- Denis.

>
>
> Thanks again.
>
> Charlie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 9/12/02 7:23 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:

> 
>>> I am now a firm +1 for DVSL.  I have gotten it to work with no actual
>>> java coding on my part.  Gotta like a tool where I don't actually have
>>> to write any code.  The only code I needed was posted to the list and
>>> Bill had given me the link - thanks for that by the way.
>>> 
>>> I have a question though.  I am transforming from one xml file to other
>>> xml files so I do not want any of the text "un-xmled".  The current xml
>>> has:
>>> &lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;
>>> 
>>> and it is being converted to:
>>> <p> Some Text </p>
>>> 
>>> And I do NOT want it to do that.  I want the text to be left in its
>>> original format.  Is this possible?  Can I turn off the switch which is
>>> converting the text?
>> 
>> There's no DVSL switch.  The problem is that you are escaping the
> entities.
>> 
>> If you do something like :
>> 
>> 
>>  <foo><![CDATA[&lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;]]></foo>
>> 
>> That should solve it.  I am assuming much here, but I think this is what
> you
>> want...
>> 
> 
> Argh.  My initial xml file is huge.  And the format that it came in does not
> have
> all the fields wrapped in <![CDATA[ ]]> tags.  I tried out a small sample of
> the
> data and put the tags in and it worked as expected.  I might be up a creek
> without
> a paddle on this one without a massive search and replace on that file.

Glad it worked, and "Argh!" indeed.

You could write a little proggie that takes that XML file, and uses dom4j or
something to go through and search for any elements in the tree that contain
< or > and CDATA those... I guess it depends on what the rest of the doc
looks like.

> 
> One more question...
> 
> $variable.toString.substring(0,5)    -    works!
> $variable.toString.replace('a','b')    -    does not.  And I cannot figure out
> why.

There is no character support in Velocity, and if I remember right, the
replace() method takes chars.  'a' -> a string.  Something we didn't think
of, I guess.  The only thing I can think of, w/o using a tool, and w/o
trying it myself, is

#set($a = 'a')
#set($b = 'b')

$variable.toString.replace($a.charAt(0),$b.charAt(0))

Which I will admit is a pain.  How about a tool?

$var.toString.replace($tool.char('a',0), $tool.char('b', 0))


 
> I keep getting "is not a valid reference" in the output.  I can do every
> operation
> on a string except replace?  Is there something I don't know.  I've been
> killing
> myself over this for two hours now.  :)

:)

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: 1 xml file to many

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
> > I am now a firm +1 for DVSL.  I have gotten it to work with no actual
> > java coding on my part.  Gotta like a tool where I don't actually have
> > to write any code.  The only code I needed was posted to the list and
> > Bill had given me the link - thanks for that by the way.
> >
> > I have a question though.  I am transforming from one xml file to other
> > xml files so I do not want any of the text "un-xmled".  The current xml
> > has:
> > &lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;
> >
> > and it is being converted to:
> > <p> Some Text </p>
> >
> > And I do NOT want it to do that.  I want the text to be left in its
> > original format.  Is this possible?  Can I turn off the switch which is
> > converting the text?
>
> There's no DVSL switch.  The problem is that you are escaping the
entities.
>
> If you do something like :
>
>
>  <foo><![CDATA[&lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;]]></foo>
>
> That should solve it.  I am assuming much here, but I think this is what
you
> want...
>

Argh.  My initial xml file is huge.  And the format that it came in does not
have
all the fields wrapped in <![CDATA[ ]]> tags.  I tried out a small sample of
the
data and put the tags in and it worked as expected.  I might be up a creek
without
a paddle on this one without a massive search and replace on that file.



One more question...

$variable.toString.substring(0,5)	-	works!
$variable.toString.replace('a','b')	-	does not.  And I cannot figure out
why.

I keep getting "is not a valid reference" in the output.  I can do every
operation
on a string except replace?  Is there something I don't know.  I've been
killing
myself over this for two hours now.  :)


Thanks again.

Charlie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 9/12/02 5:16 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:

> I am now a firm +1 for DVSL.  I have gotten it to work with no actual
> java coding on my part.  Gotta like a tool where I don't actually have
> to write any code.  The only code I needed was posted to the list and
> Bill had given me the link - thanks for that by the way.
> 
> I have a question though.  I am transforming from one xml file to other
> xml files so I do not want any of the text "un-xmled".  The current xml
> has:
> &lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;
> 
> and it is being converted to:
> <p> Some Text </p>
> 
> And I do NOT want it to do that.  I want the text to be left in its
> original format.  Is this possible?  Can I turn off the switch which is
> converting the text?

There's no DVSL switch.  The problem is that you are escaping the entities.

If you do something like :


 <foo><![CDATA[&lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;]]></foo>

That should solve it.  I am assuming much here, but I think this is what you
want...

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: 1 xml file to many

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
I am now a firm +1 for DVSL.  I have gotten it to work with no actual
java coding on my part.  Gotta like a tool where I don't actually have
to write any code.  The only code I needed was posted to the list and
Bill had given me the link - thanks for that by the way.

I have a question though.  I am transforming from one xml file to other
xml files so I do not want any of the text "un-xmled".  The current xml
has:
	&lt;p&gt;&amp;nbspSome Text&amp;nbsp;&lt;/p&gt;

and it is being converted to:
	<p> Some Text </p>

And I do NOT want it to do that.  I want the text to be left in its
original format.  Is this possible?  Can I turn off the switch which is
converting the text?


Thanks.


Charlie



-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Thursday, September 12, 2002 7:56 AM
To: velocity-user@jakarta.apache.org
Subject: Re: 1 xml file to many


On 9/11/02 4:39 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:

> Hello,
> I have a very large XML file that I filled by extracting data from a
> database.
> Now, I want to turn that very large XML file into many smaller ones.
> I am trying to figure out which Velocity subproject to use and need some
> help
> since I have not yet toyed with any of them.
>
> Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a
one
> time thing that I will run from the command line so servlets necessary.


I'd go for DVSL, and then add any tools that you might need for cutting up
files or whathaveyou.

I know Bill noted the same thing - and gave a link to the archive.  Just
adding my vote of confidence for DVSL... :)

--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: 1 xml file to many

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 9/11/02 4:39 PM, "Charles N. Harvey III" <ch...@alloy.com> wrote:

> Hello,
> I have a very large XML file that I filled by extracting data from a
> database.
> Now, I want to turn that very large XML file into many smaller ones.
> I am trying to figure out which Velocity subproject to use and need some
> help
> since I have not yet toyed with any of them.
> 
> Is Anakia best for the job?  Or Texen?  Or should I use DVSL?  This is a one
> time thing that I will run from the command line so servlets necessary.


I'd go for DVSL, and then add any tools that you might need for cutting up
files or whathaveyou.

I know Bill noted the same thing - and gave a link to the archive.  Just
adding my vote of confidence for DVSL... :)

-- 
Geir Magnusson Jr. 
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>