You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2017/10/31 10:53:10 UTC
[royale-asjs] branch develop updated: Optionally ignore whitespace
in JXON parsing
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 1c425d6 Optionally ignore whitespace in JXON parsing
1c425d6 is described below
commit 1c425d66cfb9b6e26b08d696c545df64b3528bc6
Author: Harbs <ha...@in-tools.com>
AuthorDate: Tue Oct 31 12:50:55 2017 +0200
Optionally ignore whitespace in JXON parsing
---
.../Core/src/main/royale/org/apache/royale/utils/JXON.as | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/JXON.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/JXON.as
index f76764e..71b5e99 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/JXON.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/JXON.as
@@ -31,6 +31,12 @@ package org.apache.royale.utils
public function JXON()
{
}
+
+ /**
+ * Static flag to ignore whitespace text nodes
+ */
+ public static var ignoreWhiteSpace:Boolean = true;
+
/**
* The tag name of the element
*/
@@ -204,7 +210,8 @@ package org.apache.royale.utils
for(i=0;i<node.childNodes.length;i++)
{
var child:Object = fromNode(node.childNodes[i]);
- xml.children.push(child);
+ if(child)
+ xml.children.push(child);
}
}
/**
@@ -227,7 +234,10 @@ package org.apache.royale.utils
//case 2:break;// ATTRIBUTE_NODE (handled separately)
case 3:
//TEXT_NODE
- return data;
+ if(ignoreWhiteSpace)
+ return data.replace(/(^\s*)|(\s*$)/g, "");
+ else
+ return data;
case 4:
//CDATA_SECTION_NODE
break;
--
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].