C# Localization: 'Designer.resx' file does not autogenerate when using specific keys - c#

Edit: I have confirmed that there are no duplicate names or invisible characters in my .resx file. Even now when I just revert to the faulty keys mentioned below in the .resx file, the Designer.resx stops autogenerating.
Following is the snippet of my .resx file:
<data
name="Account_Confirm"
xml:space="preserve">
<value>Confirm</value>
</data>
<data
name="Account_Facilities"
xml:space="preserve">
<value>Facilities</value>
</data>
<!--***********************
NOTIFICATIONS PAGE
***********************-->
<data
name="Notifications_NOTIFICATIONS"
xml:space="preserve">
<value>NOTIFICATIONS</value>
</data>
<data
name="Notifications_All"
xml:space="preserve">
<value>All</value>
</data>
<!--***********************
PAYMENT DETAILS PAGE
***********************-->
<data
name="PaymentDetails_PAYBYPHONE"
xml:space="preserve">
<value>PAY BY PHONE </value>
</data>
<data
name="PaymentDetails_PAYMENT"
xml:space="preserve">
<value>PAYMENT</value>
</data>
<data
name="PaymentDetails_Call"
xml:space="preserve">
<value>Call</value>
</data>
The Designer.resx would not just auto generate.
After trying various options and playing around for hours by commenting lines of code one by one to find the culprit line I noticed.
Changing,
name="PaymentDetails_PAYBYPHONE"
to
name="PaymentDetails_PAYBYPHONECAPS"
And Changing,
name="PaymentDetails_Call"
To
name="PaymentDetails_CallText"
Fixes the issue. After this change the Designer.resx is always auto generated with each change to the resxfile.
What could be the root cause of the issue?

Related

Converting graphml to image

I have this script that creates a .graphml file, and it looks great in yEd (Link to software), but I'm trying to automate the extra step of having this file, opening it in a different program, doing some edits in there etc etc.
I was wondering if there was some way to automate this into a png image, preferably a hexagonal grid or Vornoi in C#, depending on whether or not each node is connected to exactly 6 or not.
The .graphml file structure looks as follows:
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="d2" for="node" attr.name="value" attr.type="long" />
<key id="d1" for="node" attr.name="y" attr.type="long" />
<key id="d0" for="node" attr.name="x" attr.type="long" />
<graph edgedefault="directed">
<node id="(0, 1)">
<data key="d0">0</data>
<data key="d1">1</data>
<data key="d2">0</data>
</node>
.
.
.
<node id="(39, 38)">
<data key="d0">39</data>
<data key="d1">38</data>
<data key="d2">4</data>
</node>
<edge source="(0, 1)" target="(1, 1)"></edge>
<edge source="(0, 1)" target="(0, 2)"></edge>
.
.
.
<edge source="(39, 38)" target="(38, 39)"></edge>
</graph>
</graphml>
The value is a direct one-to-one mapping of the node's colour.
And the coordinates are in the following pattern if it were a regular hexagonal grid:
Hope this query makes sense!
Kind regards.

XML Name Cannot Begin with the "=" Character

I've read through the similar post of % character but it seems the other issues can be solved in the header line. Are there certain characters not allowed in XML or do I need to format the document another way (In my case the "=" character is giving me trouble when trying to read in the document in C#)?
Name cannot begin with the character ' ', also similar but still fixed by header.
XElement nodes = XElement.Load(filename);
The structure of the XML is below:
<?xml version="1.0" encoding="utf-8"?>
<offer>
<data id="Salary">
<ocrstring>which is equal to $60,000.00 if working 40 hours per week</ocrstring>
<rule>.*(([+-]?\$[0-9]{1,3}(?:,?[0-9]{3})*\.[0-9]{2}))</rule>
<output></output>
</data>
<data id="Hours">
<ocrstring></ocrstring>
<rule>"(?<=working).*?(?=hours)"</rule> <!-- Error Occurring Here -->
<output>bob</output>
</data>
<data id="Location">
<ocrstring></ocrstring>
<rule>Regex2</rule>
<output>LongWindingRoad222</output>
</data>
</offer>
How can I parse the XML Document without getting the Cannot Begin with Character "=" Error
You need to use CDATA sections for all the <rule> elements.
What does <![CDATA[]]> in XML mean?
XML
<?xml version="1.0" encoding="utf-8"?>
<offer>
<data id="Salary">
<ocrstring>which is equal to $60,000.00 if working 40 hours per week</ocrstring>
<rule><![CDATA[.*(([+-]?\$[0-9]{1,3}(?:,?[0-9]{3})*\.[0-9]{2}))]]></rule>
<output></output>
</data>
<data id="Hours">
<ocrstring></ocrstring>
<rule><![CDATA["(?<=working).*?(?=hours)"]]></rule>
<!-- Error Occurring Here -->
<output>bob</output>
</data>
<data id="Location">
<ocrstring></ocrstring>
<rule>Regex2</rule>
<output>LongWindingRoad222</output>
</data>
</offer>

SOAP message prefix issue

I have a SOAP message like following:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:SaveMethod xmlns:ns1="urn:MyService" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<data xsi:type="xsd:string">
<![CDATA[
<?xml version='1.0' encoding='iso-8859-1'?>
<test>123</test>
]]>
</data>
</ns1:SaveMethod>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My WCF is working fine when the SaveMethod tag is without prefix e.g.
<SaveMethod>
<data xsi:type="xsd:string">
etc.
But since i am not able to edit the SOAP message i need to find out how to make the SaveMethod accept the tag with prefix ns1.
Btw my method is as follows:
public void SaveMethod(String data){
// do something
}
Maybe i can do something on the client-side (HttpWebRequest used btw) ??
Thank you very much

Xslt 1.0 XML to excel transformation issue

I'm using the .Net framework's XslCompiledTransform class as the XSLT processor (in other words Xslt 1.0).
My requirement is that I want to convert an XML file to an Excel file (xls file) using XSLT 1.0 and .Net [4.0].
For simplicity and since this is just test code, I'm just considering some simple hard-coding on my Xsl file.
Specifically, my two questions are:
I've tried a bunch of things, yet I can't see my Excel sheet's worksheet named to "wAbc" which is what I'm trying to name it. I see the worksheet name as my file name. Additional worksheets are not generated as well. Below is my XSL file
Additionally, since this is test code, I can't see the data outputted on different rows unless I use HTML tags . What I see is: AbcNext line instead of
Abc
Nextline
So what am I doing wrong? Thank you in advance for your time and help.
I set the content type for my file response as
application/vnd.ms-excel
Here is my test Xsl file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<xsl:template match="/">
<xsl:processing-instruction name="mso-application">progid='Excel.Sheet'</xsl:processing-instruction>
<Workbook>
<Worksheet ss:Name="wAbc">
<Table ss:ExpandedColumnCount="2" x:FullColumns="1" x:FullRows="1" ss:DefaultRowHeight="15">
<Column ss:AutoFitWidth="20" ss:AutoWidth="65"></Column>
<Row>
<Cell>
<Data ss:Type="String">Abc</Data>
</Cell>
</Row>
<Row>
<Cell>
<Data ss:Type="String">Next line</Data>
</Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
</WorksheetOptions>
</Worksheet>
</Workbook>
</xsl:template>
</xsl:stylesheet>
You are using Excel XML as the format here (so, not strictly an XLS file, which is binary).
But in any case, I can see two issues with the Excel XML you are currently outputting. Firstly, I think the ss:AutoFitWidth attribute on the Column element needs to be set to 1 (or 0). I don't think 20 is a valid value.
See http://msdn.microsoft.com/en-us/library/aa140066(v=office.10).aspx for the list of possible values.
Addtionally, I think you may (although I am not 100% sure on this) need to set the ss:ExpandedRowCount on the Table element as well as the ss:ExpandedColumnCount.
See if changing one or both of these fixes your errors.
Excel XLS files use a Microsoft proprietary binary format - no way to generate that with an XSLT.
The (relatively) new XSLX format is a set of XML files that are ZIPped together, so in principle you can generate these files with an XSLT, and then ZIP them to generate the final file - still not very easy. To see these files simply un-ZIP an XSLX file.
I suggest you generate a simpler format - either a CSV or an intermediate XML- and then import it into Excel.

Save XML directly to Database with C#

Here is a part of my xml file
<teams>
<team-profile>
<name>Australia</name>
<id>1</id>
<stats type="Test">
<span>1877-2010</span>
<matches>721</matches>
<won>339</won>
<lost>186</lost>
<tied>2</tied>
<draw>194</draw>
<percentage>47.01</percentage>
</stats>
<squad>
<player id="135" fullname="Shane Warne"/>
<player id="136" fullname="Damien Martyn"/>
<player id="138" fullname="Michael Clarke"/>
</squad>
</team-profile>
</team>
I have read somewhere that there is a way to save this XML directly to database. I am using VS2010. I have created the dataset, for the data i need from this xml. Is there any way to map this XML directly on dataset?
Any other idea?
I also have to save some other more complex XML files to database.
I have tried xsd.exe to create xsd schema for this XML.
SQL Server 2005+ has a native XML datatype, if you create a column, you can simply do an insert into that column, here is an insert similar to yours, this table's second column's datatype is xml
INSERT INTO docs VALUES (1, '<book genre="security"
publicationdate="2002" ISBN="0-7356-1588-2">
<title>Writing Secure Code</title>
<author>
<first-name>Michael</first-name>
<last-name>Howard</last-name>
</author>
<author>
<first-name>David</first-name>
<last-name>LeBlanc</last-name>
</author>
<price>39.99</price>
</book>')
INSERT INTO docs VALUES (2,
'<doc id="123">
<sections>
<section num="1"><title>XML Schema</title></section>
<section num="3"><title>Benefits</title></section>
<section num="4"><title>Features</title></section>
</sections>
</doc>')

Categories