perl XML setting tag value issue











up vote
1
down vote

favorite












I have some code that creates XML differently based on a very simple string of characters. Does anyone know why?



First of all, code snippet ( to clarify things for @mob ), with the lines AROUND the problem line:



my $XML = XML::Smart->new();

my $mylogin = {
userId => $SQLUser,
password => $SQLPass,
maxIdle => '900000',
properties => '<hidden for privacy concerns>'
};
$XML->{'System-Link'}{Login} = $mylogin;

my $request = {
sessionHandle => '*current',
workHandle => '*new',
broker => 'EJB',
maxIdle => '900000'
};
$XML->{'System-Link'}{Request} = $request;

my $querylist = {
name => 'queryListPurchaseOrderItemRelease_SLTOKEN',
domainClass => '<hidden for privacy concerns>',
includeMetaData => 'true',
maxReturned => '1'
};
$XML->{'System-Link'}{Request}{QueryList} = $querylist;
### PROBLEM LINE GOES HERE, just subsitute one of below lines here

## Muck with the DTD cause 'EMPTY' causes problems, this is an issue w/ the implementation of XML::Smart
open $dtd, '<', 'SystemLinkRequest.dtd';
my $dtdContent = do { local $/; <$dtd> };
close $dtd;
$dtdContent =~ s/EMPTY//g;

$XML->apply_dtd($dtdContent);

## Turn off output of DTD and meta tag generation
my $xmldata = $XML->data(nometagen => 1, nodtd => 1);
$xmldata =~ s/?>/?>n<!DOCTYPE System-Link SYSTEM 'SystemLinkRequest.dtd'>/m;
## Store a clean version (no passwords) in the local XML file
my $xmldata_clean = $xmldata;
$xmldata_clean =~ s/userIds*=s*"$SQLUser"s+passwords*=s*"$SQLPass"/userId="REMOVED" password="REMOVED"/g;

my $xml_filename = $RELEASE . "-" . time . ".xml";
print LOGF "{DEBUG} [" . localtime(time) . "] tBuilding XML Request COMPLETEDn";
print LOGF "{DEBUG} [" . localtime(time) . "] tWriting XML Request to Request_$xml_filename STARTEDn";

open $RequestLogfile, '>', "$logsDir/XML/Update/Request_$xml_filename";
print $RequestLogfile "n--------------- QUERY REQUEST ---------------n";
print $RequestLogfile $xmldata;
close $RequestLogfile;


Works:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release";



Does not work:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40') ORDER BY order,line,release";



Now the XML I get.



Good XML ( Pql tag with CDATA ):



<QueryList domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN">
<Pql><![CDATA[SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release]]></Pql>
</QueryList>


Bad XML ( Pql attribute ):



<QueryList Pql="SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus &lt; '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus &lt; '40' ) ORDER BY order,line,release" domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN"/>


The only difference between the two lines of code is that the one that works has AND remainingQuantityForReleaseStockingUm > 0.000



So why does that impact the resulting XML?










share|improve this question
























  • You forgot to include the code.
    – mob
    Nov 21 at 23:25










  • What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
    – user3329922
    Nov 21 at 23:29










  • That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
    – mob
    Nov 21 at 23:35










  • Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
    – user3329922
    Nov 21 at 23:42















up vote
1
down vote

favorite












I have some code that creates XML differently based on a very simple string of characters. Does anyone know why?



First of all, code snippet ( to clarify things for @mob ), with the lines AROUND the problem line:



my $XML = XML::Smart->new();

my $mylogin = {
userId => $SQLUser,
password => $SQLPass,
maxIdle => '900000',
properties => '<hidden for privacy concerns>'
};
$XML->{'System-Link'}{Login} = $mylogin;

my $request = {
sessionHandle => '*current',
workHandle => '*new',
broker => 'EJB',
maxIdle => '900000'
};
$XML->{'System-Link'}{Request} = $request;

my $querylist = {
name => 'queryListPurchaseOrderItemRelease_SLTOKEN',
domainClass => '<hidden for privacy concerns>',
includeMetaData => 'true',
maxReturned => '1'
};
$XML->{'System-Link'}{Request}{QueryList} = $querylist;
### PROBLEM LINE GOES HERE, just subsitute one of below lines here

