Home Help Center

[IceXML] How to operate XML document in ICE?

JaneShangJaneShang Member YuLiang, ShangOrganization: Korea Advance Insitute of Science and Technology.Project: Human Robitics Remote Controller
Dear Sir,

Now I have an interface, something like: DispatchCommand(in XMLfile,out XMLfile), to dispatch command from client to server and return the result. The client would construct our system's command as XML file, and send to server, and then server would parse the XML file,and execute corresponding modules, finally, the result would also be packed into XML file.

I review part of IceXML source code. It uses Expat to implement the key part: parse() function; however, it provides many interfaces, such as getParent(), getChild(), and wrappe into C++ class(IceXML). And my questions are:

1: Does IceXML provide any interfaces to construct XML file rather than manually operate std::string? Interface like:
CreateDocument(), InsertElement(), InsertAttribute(), etc...

2: Does it support Chinese encoding,such as gb2312?

3: The interfaces inside of IceXML is for internal use,such as IceStorm, or open for developer?

4: Does IceXML fully wrappe all the interface inside of Expat or partially? If it fully wrapped, then we can only use IceXML instead of C-style of Expat function.

5: Last, What's the limit for std::string? I mean the size limitation. I would save XML file into std::string or sequence<byte>. Which one would be better?

Good luck!

JaneShang

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    JaneShang wrote:
    Dear Sir,

    Now I have an interface, something like: DispatchCommand(in XMLfile,out XMLfile), to dispatch command from client to server and return the result. The client would construct our system's command as XML file, and send to server, and then server would parse the XML file,and execute corresponding modules, finally, the result would also be packed into XML file.

    Just out of curiosity, why are you using XML to dispatch these commands? It seems to me that it would be much easier to define this in Slice directly ;). You would define interfaces with operations for each of your commands for example.
    JaneShang wrote:
    Dear Sir,
    1: Does IceXML provide any interfaces to construct XML file rather than manually operate std::string? Interface like:
    CreateDocument(), InsertElement(), InsertAttribute(), etc...

    No, it only supports functionality to parse an XML file. To create an XML string you could use IceUtil::XMLOutput (see Ice-2.1.1/include/IceUtil/OutputUtil.h).
    JaneShang wrote:
    2: Does it support Chinese encoding,such as gb2312?

    See the [http://www.jclark.com/xml/expatfaq.html Expat FAQ] for more information on the encodings supported by Expat.
    JaneShang wrote:
    3: The interfaces inside of IceXML is for internal use,such as IceStorm, or open for developer?

    No, it's not reserved for internal use, you can use it.
    JaneShang wrote:
    4: Does IceXML fully wrappe all the interface inside of Expat or partially? If it fully wrapped, then we can only use IceXML instead of C-style of Expat function.

    It partially wraps the expat library, it's mostly used by Ice services to parse XML configuration files.
    JaneShang wrote:
    5: Last, What's the limit for std::string? I mean the size limitation. I would save XML file into std::string or sequence<byte>. Which one would be better?

    Using a string is probably easier to transfer the XML. There's no limitations on the size of the string.
    JaneShang wrote:
    Good luck!

    JaneShang

    Let us know if you need more information!

    Benoit.
Sign In or Register to comment.