• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Marshal
Posts: 28260
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used success the:

 
reply
    Bookmark Topic Watch Topic
  • New Topic