[mapguide-commits] r9173 - sandbox/jng/clean_json/Web/src/HttpHandler
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Apr 22 22:41:50 PDT 2017
Author: jng
Date: 2017-04-22 22:41:50 -0700 (Sat, 22 Apr 2017)
New Revision: 9173
Modified:
sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.cpp
sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.h
Log:
Fix linux build
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.cpp
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.cpp 2017-04-22 16:55:27 UTC (rev 9172)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.cpp 2017-04-23 05:41:50 UTC (rev 9173)
@@ -405,7 +405,9 @@
XMLSize_t childNodeCount = childNodes->getLength();
if (childNodeCount == 0)
{
- m_jsonDoc.SetArrayValue(index, NULL);
+ // Write the node as a zero array element
+ m_jsonDoc.BeginArrayObject(index);
+ m_jsonDoc.EndArrayObject();
return;
}
else if (childNodeCount == 1)
@@ -477,8 +479,13 @@
if (NULL != attribute)
{
STRING elPath = L"/@";
- elPath += attribute->getNodeName();
- elPath += suffix;
+ elPath += X2W(attribute->getNodeName());
+ if (NULL != suffix)
+ {
+ STRING ws;
+ ws = X2W(suffix);
+ elPath += ws;
+ }
DOMNode* currentNode = parent;
while (NULL != currentNode)
{
@@ -486,7 +493,7 @@
if (nt == DOMNode::ELEMENT_NODE)
{
STRING pathPart = L"/";
- pathPart += currentNode->getNodeName();
+ pathPart += X2W(currentNode->getNodeName());
elPath = pathPart + elPath;
currentNode = currentNode->getParentNode();
if (NULL == currentNode)
@@ -512,8 +519,13 @@
{
elPath += L"@";
}
- elPath += node->getNodeName();
- elPath += suffix;
+ elPath += X2W(node->getNodeName());
+ if (NULL != suffix)
+ {
+ STRING ws;
+ ws = X2W(suffix);
+ elPath += ws;
+ }
DOMNode* currentNode = node->getParentNode();
while (NULL != currentNode)
{
@@ -521,7 +533,7 @@
if (nt == DOMNode::ELEMENT_NODE)
{
STRING pathPart = L"/";
- pathPart += currentNode->getNodeName();
+ pathPart += X2W(currentNode->getNodeName());
elPath = pathPart + elPath;
currentNode = currentNode->getParentNode();
if (NULL == currentNode)
@@ -541,7 +553,7 @@
bool MgXmlJsonConvert::GetAttributeType(DOMNode * attribute, DOMNode * parent, int & type, const XMLCh * suffix)
{
string path;
- if (GetAttributePath(attribute, parent, path))
+ if (GetAttributePath(attribute, parent, path, suffix))
{
if (s_elementPathTypeMap.find(path) != s_elementPathTypeMap.end())
{
@@ -556,7 +568,7 @@
bool MgXmlJsonConvert::GetElementType(DOMNode * node, int & type, const XMLCh * suffix)
{
string path;
- if (GetElementPath(node, path))
+ if (GetElementPath(node, path, suffix))
{
if (s_elementPathTypeMap.find(path) != s_elementPathTypeMap.end())
{
Modified: sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.h
===================================================================
--- sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.h 2017-04-22 16:55:27 UTC (rev 9172)
+++ sandbox/jng/clean_json/Web/src/HttpHandler/XmlJsonConvert.h 2017-04-23 05:41:50 UTC (rev 9173)
@@ -50,12 +50,12 @@
void ProcessObjectNode(DOMNode *node, bool bClean);
void ProcessArrayNode(int index, DOMNode *node, bool bClean);
- static bool GetAttributePath(DOMNode* attribute, DOMNode* parent, string& path, const XMLCh* suffix = L"");
- static bool GetAttributeType(DOMNode* attribute, DOMNode* parent, int& type, const XMLCh* suffix = L"");
+ static bool GetAttributePath(DOMNode* attribute, DOMNode* parent, string& path, const XMLCh* suffix = NULL);
+ static bool GetAttributeType(DOMNode* attribute, DOMNode* parent, int& type, const XMLCh* suffix = NULL);
- static bool GetElementPath(DOMNode* node, string& path, const XMLCh* suffix = L"");
- static bool GetElementType(DOMNode* node, int& type, const XMLCh* suffix = L"");
- static bool IsMultiple(DOMNode* node, bool& isMultiple, const XMLCh* suffix = L"");
+ static bool GetElementPath(DOMNode* node, string& path, const XMLCh* suffix = NULL);
+ static bool GetElementType(DOMNode* node, int& type, const XMLCh* suffix = NULL);
+ static bool IsMultiple(DOMNode* node, bool& isMultiple, const XMLCh* suffix = NULL);
/// Data Members
private:
MgXmlUtil m_xmlUtil;
More information about the mapguide-commits
mailing list