You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Elisha Berns <e....@computer.org> on 2005/08/29 21:47:35 UTC

How to clone remote file(s)

If a schema is located remotely and accessible through HTTP or FTP is
there a way using Xerces to copy it to a local file?  I've looked at
some classes such as BinInputStream and the MemoryPool methods
serialize() and deserialize() and so far I don't get the simple way to
do this type of operation.

Presumably you create an XMLUrl and pass it to a URLInputStream, but at
that point I'm at a loss as to what to do.

Thanks for any help here.

Elisha Berns
e.berns@computer.org
tel. (310) 556 - 8332
fax (310) 556 - 2839




---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


RE: How to clone remote file(s)

Posted by Elisha Berns <e....@computer.org>.
Thanks for the tip.

Question about SystemIds and XMLURL:

Before cloning a remote file, I am trying to determine whether it is a
local file already or a remote file.  To this end I am trying to use an
XMLURL object to parse the SystemId and then calling
XMLURL::getProtocol().  But XMLURL::parse() return false if the SystemId
is a local file or if its an invalid SystemId.  And it will never work
correctly at that point to tell me if its 'protocol' is XMLURL::File.
It only reports correctly if its an HTTP or FTP protocol.

So is there some way, or a better way in Xerces to tell if a SystemId is
a local file?

Many thanks,

Elisha Berns
 
> > If a schema is located remotely and accessible through HTTP or FTP
is
> > there a way using Xerces to copy it to a local file?  I've looked at
> > some classes such as BinInputStream and the MemoryPool methods
> > serialize() and deserialize() and so far I don't get the simple way
to
> > do this type of operation.
> >
> > Presumably you create an XMLUrl and pass it to a URLInputStream, but
at
> > that point I'm at a loss as to what to do.
> 
> You don't need a URLInputStream instance.  XMLUrl::makeNewStream will
> return an instance of a BinInputStream which you can use to read the
bytes
> of the resource.  For writing the local file, you can use whatever
C/C++
> functionality you prefer.  Just remember to delete the BinInputStream
> instances when you're finished.
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: How to clone remote file(s)

Posted by da...@us.ibm.com.
> If a schema is located remotely and accessible through HTTP or FTP is
> there a way using Xerces to copy it to a local file?  I've looked at
> some classes such as BinInputStream and the MemoryPool methods
> serialize() and deserialize() and so far I don't get the simple way to
> do this type of operation.
> 
> Presumably you create an XMLUrl and pass it to a URLInputStream, but at
> that point I'm at a loss as to what to do.

You don't need a URLInputStream instance.  XMLUrl::makeNewStream will 
return an instance of a BinInputStream which you can use to read the bytes 
of the resource.  For writing the local file, you can use whatever C/C++ 
functionality you prefer.  Just remember to delete the BinInputStream 
instances when you're finished.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org