File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not

 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to EXACT Dublicate an xml file[xml->xml] via Java TransformerFactory classes and XSTL well I do not know how to syntax the .xsl file (java is ok)?
In this case if one file is eg 234bytes the other must be 234bytes?
I must use for-each or apply-templates or both or any?
eg. an xml:

[code] <?xml version="1.0"?>
<plants xmlns = "x-schema:your-first-schema.xml">
<plant id="25">
<name>Carnation</name>
<scientificName>Dianthus</scientificName>
<onHand>4000</onHand>
<color>Red</color>
</plant>
<plant id="65">
<name>Lily-Of-The-Valley</name>
<scientificName>Convallaria</scientificName>
<onHand>250</onHand>
<color>White</color>
</plant>
<plant id="115">
<name>Violet</name>
<scientificName>Viola</scientificName>
<onHand>900</onHand>
<color>Purple</color>
</plant>
<plant id="1195">
<name>Violet2</name>
<scientificName>Viola2</scientificName>
<onHand>90</onHand>
<color>Purple2</color>
</plant>
</plants>
[/code]
 
Paul Clapham
Sheriff
Pie
Posts: 20208
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just use the XSLT identity template. But even that doesn't guarantee that the output file will be byte-for-byte identical to the input file; for example the process might have normalized an unnormalized attribute value, or it might have chosen to use double quotes around attribute values where the input had single quotes.

So why not just use ordinary Java code which ignores the XML aspect of the file entirely and just copies the bytes from the input to the output?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about using the 'cp' (UNIX) or 'copy' (MS-DOS) programs?

Simply,

...\cp file1.txt file2.txt

 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the hint here was a <xsl:copy> usage for practice, can you tell how may used event not exact copy??
 
Leonidas Savvides
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used success the:

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic