Ok, so I've finally decided on how to load my data I'm going to go with loading my book data as an XML file. The problem is that I'm not too sure on where to start, I've heard terms such 'parsing' but dont know how exactly it fits in.
I have added the code below if someone could give me a start in the right direction I would really appreciate that, to begin with all I want to do is load one line with my own comment under that and then the next line and so on.
<myBook>
− <chapter index="1" name="Chapter Name">
<line index="1" text="line text here"/>
<line index="2" text=" line text here "/>
<line index="3" text=" line text here "/>
<line index="4" text=" line text here "/>
<line index="5" text=" line text here "/>
<line index="6" text=" line text here "/>
<line index="7" text=" line text here "/>
</chapter>
Thanks guys,
Maybe this questions helps you: Navigating XML from Objective-C
There a some classes with which you can process your XML file. If you don't know about XML in general, read the Wikipedia article about XML. The most common techniques that are used to process XML are also described there.
Use Cocoa's XML parser?
Apple's NSXMLParser is an event based based on libXML, it is a SAX parser. I have found it to be slow when parsing large files on the iPhone 3G as it doesn't take advantage of libXML's xmlParseChunk() function.
Have you thought about using JSON as an alternative?
Do you really mean "load into Xcode" or are you talking about reading your custom XML file in your application? And didn't you ask this as How To load XML file into iPhone project ?
Related
I am trying to add line breaks to a editor placeholder in Xamarin with XAML. Unfortunately I cant use \n or < br/> for new lines.
Does anyone have a idea how to work around this behavior?
I tried this and it wont work:
<Editor Placeholder="This is one line \n this is the next one."/>
Expected result:
This is one line this is the next one.
My result:
This is one line \n this is the next one.
You should be able to use
, i.e.:
<Editor Placeholder="This is one line
this is the next one."/>
The &# notation is a XML encoding for special characters. See also this article on Wikipedia.
I am trying to add an ampersand like this:
<Label Text="Phrase & Meaning Visible" />
This doesn't work so I tried to delimit with a \ and that also does not work. Does anyone have any suggestions on how I can do this?
Actually this question is not about XAML, it's just a pure XML question. Some characters need to be escaped in XML, the correct escaping of & is &
Taken this with thanks from the following blog post.
Special Symbols in XAML
For Ampersand sign <Label Text="&"/>
For less than sign <Label Text="<">
For greater than sign <Label Text=">"/>
For double quotes <Label Text="""/>
In Microsoft Access 2016 (build 16.0.8201.2200), the VBA TransferSpreadsheet method is not working properly when the format of numbers in Windows 10 is customized, specifically, on computer with US region selected, if you swap "decimal symbol" and "digit grouping symbol" to be formatted like customary in Germany:
When I use TransferSpreadsheet to save a query, when I subsequently attempt to open that workbook in Excel, it says:
We have found some problem in some content in '...'. Do you want us to try to recover as much as we can?
When I do, I get the following warning:
Excel was able to open the file by repairing or removing the unreadable content.
When I look at the contents of the XLSX contents, I'm not surprised it's having a problem, because the internal XML is not well-formed. Because I've replaced the decimal separator to be "," in Windows, it's creating the numbers in the XML with commas, not decimal places. But XML standards dictate that regardless of your regional preferences, numbers in XML should use a "." as decimal symbol.
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1:K20"/>
<sheetViews>...</sheetViews>
<sheetFormatPr defaultRowHeight="15"/>
<sheetData>
<row outlineLevel="0" r="1">...</row>
<row outlineLevel="0" r="2">
...
<c r="D2" s="0">
<v>2,9328903531E+16</v>
</c>
<c r="E2" s="0">
<v>5,404939826E+16</v>
</c>
<c r="F2" s="0">
<v>2,3923963705E+16</v>
</c>
...
</row>
...
</sheetData>
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
</worksheet>
While the "," might be the desired format for decimal symbol in the UI, the XLSX internal format must conform to XML standard, "." decimal symbol.
How do I solve this?
Bottom line, for the TransferSpreadsheet method to work correctly, if you want to change the formatting of numbers, do not use the "Customize Format" setting:
You should instead reset those values back to their defaults, and then select an appropriate region in the preceding dialog box, one that formats numbers as you prefer:
Having choosen a region that is formatted as desired, you thereby avoid the TransferSpreadsheet bug. When you do this, the spreadsheet will appear correctly in Excel:
But the XLSX will be formatted properly, too:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
<dimension ref="D3:F3"/>
<sheetViews>
<sheetView tabSelected="1" workbookViewId="0">
<selection activeCell="F12" sqref="F12"/>
</sheetView>
</sheetViews>
<sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>
<cols>
<col min="4" max="6" width="26.85546875" style="1" bestFit="1" customWidth="1"/>
</cols>
<sheetData>
<row r="3" spans="4:6" x14ac:dyDescent="0.25">
<c r="D3" s="1">
<v>2.9328903531E+16</v>
</c>
<c r="E3" s="1">
<v>5.40493826E+16</v>
</c>
<c r="F3" s="1">
<v>2.3923963705E+16</v>
</c>
</row>
</sheetData>
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
</worksheet>
I have this piece of code:
<Component Id="defaultInstallDirRegistry_component" Guid='{XXXXXX}'>
<RegistryValue Root="HKLM" Key="Software\[Manufacturer]\[ProductName]\ExchangeDatabase" Name="<default>" Value="" Type="string" Action="write" KeyPath='yes' />
</Component>
but when I try to compile ti
error CNDL0104 : Not a valid source file; detail: '<', hexadecimal
value 0x3c, is an invalid character.
I know that cause a problem but do not know how to solve it... I tried use CDATA but it does not help...
Any idea? Thanks
Or you can use the standard XML entity encoding for the '<' character since that is the core issue in this situation.
Change: 'Name="<default>" '
To: 'Name="<default>" ' (will work, and is easy for humans to read)
Or to: 'Name="<default>" ' (for more consistent reading)
Ok, so solution to this problem is use notation < ; (without whitespace) so if you want to write such a character just use notation &#xNNNN where NNNN is hexa code of your char...
I’m trying to decide the best way to load data into my app, it’s basically a book, but I want to have control of the chapter line number and chapter name ( so I can add comments and notes under relevant lines) etc. Both options allow me to do this. There’s going to be about 25 large-ish chapters.
What would be the best overall in terms of the iPhone platform? The data is already on my computer I just need to select which format is the best?
I think things like memory management and perhaps other limitations within the iphone need to be considered?
Are there any other factors which need to be taken into account?
Thanks guys,
Ok so here are the two possible options to load the data :
XML:
<toolTipsBook>
− <chapter index="1" name="Chapter Name">
<line index="1" text="line text here"/>
<line index="2" text=" line text here "/>
<line index="3" text=" line text here "/>
<line index="4" text=" line text here "/>
<line index="5" text=" line text here "/>
<line index="6" text=" line text here "/>
<line index="7" text=" line text here "/>
</chapter>
SQL Dump
-- Chapter 1 (Chapter 1)
INSERT INTO `book_text` (`index`, `chapter`, `line`, `text`) VALUES
(1, 1, 1, ' line text here '),
(2, 1, 2, ' line text here '),
(3, 1, 3, ' line text here '),
(4, 1, 4, ' line text here '),
(5, 1, 5, ' line text here '),
(6, 1, 6, ' line text here '),
(7, 1, 7, line text here ');
Apple's plist format is a good choice for hierarchical data on the iPhone. It's XML, but it's supported by Foundation, so importing is as easy as [NSDictionary dictionaryWithContentsOfFile:...].
I would suggest splitting everything into chapters and only keeping one or two loaded at a time if you're worried about memory.