diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-08-28 01:09:01 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-08-28 01:09:01 +0000 |
commit | f6043ba1a29a1b558f3773f90360000b666a89e2 (patch) | |
tree | f81a311b0a4e153598b9257d01f26fc3ff1896b1 /cpp/src/IceXML/StreamI.cpp | |
parent | adding facet test (diff) | |
download | ice-f6043ba1a29a1b558f3773f90360000b666a89e2.tar.bz2 ice-f6043ba1a29a1b558f3773f90360000b666a89e2.tar.xz ice-f6043ba1a29a1b558f3773f90360000b666a89e2.zip |
improving xerces workaround
Diffstat (limited to 'cpp/src/IceXML/StreamI.cpp')
-rw-r--r-- | cpp/src/IceXML/StreamI.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp index cbde2770697..fa474a535de 100644 --- a/cpp/src/IceXML/StreamI.cpp +++ b/cpp/src/IceXML/StreamI.cpp @@ -1261,14 +1261,28 @@ IceXML::StreamI::startRead(const ::std::string& element) } string nodeName = toString(_input->current.getNodeName()); - // - // TODO: Work around for bug in xerces - // - static const string facets = "facets"; - static const string facetsNS = "ice:facets"; - if((element != facetsNS || nodeName != facets) && element != nodeName) - { - throw ::Ice::MarshalException(__FILE__, __LINE__); + if(element != nodeName) + { + // + // TODO: Work around for bug in xerces. Specifically, when schema + // validation is enabled, the namespace prefix is always empty. + // In this case, we compare only the local names, but only if the + // prefix is empty. + // + string::size_type pos = element.find(':'); + if(pos != string::npos) + { + string localName = toString(_input->current.getLocalName()); + string prefix = toString(_input->current.getPrefix()); + if(!prefix.empty() || pos + 1 == element.size() || localName != element.substr(pos + 1)) + { + throw ::Ice::MarshalException(__FILE__, __LINE__); + } + } + else + { + throw ::Ice::MarshalException(__FILE__, __LINE__); + } } _input->nodeStack.push_back(_input->current); |