[xsd-users] iso-8859-1 - Parsing issue

Constantin Iacobescu sir.costy at gmail.com
Wed Apr 22 04:47:19 EDT 2009


Hi Boris,

I try to parse a xml file which use the iso-8859-1 (Latin-1) char encoding
and all I get are some strange characters.
How I am new on the xml world I don't know where I am doin wrong. Don't know
if have something to do with the Xerces compilation or with XSD binding or
the character set use by the VC projects.

More in detail:
- I compiled the Xerces like a Statical Library and the VC proj char set was
"Use Multi-Byte Character"
- I used the binding code to create my one library, VC proj char set was
"Use Multi-Byte Character"
- I use this library in a project which is also VC proj char set "Use
Multi-Byte Character"

how it doe not work I have changed the VC project Character Set of all the
projects to "Not Set"
and still get wrong characters.

Don't know if I need and if so, if is  any way to tell to Xerces what char
set must use.
I had thought that the character set of the parser is get automatically from
the xml element named "encoding".

The code is veri simple as you can see here:

/////////////////////////////////////////////////////////////////

    XMLPlatformUtils::Initialize ();

    try
    {
        std::auto_ptr<LandXML> objLandXML ( parseLandXML(fileName.c_str(),
xml_schema::Flags::dont_initialize));

        LandXML::ProjectSequence projectSequence(objLandXML.getProject());

        for (LandXML::ProjectConstIterator
projectIterator(projectSequence.begin());
             projectIterator != projectSequence.end ();
              ++projectIterator)

        Project::NameType doTest = projectIterator->getName(); //
!!!!!!!!!!! And here if the char in the xml file are using the iso-8859-1
get wrong
  }

  catch (const xml_schema::Parsing& e)
  {
    assert(false);
  }

  catch (const xml_schema::Exception& e)
  {
    assert(false);
  }

  XMLPlatformUtils::Terminate ();

/////////////////////////////////////////////////////////////////

to get a clue on how the xml file looks I put here a snippet:

*********************************************************
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>

<LandXML xmlns="http://www.landxml.org/schema/LandXML-1.2" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.landxml.org/schema/LandXML-1.2
http://www.landxml.org/schema/LandXML-1.2/LandXML-1.2.xsd" version="1.2"
date="2002-06-25" time="11:21:18" readOnly="false" language="English">

     <Project name="ÓÁÉóáé"> </Project>

</LandXML>
**********************************************************

Thanks and Regards,
Constantin Iacobescu



More information about the xsd-users mailing list