Hi I'm having a problem with my xml file for my android app. It's spitting out this error
error: invalid start tag Category . . . here is the source code.
<?xml version="1.0" encoding="UTF-8" ?>
<Category>
<destination id="1" main_cat="Hotel">
<timestamp></timestamp>
<business_name><![CDATA[ Sugarland Hotel ]]></business_name>
<alias><![CDATA[ Sugarland Hotel ]]></alias>
<address><![CDATA[ Araneta Avenue ]]></address>
<city><![CDATA[ Bacolod ]]></city>
<subcategory><![CDATA[ Hotel ]]></subcategory>
<cuisine><![CDATA[ Italian,Asian ]]></cuisine>
<budget> </budget>
<features> </features>
<working_days><![CDATA[ Everyday ]]></working_days>
<opening><![CDATA[ 24/7 ]]></opening>
<ending> </ending>
<contact><![CDATA[ (34)435-2690 , (34)435-2780 ]]></contact>
<fax><![CDATA[ (34)435-2645 ]]></fax>
<email><![CDATA[ rooms#sugarlandhotel.com ]]></email>
<website><![CDATA[ www.sugarlandhotel.com ]]></website>
<payment_type><![CDATA[ cash,credit card,master card, visa ]]></payment_type>
<lat><![CDATA[ 10.6524789N ]]></lat>
<long><![CDATA[ 122.9372838E ]]></long>
<desc><![CDATA[ Experience a modern hacienda retreat that nurtures the charm and romance of old world plantation living. Extensively renovated beginning 2010, Sugarland hotel unvails a celebrated balance of nostalgia and contemporary style, Capturing its original southern elegence, luxury, and decadence. Machuca tiles form cool geometric patterns in the hallways. Hacienda hardwoord floors contrast modern furnishings and amenities in the dramatic suits. The sugarland lifestyle offers guests the finest sensory indulgences: signature hacienda service, soothing organic toiletries, heirloom recipes, and unmatched privacy and tranquility. ]]></desc>
<image> </image>
</destination>
</Category>
also i tried testing CDATA would i rather use it or go with xml schema. Thanks for the help in advance
Remove the whitespace in front of <?xml version="1.0" encoding="UTF-8" ?>. Nothing can appear before it.
Both IntelliJ and my browser say your XML is fine. There must be something else wrong.
Related
So I'm making business card for one local bar and I have run into problem with autoLink.
For some reason, map autoLink does not work with Latvian addresses. I tested same approach with US address (copied the formatting google gave me) and it worked just fine. When I do the same with Latvia addresses autoLink won't respond to it.
Here is my xml code:
<TextView
android:id="#+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:autoLink="map"
android:textSize="16sp"
android:layout_below="#id/about"
android:layout_toRightOf="#id/loc"
android:layout_marginTop="6dp"
/>
And strings code:
<string name="address">Kalēju iela 51, Centra rajons, Rīga, LV-1050, Latvija </string>
I tried writing address in US like format "51 Kaleju Street Riga, LV-1050", but it didn't work. I also tried bunch of other variations that came in my mind, but all unsuccessful.
Maybe someone has experience with this or just knows how to fix this? Maybe some java code is needed?
Thanks in advance,
Sandra.
I'm stuck with the same problem.
But what I found:
"They haven't optimized the android:autoLink maps to India still. Works with US addresses only."
I guess the same goes for Latvia as for India - still doesn't work.
I think we have to use Intents ;(
Here's one that's driving me crazy:
I have recently started looking into Appcelerator Titanium. I have built a few small apps both with a normal project and using Alloy so I understand the basics at least.
One thing I just cannot get working is the i18n folder/files.
Here is what ive done:
- Create a "Default Project"
- add folder to root directory "i18n"
- add "en" and "es" folder to "i18n"
- add "strings.xml" to both those new folders.
- added:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome TEST</string>
</resources>
to both the strings.xml, except in the es strings I put "ES Welcome TEST".
- In Resources -> app.js I changed "I am Window 1" to L('welcome_message')
- Ran the application
Both the normal and alloy versions just show a blank screen. I would like to get my alloy app working the most but from what I understand the localization code should work the same in both apps. In alloy I may just have to put it in the style.
Any pointers would be great! I have looked at other post claiming its not working but all of them were either syntax errors or just set it up wrong. I have copied their code and have the exact same issue with it not working so I have a feeling im missing a newbie step.
-- Here are some screenshots, I just created a brand new regular(not alloy) project, added the code above and try to use L('welcome_message') to no luck. I tried installing everything on a new PC to make sure I wasn't messing anything up on my main computer.
Heres the answer:
https://wiki.appcelerator.org/display/guides/Internationalization
Ends up by default your manifest file is not setup by default to allow localization UNLESS you choose a tabbed project.
Kinda silly if you ask me.
For the topic poster:
My new string.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Don't Help Austin</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
Screenshot of my non-Alloy experiment:
For those looking to answer the question in the topic, this is a possible answer below.
My i18n folder is on the same hierarchy level as app and plugins, so mine isn't inside the app folder like the rest of the Alloy resources.
index.xml
<Alloy>
<Window class="container">
<Label id="label" onClick="doClick"></Label>
</Window>
</Alloy>
index.tss
".container": {
backgroundColor:"white"
},
"Label": {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#000",
text: L("welcome_message")
}
strings.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="welcome_message">Welcome to Kitchen Sink for Titanium</string>
<string name="user_agent_message">user agent set to</string>
<string name="format_test">Your name is %s</string>
<string name="base_ui_title">Base UI</string>
<string name="controls_win_title">Controls</string>
<string name="phone_win_title">Phone</string>
<string name="platform_win_title">Platform</string>
<string name="mashups_win_title">Mashups</string>
<string name="ordered">Hi %1$s, my name is %2$s</string>
</resources>
When I placed the L("welcome_message") inside the index.xml, it didn't work.
It may be a basic question but I am new to xml parsing, that's why I need some help. So the question is: I just want to read a xml file from res folder in android and update the values for some tag in that file; so, howcan it be done? Please help me out. Following is the xml file and I want to update the value of the tag "event filter" which is currently having value "moneyback". I had searched many threads but still I am unable to solve the issue.
<?xml version="1.0" encoding="UTF-8"?>
<HawkAgentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<config>
<installedappthreadtime>10</installedappthreadtime>
<runningprocessthreadtime>10</runningprocessthreadtime>
<networkconnectionsthreadtime>10</networkconnectionsthreadtime>
</config>
<policy name="DayCapturePolicy" type="capture">
<starttime>9:00:00 AM</starttime>
<endtime>9:00:00 PM</endtime>
<event name="NEW_APP_INSTALLED">
<eventFilter selectedAppName="Moneyback"/>
<eventParam>selectedAppName</eventParam>
<eventParam>selectedAppVersion</eventParam>
<eventParam>appPackageName</eventParam>
<eventParam>appDirPath</eventParam>
</event>
<event name="NEW_PROCESS_STARTED">
<eventFilter runningAppName="Moneyback" />
<eventParam>runningAppName</eventParam>
<eventParam>runningAppProcessId</eventParam>
<eventParam>runningProcessName</eventParam>
</event>
<event name="INBOUND_CONNECTION">
<eventFilter netAppName="Moneyback"/>
<eventParam>netProtocol</eventParam>
<eventParam>netRemoteIP</eventParam>
<eventParam>netRemotePort</eventParam>
<eventParam>netStatus</eventParam>
<eventParam>netUID</eventParam>
<eventParam>netAppName</eventParam>
</event>
<event name="OUTBOUND_CONNECTION">
<eventFilter netAppName="Moneyback"/>
<eventParam>netProtocol</eventParam>
<eventParam>netRemoteIP</eventParam>
<eventParam>netRemotePort</eventParam>
<eventParam>netStatus</eventParam>
<eventParam>netUID</eventParam>
<eventParam>netAppName</eventParam>
</event>
</policy>
</HawkAgentPolicy>
Using the DDMS view in Eclipse, I see there is the possibility of using KML files to feed locations to the AVD. I have an app that listens for locations and moves a Google mapview around, drawing lines from one spot to another. When I manually feed it using the manual tab it works fine.
However when I try to open a valid KML file, nothing happens. I have hundreds of valid KML files that work just fine in Google Earth, Bing Maps, and Google Maps. But the DDMS emulator control does not open them. No error of any kind, it just doesn't open them. I pasted a small KML file below.
(There is a problem with this forum software. When I paste code and such it does not capture everything so it looks like an invalid file but it's not. It usually catches the first line, skips a bunch of other lines, and then shows the rest of the file. It does this with Java code too).
Thanks,
Gary
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Name>_Name</Name>
<Style id="mTTPathStyle">
<LineStyle>
<color>aaff0000</color>
<width>4</width>
</LineStyle>
</Style>
<Style id="StartIconStyle">
<IconStyle>
<Icon><href>http://dl.dropbox.com/u/39662979/start.png</href></Icon>
<hotSpot x="0.5" y="0.0" xunits="fraction" yunits="fraction" />
</IconStyle>
</Style>
<Style id="FinishIconStyle">
<IconStyle>
<Icon><href>http://dl.dropbox.com/u/39662979/finish.png</href></Icon>
<hotSpot x="0.5" y="0.0" xunits="fraction" yunits="fraction" />
</IconStyle>
</Style>
<Folder>
<name>Test1</name>
<open>1</open>
<Placemark><name><![CDATA[6/3/2012 4:00:34 PM]]></name><visibility>1</visibility><styleUrl>#StartIconStyle</styleUrl><Point><coordinates>-111.03501118, 31.79118389, 893.5 </coordinates></Point></Placemark>
<Placemark><name><![CDATA[6/3/2012 4:01:55 PM]]></name><visibility>1</visibility><description>Test1 0.37 Miles 1 min, 21 sec 16.7 MPH</description><styleUrl>#FinishIconStyle</styleUrl><Point><coordinates>-111.03053401,31.79307061,932.299987792969 </coordinates></Point></Placemark>
<Folder><name><![CDATA[Path]]></name><open>0</open><Placemark><name>only Segment for now</name><styleUrl>#mTTPathStyle</styleUrl><LineString><extrude>0</extrude><tessellate>1</tessellate><altitudeMode>clampToGround</altitudeMode><coordinates>-111.03501118,31.79118389,893.5 -111.0352843,31.79227626,917.299987792969 -111.03510817,31.79219134,927.099975585938 -111.03491294,31.79222276,927.5 -111.03483045,31.79230171,928 -111.03465771,31.79236738,929.799987792969 -111.03418779,31.79235829,933.799987792969 -111.03282738,31.79241828,934.799987792969 -111.03200371,31.79269077,932.099975585938 -111.03157208,31.79302646,933.900024414063 -111.0311052,31.79310853,933.599975585938 -111.03053401,31.79307061,932.299987792969 </coordinates></LineString></Placemark></Folder>
</Folder>
As it turns out what is valid KML for Google Earth, Google Maps, and Bing Maps is not valid KML for Eclipse. However there is a KML converter at http://ge2adt.appspot.com/ (need Google groupslogin creds). I converted several of my KML files and they work great now in Eclipse.
Gary Blakely
Let's go to the point..
I make an Android application which target is Google APIs (Platform 2.2).
I want to parse the XML File which comes from the REST API.
The XML file likes this:
<title>EARTH WIND & FIRE Live in Concert</title>
I store that output in my String variable, which I can use later and since the output is in XML, I use XML Parser class of course.
And as you can see, since the rule of XML format doesn't allow the naked character, in this case my '&' character, it will show:
<title>EARTH WIND & FIRE Live in Concert</title>
So I change that character with this method: xml.replaceAll("&", "<![CDATA[&]]>");
xml is String and I replace my & with <![CDATA[&]]> tag.
And I follow this: Android how to parse CDATA TAG?
It says that I must use dbf.setCoalescing(true);
Everything goes fine and in my TextView shows the words EARTH WIND & FIRE Live in Concert. The ampersand character (&) is shown in my emulator (Platform 2.2).
But, when I try it in the device (Platform 2.1), it will show only EARTH WIND.
And I make the new emulator Google APIs (Platform 2.1), it shows EARTH WIND too.
Does anyone here face the same problem with me??
Is there any compatibility issue with the XML Parser or the <![CDATA[]]> tag in Android??
Thanks in advance...
In String.xml in resouces folder
<string name="my_string"><![CDATA[Please put Your long text here ]]></string>
if you want to access this string for textview:
<TextView
android:id="#+id/my_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/my_string"
android:textColor="#android:color/white"
android:textSize="14sp"
android:textStyle="bold" />