## Muck with the DTD cause 'EMPTY' causes problems, this is an issue w/ the implementation of XML::Smart
open $dtd, '<', 'SystemLinkRequest.dtd';
my $dtdContent = do { local $/; <$dtd> };
close $dtd;
$dtdContent =~ s/EMPTY//g;

$XML->apply_dtd($dtdContent);

## Turn off output of DTD and meta tag generation
my $xmldata = $XML->data(nometagen => 1, nodtd => 1);
$xmldata =~ s/?>/?>n<!DOCTYPE System-Link SYSTEM 'SystemLinkRequest.dtd'>/m;
## Store a clean version (no passwords) in the local XML file
my $xmldata_clean = $xmldata;
$xmldata_clean =~ s/userIds*=s*"$SQLUser"s+passwords*=s*"$SQLPass"/userId="REMOVED" password="REMOVED"/g;

my $xml_filename = $RELEASE . "-" . time . ".xml";
print LOGF "{DEBUG} [" . localtime(time) . "] tBuilding XML Request COMPLETEDn";
print LOGF "{DEBUG} [" . localtime(time) . "] tWriting XML Request to Request_$xml_filename STARTEDn";

open $RequestLogfile, '>', "$logsDir/XML/Update/Request_$xml_filename";
print $RequestLogfile "n--------------- QUERY REQUEST ---------------n";
print $RequestLogfile $xmldata;
close $RequestLogfile;


Works:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release";



Does not work:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40') ORDER BY order,line,release";



Now the XML I get.



Good XML ( Pql tag with CDATA ):



<QueryList domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN">
<Pql><![CDATA[SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release]]></Pql>
</QueryList>


Bad XML ( Pql attribute ):



<QueryList Pql="SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus &lt; '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus &lt; '40' ) ORDER BY order,line,release" domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN"/>


The only difference between the two lines of code is that the one that works has AND remainingQuantityForReleaseStockingUm > 0.000



So why does that impact the resulting XML?










share|improve this question
























  • You forgot to include the code.
    – mob
    Nov 21 at 23:25










  • What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
    – user3329922
    Nov 21 at 23:29










  • That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
    – mob
    Nov 21 at 23:35










  • Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
    – user3329922
    Nov 21 at 23:42













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have some code that creates XML differently based on a very simple string of characters. Does anyone know why?



First of all, code snippet ( to clarify things for @mob ), with the lines AROUND the problem line:



my $XML = XML::Smart->new();

my $mylogin = {
userId => $SQLUser,
password => $SQLPass,
maxIdle => '900000',
properties => '<hidden for privacy concerns>'
};
$XML->{'System-Link'}{Login} = $mylogin;

my $request = {
sessionHandle => '*current',
workHandle => '*new',
broker => 'EJB',
maxIdle => '900000'
};
$XML->{'System-Link'}{Request} = $request;

my $querylist = {
name => 'queryListPurchaseOrderItemRelease_SLTOKEN',
domainClass => '<hidden for privacy concerns>',
includeMetaData => 'true',
maxReturned => '1'
};
$XML->{'System-Link'}{Request}{QueryList} = $querylist;
### PROBLEM LINE GOES HERE, just subsitute one of below lines here

## Muck with the DTD cause 'EMPTY' causes problems, this is an issue w/ the implementation of XML::Smart
open $dtd, '<', 'SystemLinkRequest.dtd';
my $dtdContent = do { local $/; <$dtd> };
close $dtd;
$dtdContent =~ s/EMPTY//g;

$XML->apply_dtd($dtdContent);

## Turn off output of DTD and meta tag generation
my $xmldata = $XML->data(nometagen => 1, nodtd => 1);
$xmldata =~ s/?>/?>n<!DOCTYPE System-Link SYSTEM 'SystemLinkRequest.dtd'>/m;
## Store a clean version (no passwords) in the local XML file
my $xmldata_clean = $xmldata;
$xmldata_clean =~ s/userIds*=s*"$SQLUser"s+passwords*=s*"$SQLPass"/userId="REMOVED" password="REMOVED"/g;

my $xml_filename = $RELEASE . "-" . time . ".xml";
print LOGF "{DEBUG} [" . localtime(time) . "] tBuilding XML Request COMPLETEDn";
print LOGF "{DEBUG} [" . localtime(time) . "] tWriting XML Request to Request_$xml_filename STARTEDn";

open $RequestLogfile, '>', "$logsDir/XML/Update/Request_$xml_filename";
print $RequestLogfile "n--------------- QUERY REQUEST ---------------n";
print $RequestLogfile $xmldata;
close $RequestLogfile;


