Using Fuzi XML parser, is it possible to get inner html from xml document
I have an XML element
like this <q>This is a <i>question<\i> but <b>it is<\b> not working<\q>
. I am using Fuzi
to parse the bigger XML and the above text is the parsed version of that.
If I use xmlElement.children(tag: "q").first
, the response I get is this:
<q>This is a <i>question<\i> but <b>it is<\b> not working<\q>
If I use xmlElement.children(tag: "q").first.stringValue
, the response is This is a question but it is not working
.
My problem is I want to eliminate the q tags
and get the inner html
like this: This is a <i>question<\i> but <b>it is<\b> not working
But I cannot find any way of doing that.
Please help. Thanks.
See also questions close to this topic
-
Android WebView: how to scroll to an <a name=here> position
I'm loading a self-created HTML page into a
WebView
in an Android app.The HTML page contains a tag like
<a name="here"></a>
somewhere in the middle.After loading that page, I'd like to be able to programmatically scroll to that position, as if I had clicked on a
<a href="#here">here</a>
link.I tried with
loadURL
and withloadDataWithBaseURL
, with every possible parameter combinations that I could think of, without success.Note 1: I want to be able to scroll to that position after the page has been already displayed.
Note 2: I cannot use
scrollTo(x,y)
because I don't know the y position of that<a name="here">
anchor within the page. If I could figure out the y position in the page of that<a name>
tag, that would also solve the problem, but I don't know how to find that y value either.(P.S. I'm loading the self-created HTML page by calling
loadDataWithBaseURL(null, _html, null, null, null);
where _html is the string with my HTML page) -
Why is my background image animation not running?
I'm making a website to tell you the weather as a personal project to understand jquery and working with APIs. I'm trying to map the speed of the clouds moving along the screen to the wind speed. the problem is i can't get the clouds animation to work.
#clouds{ background-size: 300px 217px; height:300px; width:300px; margin: auto; background-repeat: repeat-x; animation:mymove infinite 10s; } @keyframes mymove { from { background-position: left bottom; } to { background-position: right bottom; } }
I expect the clouds to be moving from left to right but they're stationary
the html just in case
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Weather</title> <link rel="stylesheet" href="../static/css/style.css"> <script src="../app/jquery-3.3.1.min.js"></script> <script src="../static/js/getWeather.js"></script> <script src="../static/js/pageChange.js"></script> </head> <body> <div id="sun"> <div id="clouds"> </div> </div> </body>
-
Access to a C# object in a Javascript script
I'm working in a C# project. In a view, I need to work with a script (in Javascript) provided by my teacher. First of all, my view receive a List. For example: [location1,location2,location3]. Location has latitude and longitude parametres. In my Javascript, I have the function "L.marker([x,y]).addTo(mapa).on('click', onClick);". What I want is to pass location1.longitude and location1.latitude as parametrs of the marker function. How can I do it?
@model List<SistemaGestion.Helpers.JsonApiGoogle.Location> (some HTML code) <script> (code) for (var coordenadas in Model) { L.marker([coordenadas.latitude, coordenadas.longitude]).addTo(mapa).on('click', onClick); } </script>
-
<select> tag doesn't keep background color on iphone
So, basically, I can change the background color of a tag on my computer but when I open the website through and iPhone (doesn't matter if I'm using Safari or Chrome) the background color is that default gradient gray.
I also tried to do it through the javascript, didn't work.
NOTE: i am NOT talking about the menu, only about the box we see without the options below, the one that if we click it shows the menu.
-
Best Tools and Technologies to develop Metro App
I am new to Application Development. I want to know which are the best tools and technologies in the market to develop a Metro App where I can incorporate below functionalities :
- Search - To and From
- Show the Map -
GIF
File - Show Direction and Time.
- Show different points in Maps along with details.
Thanks.
-
All interface orientations must be supported unless the app requires full screen, uploading to appstore gives error
I've read other questions so it's not a duplicate. My issue is different.
In my previous version of live app on app store I ticked landscape orientation for iPad. I want to make my app in portrait mode only for all devices. I've unticked all orientations except Portrait for iPad.
Deployment Info With this settings I get following warning
warning: All interface orientations must be supported unless the app requires full screen.
The solution as suggested by other questions is to tick Requires full screen option which I did but this doesn't allow me to upload app on appstore and it gives error which is my other question ERROR ITMS-90101: This bundle does not support one or more of the devices supported
How do I get it fixed so that I don't get warning and upload app on appstore.
-
Create action for invites
In my iOS application, I want to put a feature which will send invites to people selected in other applications like WhatsApp or other messaging services. I have no idea how to go about it. Please help me in this regard. A little guidance will be appreciated.
I tried to use WhatsApp to send invites. But I was unable to achieve it.
@IBAction func invite(_ sender: UIButton) { let ReferCode = UserDefaults.standard.string(forKey: "ReferCode") ?? "" let originalString = ReferCode let escapedString = originalString.addingPercentEncoding(withAllowedCharacters:CharacterSet.urlQueryAllowed) let url = URL(string: "whatsapp://send?text= Your referral code is\(escapedString!)") if UIApplication.shared.canOpenURL(url! as URL) { if #available(iOS 10.0, *) { UIApplication.shared.open(url! as URL, options: [:], completionHandler: nil) } else { // Fallback on earlier versions } } }
When I am pressing the invite button, the app is crashing.
-
Swift 4 - Pass Data To TableView Embedded In Collection View Cell
I'm creating a weather app in swift. There is a main view controller and within the controller, there is a collection view with two cells. In each cell there is a tableview.
In the view controller, there is a network call and an array is filled with data. The goal is to pass this data into each tableview cell to display it
I have created a diagram to display how the collection view and tableviews are set out.
If there is a way to do this then any help would be greatly appreciated!
-
Reading xml and locating the rows in tiff file
I have RDCL 2015 dataset containing the ground truth and sample images with tiff extension. I want to take in ground truth from the xml files and images from the tiff.
The objective is to read the XML and locate the rows within the .tiff files
I am new to this field so I don't have any idea how it's done any suggestion will be helpful. Thanks in advance
-
Java - Mapping Elements and Characters from XMLHandler
I have a Java class that extends from
Defaultandler
and I have four override methods:startDocument
,startElement
,endElement
andcharacters
that read a XML file.startElement
method returns theqName
that is the tag name.characters
method returns the value from the previous tag.This is my code:
Logger logger = LoggerFactory.getLogger(ParserXMLHandler.class); @Override public void startDocument() throws SAXException { logger.info("startDocument"); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { logger.info("startElement: uri:{} localName:{} qName: {} attributes: {}", uri, localName, qName, attributes.toString()); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { logger.info("startElement: uri:{} localName:{} qName: {}", uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { logger.info("chunk: {}, offset: {}, length: {}", Arrays.copyOfRange(ch, start, start+length), start, length); }
I want to map the XML values (from characters method) with another Class Object.
So, how it works?
- Call
startElement
and get the tag name. - If that tag has a value (
<hello>world<hello>
) it calls tocharacter
method that returns the contentworld
. - If it doesn't contain a value (example
<hello><hi>world<hi><hello>
)startElement
calls to the same method and will returnhi
.
I have a big XML and I want to map only some tags and values with my class object.
Is there any way through a
HashMap
or another method where I tell you the values I want and add them to a list or array and then I read that array and pass it to an object? - Call
-
PHP simplexml_load_string() throws me an error: Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and body
Can somebody tell me please what means this error from simplexml_load_string(): Entity: line 6: parser error : Opening and ending tag mismatch: hr line 5 and body Request return this xml:
<?xml version="1.0"?> <IndexPodnikatela version="1.2" date="2019-02-14 14:33:20"> <error>Missing query parameter ico or nazov</error> </IndexPodnikatela>
This result becomes from API call. There is no line 6 and also no
<hr>
tag. It makes no sense to me. Is there any setting which force PHP to create well formated xml? -
Output HTML collections as a list JavaScript
I'm Trying to turn HTML element contents into a list using JavaScript. I'm using this code but it's only returning the last option - "option 6" - instead of each option line by line.
Can someone tell me what I'm missing please?
var getOptions = document.getElementsByClassName("aofi"); var i; for (i = 0; i < getOptions.length; i++) { document.getElementById("NewOutput").innerHTML = "<li>" + getOptions[i].innerHTML + "</li>"; }
<div class="allOptions"> <h2 class="aofi">option 1</h2> </div> <div class="allOptions"> <h2 class="aofi">option 2</h2> </div> <div class="allOptions"> <h2 class="aofi">option 3</h2> </div> <div class="allOptions"> <h2 class="aofi">option 4</h2> </div> <div class="allOptions"> <h2 class="aofi">option 5</h2> </div> <div class="allOptions"> <h2 class="aofi">option 6</h2> </div> <div id="NewOutput"></div>
-
Select element with a linked text for add new options - Angular 6
i have a select element with many options. I need to have one option with a link "add new option", and after clicked, show an input text element. I used a ng-select with ng-options, but in list options that show the html code " add new option . After that i tryied use the directive [InnerHtml] but i got the same error. After that i used ng-template but that show "", and for last i created my custom directive, but i cant show the link in the list.
Can anyone help me with the best way to do that?
What i have:
<ng-select *ngIf="..." id="..." class="" [formControlName]="..." [placeholder]="field.placeholder"> <ng-option *ngIf="..."> <span > link to click </span> </ng-option> <ng-option *ngFor="let val of x.options" [value]="x.id" >{{x.name}}</ng-option> </ng-select>
After i have a like i want use jquery to hide the link element and show input text element.
Cumps
-
Adding a listener to a button created by .innerHTML
I am trying to add a listener to a button created by .innerHTML after receiving a listener. This is the code:
let inputConfirm = document.getElementById('inputConfirm'); let inputText = document.getElementById('inputText'); let displayList = document.getElementById('displayList'); inputConfirm.addEventListener('click', e=>listElement()) const listElement = () => { let inputValue = inputText.value //takes input from textbox let newValue = "<li class='each-item'><div class='listbox'>" + inputValue + "<input type='checkbox' class='checkbox'><button class='delete-button'>X</button></div></li>"; //EACH list element that I want to add to the ordered list. if(inputValue !== ""){ displayList.innerHTML += newValue; inputText.value = "";//clears the text box }; };
I need the button with class "delete-button" created via newValue variable to be clickable and send a console.log