xml-parsing

Why are there #text nodes in my xml file?

帅比萌擦擦* 提交于 2019-12-10 03:39:35
问题 I'm making an android application that does DOM parsing on an xml file. I have an xml file that looks like this: <?xml version="1.0" encoding="utf-8"?> <family> <grandparent> <parent1> <child1>Foo</child1> <child2>Bar</child2> </parent1> <parent2> <child1>Raz</child1> <child2>Mataz</child2> </parent2> </grandparent> </family> If I run a dom parser on it, like this: try { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = builder.parse(input);

StAX XML all content between two required tags

可紊 提交于 2019-12-10 03:34:19
问题 Starting learning the StAX, using XMLStreamReader, I faced with some problem. How can I get ALL content between tags as Text? I mean, I know name of needed tag, and when I find it, I must go to the close tag, and everything I found between them I must append at some string. For example, we have something like <rootTag> ... <someTag> Some text content and other tags here… </someTag > <tagINeed> <someinternalTag1> <someinternalTag11> Some text content.. </someinternalTag11> ... <

How to select multiple nodes in different levels?

最后都变了- 提交于 2019-12-10 00:53:59
问题 Having this (simplified) XML: <?xml version="1.0" encoding="UTF-8"?> <kml> <Document> <Placemark> <name>Poly 1</name> <Polygon> <coordinates> -58.40844625779582,-34.60295278618136,0 </coordinates> </Polygon> </Placemark> <Placemark> <name>Poly 2</name> <Polygon> <coordinates> -58.40414334150432,-34.59992445476809,0 </coordinates> </Polygon> </Placemark> </Document> </kml> How can I select the name and coordinates of each Placemark? Right now I can select their name with the following XPath

Read inside a Specific Tag using XPath with multiple conditions Java

試著忘記壹切 提交于 2019-12-10 00:22:02
问题 <?xml version="1.0" encoding="UTF-8"?> -<ADOXML adoversion="Version 5.1" username="kvarga" database="adonisdb" time="08:55" date="30.11.2013" version="3.1"> -<MODELS> -<MODEL version="" applib="ADONIS BPMS BP Library 5.1" libtype="bp" modeltype="Business process model" name="Product development" id="mod.25602"> -<MODELATTRIBUTES> <ATTRIBUTE name="Version number" type="STRING"> </ATTRIBUTE> <ATTRIBUTE name="Author" type="STRING">kvarga</ATTRIBUTE> <ATTRIBUTE name="Creation date" type="STRING"

dynamically read xml element and value in java

倾然丶 夕夏残阳落幕 提交于 2019-12-10 00:05:24
问题 I'm trying to read XML(whatever, i don't know it's structure, bcz i'm reading flie from server.), and i searched a lot on SO. but not found anything helpful. 1> i want to retrieve XML's node name, starting from root to end of file, child or child of child untill there's no child or sibling remaining. 2> in similar question, i found that they use tagname to retrieve value of that tag, so i want to pass that node name inside this to get value... is it possible to do dynamically. or have to

How to trim spaces in xml tags using regular expression in notepad++?

别来无恙 提交于 2019-12-09 22:18:57
问题 I am trying to trim a space in an XML tag, this is an example of what I have: <xmlT ag> content between tag </xmlTa g> to: <xmlTag> content between tag </xmlTag> This is the expression that I wrote for that: Find: [<](\w)* (\w)*[>]|[<][/](\w)* (\w)*[>] Replace: \1\2 but is not working as expected. Is there any other workaround for this? 回答1: If the tags only have one space in them and no attributes, this will work find: <(/?)(\w*) (\w*)> replace: <\1\2\3> 回答2: Using a LookAhead we can repair

XQuery nested return flower

佐手、 提交于 2019-12-09 19:25:39
问题 I'm stuck with a seemingly simple XQuery exercise. Below a piece of the XML file. <Ships> <Class name = "Kongo" type = "bc" country = "Japan" numGuns = "8" bore = "14" displacement = "32000"> <Ship name = "Kongo" launched = "1913" /> <Ship name = "Hiei" launched = "1914" /> <Ship name = "Kirishima" launched = "1915"> <Battle outcome = "sunk">Guadalcanal</Battle> </Ship> <Ship name = "Haruna" launched = "1915" /> </Class> </Ships> I'm trying to transform the XML into an XHTML with the Class

XML/JSON POST with RequestBody in Spring REST Controller

一世执手 提交于 2019-12-09 13:13:23
问题 I am creating a RESTful website with Spring 3.0. I am using ContentNegotiatingViewResolver as well as HTTP Message Convertors (like MappingJacksonHttpMessageConverter for JSON, MarshallingHttpMessageConverter for XML, etc.). I am able to get the XML content successfully, if I use the .xml suffix in the last of url and same in case of JSON with .json suffix in URL. Getting XML/JSON contents from controller doesn't produce any problem for me. But, how can I POST the XML/JSON with request body

How can I send multiple url request from a NSURLConnection delegate?

匆匆过客 提交于 2019-12-09 06:43:15
问题 This is the logical flow for my application: At first, when the view controller has finished loading, then a NSURLConnection request can start its execution The response consists in xml data After parsing that xml I need to send another NSURLConnection request. After sending the second request, if the response is ok, I receive other xml data After parsing the second xml, I have to check some issues between first and second xml data. So, is it possible to send multiple request? How? I do not

Parsing a xml file using simplexml and accessing properties

↘锁芯ラ 提交于 2019-12-09 03:23:42
问题 I am trying to parse a xml file which has this structure: <?xml version="1.0" encoding="UTF-8" ?> - <uclassify xmlns="http://api.uclassify.com/1/ResponseSchema" version="1.00"> <status success="true" statusCode="2000" /> - <readCalls> - <classify id="cls1"> - <classification> <class className="Arts" p="0.920034" /> <class className="Business" p="2.81823e-005" /> <class className="Computers" p="0.0040341" /> <class className="Games" p="0.00846496" /> <class className="Health" p="0.00203198" />