Works:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release";



Does not work:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40') ORDER BY order,line,release";



Now the XML I get.



Good XML ( Pql tag with CDATA ):



<QueryList domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN">
<Pql><![CDATA[SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release]]></Pql>
</QueryList>


Bad XML ( Pql attribute ):



<QueryList Pql="SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus &lt; '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus &lt; '40' ) ORDER BY order,line,release" domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN"/>


The only difference between the two lines of code is that the one that works has AND remainingQuantityForReleaseStockingUm > 0.000



So why does that impact the resulting XML?










share|improve this question















I have some code that creates XML differently based on a very simple string of characters. Does anyone know why?



First of all, code snippet ( to clarify things for @mob ), with the lines AROUND the problem line:



my $XML = XML::Smart->new();

my $mylogin = {
userId => $SQLUser,
password => $SQLPass,
maxIdle => '900000',
properties => '<hidden for privacy concerns>'
};
$XML->{'System-Link'}{Login} = $mylogin;

my $request = {
sessionHandle => '*current',
workHandle => '*new',
broker => 'EJB',
maxIdle => '900000'
};
$XML->{'System-Link'}{Request} = $request;

my $querylist = {
name => 'queryListPurchaseOrderItemRelease_SLTOKEN',
domainClass => '<hidden for privacy concerns>',
includeMetaData => 'true',
maxReturned => '1'
};
$XML->{'System-Link'}{Request}{QueryList} = $querylist;
### PROBLEM LINE GOES HERE, just subsitute one of below lines here

## Muck with the DTD cause 'EMPTY' causes problems, this is an issue w/ the implementation of XML::Smart
open $dtd, '<', 'SystemLinkRequest.dtd';
my $dtdContent = do { local $/; <$dtd> };
close $dtd;
$dtdContent =~ s/EMPTY//g;

$XML->apply_dtd($dtdContent);

## Turn off output of DTD and meta tag generation
my $xmldata = $XML->data(nometagen => 1, nodtd => 1);
$xmldata =~ s/?>/?>n<!DOCTYPE System-Link SYSTEM 'SystemLinkRequest.dtd'>/m;
## Store a clean version (no passwords) in the local XML file
my $xmldata_clean = $xmldata;
$xmldata_clean =~ s/userIds*=s*"$SQLUser"s+passwords*=s*"$SQLPass"/userId="REMOVED" password="REMOVED"/g;

my $xml_filename = $RELEASE . "-" . time . ".xml";
print LOGF "{DEBUG} [" . localtime(time) . "] tBuilding XML Request COMPLETEDn";
print LOGF "{DEBUG} [" . localtime(time) . "] tWriting XML Request to Request_$xml_filename STARTEDn";

open $RequestLogfile, '>', "$logsDir/XML/Update/Request_$xml_filename";
print $RequestLogfile "n--------------- QUERY REQUEST ---------------n";
print $RequestLogfile $xmldata;
close $RequestLogfile;


Works:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release";



Does not work:



$XML->{'System-Link'}{Request}{QueryList}{Pql} = "SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '$RELEASE' AND relatedQueryPurchaseOrder.orderStatus < '40') ORDER BY order,line,release";



Now the XML I get.



Good XML ( Pql tag with CDATA ):



<QueryList domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN">
<Pql><![CDATA[SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus < '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus < '40' AND remainingQuantityForReleaseStockingUm > 0.000) ORDER BY order,line,release]]></Pql>
</QueryList>


Bad XML ( Pql attribute ):



<QueryList Pql="SELECT order,line,item,release,dueToDockDate,dueToStockDate,userFieldAmount1 WHERE (releaseStatus &lt; '50' AND userFieldAmount1 = '4001166' AND relatedQueryPurchaseOrder.orderStatus &lt; '40' ) ORDER BY order,line,release" domainClass="com.mapics.pm.PoItemRelease" includeMetaData="true" maxReturned="1" name="queryListPurchaseOrderItemRelease_SLTOKEN"/>


The only difference between the two lines of code is that the one that works has AND remainingQuantityForReleaseStockingUm > 0.000



So why does that impact the resulting XML?







xml perl






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 23:38

























asked Nov 21 at 22:42









user3329922

511510




511510












  • You forgot to include the code.
    – mob
    Nov 21 at 23:25










  • What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
    – user3329922
    Nov 21 at 23:29










  • That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
    – mob
    Nov 21 at 23:35










  • Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
    – user3329922
    Nov 21 at 23:42


















  • You forgot to include the code.
    – mob
    Nov 21 at 23:25










  • What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
    – user3329922
    Nov 21 at 23:29










  • That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
    – mob
    Nov 21 at 23:35










  • Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
    – user3329922
    Nov 21 at 23:42
















You forgot to include the code.
– mob
Nov 21 at 23:25




You forgot to include the code.
– mob
Nov 21 at 23:25












What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
– user3329922
Nov 21 at 23:29




What I provided is the problem code snippet, the exact code that has the problem. What else can I provide to help? I was trying not to bog down the question with lots of code, keeping it simple.
– user3329922
Nov 21 at 23:29












That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
– mob
Nov 21 at 23:35




That code is just an assignment that updates a data structure. You did not describe how your data structure is converted to an XML document. You did not even describe which of the many available XML modules you are using.
– mob
Nov 21 at 23:35












Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
– user3329922
Nov 21 at 23:42




Done. What I don't understand is why simply adding "AND remainingQuantityForReleaseStockingUm > 0.000" to the assignment fixes the resulting XML. Hope I provided enough information.
– user3329922
Nov 21 at 23:42












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










XML::Smart::_data_type contains this code:



  return 3 if( $data && $data =~ /<.*?>/s    ) ;


where data type "3" indicates that the XML element should be rendered as CDATA. If that is the "good XML", it is only that way on accident.



I guess you could trick XML::Smart into rendering all your SQL queries as CDATA with an extra clause like



SELECT ... WHERE (... AND ... AND 1<>0) ORDER BY ...





share|improve this answer





















  • Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
    – user3329922
    Nov 23 at 23:07













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421449%2fperl-xml-setting-tag-value-issue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










XML::Smart::_data_type contains this code:



  return 3 if( $data && $data =~ /<.*?>/s    ) ;


where data type "3" indicates that the XML element should be rendered as CDATA. If that is the "good XML", it is only that way on accident.



I guess you could trick XML::Smart into rendering all your SQL queries as CDATA with an extra clause like



SELECT ... WHERE (... AND ... AND 1<>0) ORDER BY ...





share|improve this answer





















  • Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
    – user3329922
    Nov 23 at 23:07

















up vote
0
down vote



accepted










XML::Smart::_data_type contains this code:



  return 3 if( $data && $data =~ /<.*?>/s    ) ;


where data type "3" indicates that the XML element should be rendered as CDATA. If that is the "good XML", it is only that way on accident.



I guess you could trick XML::Smart into rendering all your SQL queries as CDATA with an extra clause like



SELECT ... WHERE (... AND ... AND 1<>0) ORDER BY ...





share|improve this answer





















  • Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
    – user3329922
    Nov 23 at 23:07















up vote
0
down vote



accepted







up vote
0
down vote



accepted






XML::Smart::_data_type contains this code:



  return 3 if( $data && $data =~ /<.*?>/s    ) ;


where data type "3" indicates that the XML element should be rendered as CDATA. If that is the "good XML", it is only that way on accident.



I guess you could trick XML::Smart into rendering all your SQL queries as CDATA with an extra clause like



SELECT ... WHERE (... AND ... AND 1<>0) ORDER BY ...





share|improve this answer












XML::Smart::_data_type contains this code:



  return 3 if( $data && $data =~ /<.*?>/s    ) ;


where data type "3" indicates that the XML element should be rendered as CDATA. If that is the "good XML", it is only that way on accident.



I guess you could trick XML::Smart into rendering all your SQL queries as CDATA with an extra clause like



SELECT ... WHERE (... AND ... AND 1<>0) ORDER BY ...






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 23:50









mob

95.7k13129250




95.7k13129250












  • Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
    – user3329922
    Nov 23 at 23:07




















  • Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
    – user3329922
    Nov 23 at 23:07


















Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
– user3329922
Nov 23 at 23:07






Also, for anyone curious, obviously using "1 > 0" works in my case as well. I used that on the extreme off chance the other system I am talking to uses some weird version of SQL that does not treat "<>" as not equal. Unlikely, but better safe than sorry and works in my case, producing "good" XML. But mob idea did work excellently, so I approved his solution.
– user3329922
Nov 23 at 23:07




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53421449%2fperl-xml-setting-tag-value-issue%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks