FAQ Database Discussion Community


Count by checking XML child tag

mysql,sql,sql-server,xml-parsing
I want to count child elements based on an if condition. Declare @MainXml XML = '<root> <Data> <a>FAIL</a> </Data> <Data> <a>PASS</a> </Data> <Data> <a>PASS</a> </Data> <root>' I want to get the amount of "Data" elements where the child element "a"'s value is "FAIL". The above count is 1. I am...

How can I read a single XML item

xml,python-2.7,xml-parsing
I tried using this example from this tutorial(Here's a link): #!/usr/bin/python import xml.sax class MovieHandler( xml.sax.ContentHandler ): code........ if ( __name__ == "__main__"): # create an XMLReader parser = xml.sax.make_parser() # turn off namepsaces parser.setFeature(xml.sax.handler.feature_namespaces, 0) # override the default ContextHandler Handler = MovieHandler() parser.setContentHandler( Handler ) parser.parse("movies.xml") which gives...

Best way for XML parsing in java [closed]

java,xml-parsing,jackson
I am using stax to parse an XML containg HTML and custom tags in java. The XML looks like this <html><div>Hello World</div><div><br /></div> <div><br /> <Resource type="audio/m4a" height="72.00" id="lh6rde3c1d39148804cea99b054f4cc4bb990" width="72.00" /> <br /><br /></div> <div><br /> </div><div>asfasdfasdfasdf</div><div><br /></div><div><br...

XML parsing using Ruby for provided URL

ruby,xml-parsing,nokogiri,libxml-ruby
I am trying to use Nokogiri to parse my XML which is I am getting from an URL, but I am not able to create an array of it so that it would be accessible all over the project. My XML: <component name="Hero"> <topic name="i1"> <subtopic name=""> <links> <link Dur=""...

Parsing XML Python

python,xml,parsing,xml-parsing,newline
I am using xml.etree.ElementTree to parse an XML file. I have a problem. I do not know how to obtain a plain text line between tags. <Sync time="4.496"/> <Background time="4.496" type="music" level="high"/> <Event desc="pause" type="noise" extent="instantaneous"/> Plain text <Sync time="7.186"/> <Event desc="b" type="noise" extent="instantaneous"/> Plain text <Sync time="10.949"/> Plain text...

Large XML Parsing Efficiently

c#,xml,performance,parsing,xml-parsing
I need to parse large XML Files and save data to MS SQL DB Tables. One way obviously to write C# Program. Obviously this raise a question of performance. Do you know any fastest and efficient way to process large scale XML?

Java Stringbuffer find and replace [duplicate]

java,regex,xml,xml-parsing,stringbuffer
This question already has an answer here: Xml Parse Edit Save and Create In Java [closed] 1 answer I need to replace the following text. String searchFor= "<aCriteria xmlns=\"http://www.a.com/schemas/b\" xmlns:s=\"http://www.b.com/common/a\">"; String replaceWith = "<aCriteria xmlns=\"http://www.a.com/schemas/b\" xmlns:s=\"http://b.com/common/a\" rawType=\"java.lang.Object\">"; int position = mainStringBuffer.lastIndexOf(searchFor); EDIT: The above code works fine. But I...

Conditional Search in XML Python

python,xml,xml-parsing,elementtree
I have a xml file Orders.xml (excerpt follows): <?xml version="1.0"?> <ListOrdersResponse xmlns="https://mws.amazonservices.com/Orders/2013-09-01"> <ListOrdersResult> <Orders> <Order> <LatestShipDate>2015-06-02T18:29:59Z</LatestShipDate> <OrderType>StandardOrder</OrderType> <PurchaseDate>2015-05-31T03:58:30Z</PurchaseDate> <AmazonOrderId>171-6355256-9594715</AmazonOrderId> <LastUpdateDate>2015-06-01T04:18:58Z</LastUpdateDate>...

Parse XML with Linq with multiple child elements

c#,xml,linq,xml-parsing
This is my first question on SO, please let me know if I am doing anything wrong! I am trying to parse an XML similar to this: <LiveUpdate> <CityID>F0A21EA2</CityID> <CityName>CityTown</CityName> <UserName>john</UserName> <ApplicationDetails> <ApplicationDetail Application="AC" Licensed="true" Version="2015.2" Patch="0001" /> <ApplicationDetail Application="AP" Licensed="true" Version="2015.2" Patch="0002" /> </ApplicationDetails> </LiveUpdate> I have classes that...

Parsing a xml file in afnetworking and retrieve data doesn't work

xml-parsing,afnetworking
With this url I tried but it doesn't work. Can someone help me to give simple xml parsing code and retrive data from this url? http://dynamic.feedsportal.com/pf/555218/http://toi.timesofindia.indiatimes.com/rssfeedstopstories.cms I tried but only reached at NSData * data1 = (NSData *)responseObject; NSString *fetchedXML = [NSString stringWithUTF8String:[data1 bytes]]; NSLog(@" xml data :: %@", fetchedXML);...

.ImportXML command erring out in MS Access

ms-access,xml-parsing,access-vba
I am using the following code to try to import an XML file to Access: my_file = "c:\temp\projects.xml" Application.ImportXML (my_file) At some point on the second line I get an error "Not all of your data was successfully imported. Error descriptions with associated row numbers of bad records can be...

comparing a string from an xml file how?

xml,c#-4.0,xml-parsing
I am new to this and breaking my head about it, well I got an XML file like : <?xml version="1.0" encoding="utf-8"?> <configuration> <Client> <add key="City" value="Amsterdam" /> <add key="Street" value="CoolSingel" /> <add key="PostalNr" value="1012AA" /> <add key="CountryCode" value="NL" /> I'm trying to read and compare a value from an...

How to print an empty XML element in perl

xml,perl,xml-parsing
I occasionally have to write simple perl scripts to export data from XML files into CSV files for loading into a database. I am encountering a problem "print"ing an element that has no value. Instead of just printing nothing, it prints the string "HASH(0x1ca05f8)" (or its siblings). How do I...

XML like data to CSV Conversion

c#,xml,parsing,csv,xml-parsing
So I have a device which has an inbuilt logger program which generates status messages about the device and keeps pushing them to a .txt file. These messages include information about the device status, network status amongst many other things. The data in the file looks something like the following:...

parsing a drugbank.xml file

python,python-2.7,xml-parsing
Am trying out this code from Github.com on a drugbank xml file. I keep getting this error messsage: usage: drugbank.py [-h] --input INPUT drugbank.py: error: the following arguments are required: --input/-i Being new to python, what could this mean? Here is the long code: def run(input): """Writes relational database text...

Read XML Attribute using C#

c#,xml,xml-parsing,xmlnode,xml-attribute
<Block ID="Ar0010100" BOX="185 211 825 278" ELEMENT_TYPE="h1" SEQ_NO="0" /> This is an example from my XML code. In C# I need to store ONLY ID'S inside of a block element in one variable, and ONLY Box's inside of a block element. I have been trying to do this for...

How would I create a callback around an XML request?

ios,swift,xml-parsing,callback
I've been trying to understand how callbacks work in Swift. I've gone over quite a few examples (like this one) that have helped me to better understand callbacks, but I haven't had any luck in properly implementing one. I have a function that accepts a URL, downloads some XML data...

Python XPath include missing elements

python,xml,xpath,xml-parsing
<tree> <item> <element1>somedata</element1> <element2>moredata</element2> <element3>data?</element3> <optional_element>data!</optional_element> </item> <item> <element1>somedata</element1> <element2>moredata</element2> <element3>data?</element3> </item> <item> <element1>somedata</element1> <element2>moredata</element2> <element3>data?</element3>...

XElement.Value is stripping XML tags from content

c#,.net,xml,xml-parsing,xelement
I have the following XML: <Message> <Identification>c387e36a-0d79-405a-745c-7fc3e1aa8160</Identification> <SerializedContent> {"Identification":"81d090ca-b913-4f15-854d-059055cc49ff","LogType":0,"LogContent":"{\"EntitiesChanges\":\" <audit> <username>acfc</username> <date>2015-06-04T15:15:34.7979485-03:00</date> <entities> <entity> <properties> <property> <name>DepId</name> <current>2</current> </property>...

How to fetch attribute value of parent node from child nodelist.(XPath)

xml,xpath,xml-parsing,attributes,parent-node
Here's the requirement I have a xml document which looks something like this -<page height="777" width="777"> -<block r="777" l="777" blockType="Separator"> +<region> +<separator> -<block r="777" l="777" blockType="Separator"> +<region> +<separator> -<block r="777" l="777" blockType="Text"> +<region> +<text> </page> I have all the separator blocks in separatorNodeList String expression = "//page/block/separator"; XPathExpression expr =...

Comment xml elements programmaticlly

c#,xml,xml-parsing
I have an xml file like below, <configuration> <property> <name>name</name> <value>dinesh</value> </property> <property> <name>city</name> <value>Delhi</value> </property> </configuration> My requirement is I need to comment / uncomment properties programmatically at runtime based on property's name like below; <configuration> <!-- <property> <name>name</name> <value>dinesh</value> </property> -->...

Need Parse XML to List, name field are separated from data c#,xml,web-services,xml-parsing
I am implementing a windows service and i need to consume a WebService with REST, I want to parse this to List but i dont know how. My problem is that the names of the fields are separated from the data. The structure I get is this: <?xml version="1.0" encoding="utf-8"...

Reading XML using PIG

xml,xml-parsing,apache-pig
I am trying to read the data from the xml file using PIG but I am getting incomplete output. Input File- <document> <url>htp://www.abc.com/</url> <category>Sports</category> <usercount>120</usercount> <reviews> <review>good site</review> <review>This is Avg site</review> <review>Bad site</review> </reviews> </document> and the code I am using is : register 'Desktop/piggybank-0.11.0.jar'; A = load 'input3'...

Swift parsing attribute name for given elementName

swift,xml-parsing,nsxmlparser,nsurl,xml-attribute
Here is a part of my URL <cities> <country name="Абхазия"> <city id="37188" region="27028" head="" type="3" country="Абхазия" part="" resort="" climate="">Новый Афон</city> <city id="37178" region="10282" head="" type="3" country="Абхазия" part="" resort="" climate="">Пицунда</city> <city id="37187" region="37187" head="" type="3" country="Абхазия" part="" resort="" climate="">Гудаута</city> <city id="37172" region="10280" head=""...

Can we change the XML namespace variable name in JDOM?

xml,xml-parsing,xml-namespaces,jdom,jdom-2
I've an XML: <OTC_RM xmlns="OTC_RM_11-0" xmlns:ns2="http://www.fpml.org/2010/FpML-4-9"> I wish to change the namespace variable name from ns2 to something else say fp using JDOM. And the change should reflect all across the XML document. Is it possible?...

split xml column into multiple columns

sql,sql-server,xml,xml-parsing
I need to split a column with into multiple columns using sql statement. This column saved in "dbo.ItemsEbay" table as "ItemSpecifics" Here is the example of one xml record from ItemSpecifics column: <SelectedValues haveDefaultsBeenSet="true"> <SelectedValue><Name>Consignment Status</Name><Value>False</Value></SelectedValue> <SelectedValue><Name>Salesperson</Name><Value>'Motya'</Value></SelectedValue> <SelectedValue><Name>Last Cycle...

Encoding Issue Causing MalformedByteSequenceException in Xerces UTF8Reader

java,xml,character-encoding,xml-parsing,xerces
I'm encountering com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException with an XML file. I stepped through the Xerces code with a debugger and narrowed down the area where this was ocurring. I was able to determine that by removing the "smart quote" characters in the document, the document becomes parseable. The document came with no DTD....

Get attibuteDict of a subclass Xml parsing - Swift

ios,swift,xml-parsing
I want to get attribute of a subclass of my item : <pdv id="1000002" latitude="4621842" longitude="522767" cp="01000" pop="R"> <adresse>16 Avenue de Marboz</adresse> <ville>BOURG-EN-BRESSE</ville> <ouverture debut="01:00" fin="01:00" saufjour=""/> <services> <service>Automate CB</service> <service>Vente de gaz domestique</service> </services> <prix nom="Gazole" id="1" maj="2015-05-30 11:30:17" valeur="1206"/> <prix nom="SP95" id="2" maj="2015-05-30 11:30:17"...

HTML page doesn't see AngularJS module

javascript,html,angularjs,xml-parsing
I am entirely new to AngularJS. The task is however simple: to parse XML file from the url and make a table out of it. Yet somehow angular doesn't load. I searched similar questions, but neither worked. My index.html: <!doctype html> <html ng-app="myApp"> <head> <title>jj</title> <script src="~/Scripts/angular.min.js"></script> <script src="~/Scripts/angular.intellisense.js"></script> <script...

How to print a result from multiple root elements in XML using Perl

regex,xml,perl,xml-parsing,centos
I'm starting out with Perl and doing all the bad things you can with the language. This program is using XML::Simple and Regular Expressions which the internet says do not do unless you hate yourself. Ok, the plan is to read an XML file from a website and read off...

Casting string to double, dot gets removed

c#,xml,xml-parsing
While casting from string to double, the dot gets removed, eg. for 0.01 after casting to double it gives 1, or for 3.22 it gives 322. Below is the Code I used. In log file I get Before Usage :- 0.01 After it Parse :- 1 while (reader.Read()) { XmlNodeType...

Selecting inner text of XML nodes and adding to list

c#,.net,xml,xml-parsing,selectnodes
I have the following XML file called file.xml: <?xml version="1.0"?> <cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"> <defaults> <serializer>pof</serializer> </defaults> <caching-scheme-mapping> <cache-mapping> <cache-name>broadcast-data|position</cache-name> <scheme-name>broadcast</scheme-name> </cache-mapping> <cache-mapping>...

Error:(1) Error parsing XML: not well-formed (invalid token)

android,xml,android-layout,xml-parsing
On right clicking the error "Error:(1) Error parsing XML: not well-formed (invalid token)" and then jump to source it opens the following activity_main.xml. I am not able to figure the error out <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" tools:context="com.example.utkarsh.beatle.app.MainActivity" android:layout_width="match_parent" android:layout_height="match_parent" tools:ignore="MergeRootFrame"/> Andoridmanifest.xml <?xml...

getNextSibling() method does not return any results

java,dom,xml-parsing
I am writing a code to read XML files and labeling the nodes. I am using the DOM Java. The method getNextSibling() is not returning any results as the other methods like getParentNode do. What could be the problem?

Read specific content of POM xml file through groovy xmlSurper and download dependecy

groovy,xml-parsing
I have a below POM file.I want to use xmlSlurper groovy code to read the specific content of the POM file Can someone tell me how to write the code to read the specific content through groovy xmlSlurper.I want to read the groupid artifact id,classifier and type of those whose...

Why is getElementsByTagName() not working for me?

php,xml,xml-parsing,domdocument
I am trying to get info from the OMDb API. I found some code but it's not working right: $loc = 'http://www.omdbapi.com/?t='.$lookup_title.'&r=xml'; $dom = new DOMDocument(); $dom->load($loc); foreach ($dom->getElementsByTagName('movie') as $e) { $imdb = $e->getElementsByTagName('imdbID')->item(0)->textContent; $year = $e->getElementsByTagName('year')->item(0)->textContent; $plot = $e->getElementsByTagName('plot')->item(0)->textContent; $poster =...

xml parsing error (xpath, HTMLagilitypack)

c#,xml,xpath,xml-parsing,html-agility-pack
I am trying to parse an xml. All nodes have opening and closing tags except one node that in some lines in only has this tag: <persons/> In most of the time it appears like this: <persons> ... </persons> I cannot get values from the xml when this node is...

How to pick up rows from XML for processing

xslt,xml-parsing
I would like to process some XML like that: <rows> <row> <country>AT</country> <some>element</some> </row> <row> <country>CZ</country> <some>element</some> </row> <row> <country>BG</country> <some>element</some> </row> <row> <country>CZ</country> <some>element</some> </row> </rows> I have to regroup rows to the target XML in this way: first must be rows with country 'CZ', then can be rows...

Create XML element without closing tag

xml,go,xml-parsing
I have this nested golang struct: // TierRequest is the outer most XML envelope of soap request type TierRequest struct { XMLName xml.Name `xml:"soapenv:Envelope"` NsEnv string `xml:"xmlns:soapenv,attr"` NsType string `xml:"xmlns:typ,attr"` Header string `xml:"soapenv:Header"` // TierBody is an emtpy container with the GetCollectorProfile struct type TierBody struct { GetCollectorProfiles GetCollectorProfile `Collectorxml:"typ:GetCollectorProfileRequest"`...

Parsing Complex Soap Response with diffgram

android,parsing,xml-parsing,ksoap2
I am not able to parse below soap response from a .net webservice,i am getting two type of response one is of anytype format which i have parsed it,but now i need to parse the below xml <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetReminderResponse xmlns="http://tempuri.org/"> <GetReminderResult> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema"...

How to find the end of an XML document in a stream with expat?

c,xml-parsing
I have a binary stream which contains concatenated XML documents. The stream is processed in chunks of arbitrary size using calls like this: int expat_status = XML_Parse(parser->expat, buffer, buffer_size, 0); How can I detect that a particular chunk of data contains the last byte of the currently parsed XML document...

LINQ to XML query Where() function not returning anything

c#,linq,parsing,xml-parsing,linq-to-xml
I have an XML file I would like to parse using LINQ in order to get all nodes containing the attribute ID. With this ID, the node's name, and it's grandparent's name, I would like to create an new object (of type EveItem) in the LINQ query. Here is a...

String parsing with batch scripting

windows,string,parsing,batch-file,xml-parsing
I have a file called pictures.xml and it contains some pictures information like: <ResourcePicture Name="a.jpg"> <GeneratedPicture Name="b.jpg"/> <GeneratedPicture Name="c.jpg"/> </ResourcePicture> <ResourcePicture Name="z1.jpg"> <GeneratedPicture Name="z2.jpg"/> <GeneratedPicture Name="z3.jpg"/> <GeneratedPicture Name="z4.jpg"/> </ResourcePicture> What I want do do is to get each line in for loop and print the names of the pictures. Sample...

Call function from a custom file with parameters

python,xml,xml-parsing
How to call a function from a custom external file and also to be able to have parameters? The external file is an XML file. The tags looks like this: <menu name="bar"> <option func="boo">Execute Me</option> <option func="foo" params="a, b, c, d">I want parameters</option> </menu> I want execute a function defined...

How to parse comment from XML with XMLEventReader?

java,xml,xml-parsing
I am parsing an incoming XML file with an XMLInputFactory like the following. How do I get the text out of an XML comment? I know how to detect it, but, not get the text out XMLInputFactory inputFactory = XMLInputFactory.newInstance(); FileInputStream fis = new FileInputStream(incomingFile); XMLEventReader eventReader = inputFactory.createXMLEventReader(fis); while...

XML Namespace URI with HTTPS?

xml,xml-parsing,schema,uri,xml-namespaces
Is it better to have a xmlns URI with https protocol? For example this is the recommended way by the manual: <http xmlns="http://www.springframework.org/schema/security"/> Is it legal and better to use this way? <http xmlns="https://www.springframework.org/schema/security"/> Are there XML parsers that try to connect to an address defined by xmlns URI? Parsers...

how to make xml file readable by DOM?

java,xml,dom,xml-parsing
I face problems while trying to parse my xml files using DOM. The problem is in the structure of the xml files that I deal with because it has have dashes before its tags so what I am asking for its how to delete all the dashes and spaces before...

Parse a custom XML with as3

actionscript-3,flash,xml-parsing
i have a XML and i didn't found a way how to parse it (read the data inside) <Saa:Header> <Saa:Message> <Saa:SenderReference> data </Saa:SenderReference> </Saa:Message> <Saa:Message> <Saa:SenderReference> data </Saa:SenderReference> </Saa:Message> </Saa:Header> i use the as3 language...

How to display a specific attribute name and value beside a node in JTree?

java,xml,swing,xml-parsing,jtree
I want to display the name and values of an attribute beside the node name in JTree. Can anyone tell me how to that? Here is the code I use to display the JTree: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.Event.*; import java.io.*; import javax.swing.tree.*; import org.xml.sax.*; import org.xml.sax.helpers.*;...

Disable Visual Studio's validation of non xml files that look like xml?

visual-studio,xml-parsing,visual-studio-extensions
This is a repeat of a question asked by someone else way back in 2008 , but it appears there was no real answer back then and this is still a problem. I am writing a Visual Studio extension for files which look like XML but are not, and do...

Remove element namespace prefixes from XML string fragment

c#,.net,regex,xml,xml-parsing
I have a string containing a partial XML fragment, which may contain various undeclared namespaces and therefore cannot be parsed by the XML parser I'm using (.Net's XElement.Parse): <elements> <removeThis:element attribute="value"> Contents </removeThis:element> </elements> So before passing the string to the XML parser I need to strip the namespaces from...

Get the name of namespace xmlns from xsd file through XmlSlurper/XmlParser

groovy,xsd,xml-parsing
I am trying to fetch the namespace for an xml(xsd) file through Groovy. The Node returned by the XmlParsers, and the GPathResult by XmlSlurper seems to ignore the namespace definitions. As an example: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com" xmlns="http://www.w3schools.com" elementFormDefault="qualified"> trying to fetch the attributes of the rootNode through rootNode.attributes()...

Parsing android resources from xml

java,android,xml,parsing,xml-parsing
I am facing some problems with parsing a XML-file for my Android App. I need some layout ids and color ids from my XML file. I have no problems in reading string values but I dont know how to convert the XML layout reference to a layout id? Thanks for...

How check file XML

xml,xsd,xml-parsing,xmlhttprequest,linq-to-xml
I have xml file. I think file is not correct.I check file in validator. I get link: http://validator.w3.org. I get 3 warinngs but document is good. My question is that file correct.Do I must add DOCTYPE. Can you help me.I am green in XML. Can you give me tutorial, books,...

CONVERTING SQL NVARCHAR(MAX) TO XML and getting a Value from XML string

sql-server,xml-parsing
I am trying read from the nodes of a column -where an XML string is stored. The column is of type NVARCHAR(MAX). The following is the script to create table - SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[XML_Dummy]( [ID] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](50) NULL,...

Unkown system function: format-date in XSLT

xslt,xml-parsing,xslt-1.0,xslt-2.0
I am oxygen editor to transform data XML into CSV format. To transform, I am using XSLT. I am using format-date function to convert date value in desired format. <xsl:value-of select="format-date(wd:Evaluate_Employee_Effective_Date,'[M01]/[D01]/[Y0001]')" /> Any help would be highly appreciated. Also, how do I know that which version of XSLT I am...

Populating an object from an XmlNode

c#,xml-parsing
I have an object 'AutoText' which is being populated from an XmlNode (retrieved from a remote source) with the following ctor: public AutoText(XmlNode autoTextNode) { if (null == autoTextNode) { throw new System.Exception("Attempted to create AutoText with null autoTextNode"); } foreach (XmlNode childNode in autoTextNode.ChildNodes) { string childNodeName = childNode.Name;...

groovy/XML: Replace a node by another one

xml,groovy,xml-parsing,xmlslurper
I try to replace an XML node by another one by using XmlSlurper (or XmlParser). The original XML: <myXml> ... <myNode> <Name>name1</Name> <Name>name2</Name> <Name>name3</Name> </myNode> ... </myXml> The list that contains the items to build my new node def namelist = ['name4','name5','name6','name7'] What I want to have <myXml> ... <myNode>...

Perl: How to parse invalid XML document? [duplicate]

xml,perl,xml-parsing
This question already has an answer here: Dealing with malformed XML 2 answers I have a XML document from outer source what I need parse every day over and over again with XML::Simple perl module. My script is running from crontab and it works fine if the XML document...

Create XML file by iterating over lists in python

python,xml-parsing,elementtree
I have checked this link but it doesnt solved my problem. I have 2 lists: a = [['txt','stxt','pi','min','max'],['txt1','stxt1','pi1','min1','max1']] b = [[0.45,1.23],[[0.75,1.53]] for l1 in a: for l2 in b: root = ET.Element("Class ",name = l1[0]) doc = ET.SubElement(root, "subclass" , name = l1[1]) ET.SubElement(doc, l1[4], min = str(l2 [0]),max =...

Issue in parsing XML with Classic ASP (VBscript)

vbscript,asp-classic,xml-parsing
I have the following code, which used to work perfectly, But now for somes reason, doesn't. The XML I am reading is located at: https://forex.boi.org.il/currency.xml The following code should parse the XMl and then save the USD/ILS exchange rate. As I say, it doesnt anymore, and I cant figure out...

PHP: Converting xml to array

php,arrays,xml,xml-parsing
I have an xml string. That xml string has to be converted into PHP array in order to be processed by other parts of software my team is working on. For xml -> array conversion i'm using something like this: if(get_class($xmlString) != 'SimpleXMLElement') { $xml = simplexml_load_string($xmlString); } if(!$xml) {...

Reading XML using XmlDocument

c#,xml,ssis,xml-parsing,xmldocument
This is my feed. <feed xml:lang=""> <title>NEWS.com.au | Top Stories</title> <link rel="self" href="http://feeds.news.com.au/public/atom/1.0/news_top_stories_48_48.xml"/> <link rel="alternate" href="http://news.com.au"/> <id>http://news.com.au</id> <rights/> <entry> <title>F1’s glaring issues exposed</title> <link href="www.google.com"/> <author> <name>STEVE LARKIN</name> </author> <link rel="enclosure" type="image/jpeg"...

How to read attributes using XML apache commons configuration

java,xml,xml-parsing,apache-commons
I am using Apache Commons Configuration for reading configuration in xml file - standalone-full-ha.xml in Wildfly 8 application server. <?xml version="1.0" ?> <server xmlns="urn:jboss:domain:2.2"> ... ... <profile> ... ... <subsystem xmlns="urn:jboss:domain:datasources:2.0"> <datasources> <datasource jta="true" jndi-name="java:/TestDB" pool-name="TestDB" enabled="true" use-java-context="true" spy="false" use-ccm="true"> <connection-url>jdbc:sybase:Tds:ip:port/db-name</connection-url> ......

After scraping data from a URL using readHTMLTable, how can I convert the result to a data frame?

r,xml-parsing
I've tried all sorts of different manipulations, but my basic problem is this: url<- "http://www.ref.org.uk/fuel/tablebysp.php?valdate=2015-03-08" data <- readHTMLTable(url,header = TRUE,as.data.frame =TRUE,which=2) typeof(data) My data looks great, but I cannot coerce it into a data frame. I don't know what is stopping me....

JAVA Ignore commented out xml tags

java,xml,dom,xml-parsing
While i'm parsing an XML document, i get commented out code as a node (which is a bad idea to begin with), i wan't to know when we have a commented out node/bulk and not to parse it. This is the code that parses the XML elements: private static boolean...

XSLT Change Attribute Values and Sort

xml,xslt,xml-parsing
I’m very new with XSLT and I’m trying to find a way to do the following… I have the following XML file: <?xml version="1.0" encoding="UTF-8"?> <AddCustomerRequest APIVersion="2.0" Name="Add Customers List Data"> <CFParameters> <ReqId>1-YNU68</ReqId> <CfgId>1-TSP13</CfgId> </CFParameters> <Parameters> <ParName>Test Customer List</ParName> <ListName>Test Customer List</ListName> <Summary>N</Summary> <CustomerList> <CustomerInfo>...

Do not parser XML using SimpleXML library

android,xml,xml-parsing,simple-framework
I have an issue when I try paser xml string to object using SimpleXML(version 2.7.1) library. This is my string : <tbody> <tr> <th></th> <th>Weather</th> <th><img src="http://localhost:8080/img/today" /></th> <th><img src="http://localhost:8080/img/today_1" /></th> <th><img src="http://localhost:8080/img/today_2" /></th> </tr> <tr> <td><img src="http://localhost:8080/img/location_1" /></td> <td> <a...

LINQ request for getting the furthest xml child node with an attribute

c#,xml,linq,xml-parsing,linq-to-xml
I have an xml file that defines item/location categories, and their id's like follow: <?xml version="1.0" encoding="UTF-8"?> <Eve_App> <Item_Types> <Ore> <Arkonor> <Arkonor ID="22"/> <Compressed_Arkonor ID="28367"/> <Compressed_Crimson_Arkonor ID="28385"/> <Compressed_Prime_Arkonor ID="28387"/> <Crimson_Arkonor ID="17425"/> <Prime_Arkonor ID="17426"/> </Arkonor> <Bistot> <Bistot ID="1223"/> <Compressed_Bistot ID="28388"/>...

how to list all tags xml in node.js

javascript,xml,node.js,xml-parsing,fs
Here is my XML: <?xml version="1.0" encoding="utf-8"?> <!-- 1 = video , 2 = html , 3 = pdf --> <stage_type>2</stage_type> <resource_name>http://www.XXX</resource_name> I want to get <resource_name>. I'm using xml2js. When I use: var parser = new xml2js.Parser(); fs.readFile('./' + file, function(err, data) { parser.parseString(data, function (err, result) { console.dir(result);...

XmlRoot attribute serialization to a file

c#,xml-parsing,xml-serialization,xmlroot
I have the following code serializing an object into a file: TemplateClass item = new TemplateClass(); // Fill in item XmlSerializer writer = new XmlSerializer(typeof(TemplateClass)); using (StreamWriter file = new StreamWriter(filePath)) { writer.Serialize(file, item); } where TemplateClass is defined as follows: public class TemplateClass { public List<SubTemplate> Accounts; } [XmlRoot(ElementName...

How to merge two different paths in a XML file?

python,xml,parsing,xml-parsing,lxml
This is my xml file: <File> <Paths> <Path> <Node> <NodeName>Initial_Node</NodeName> <InnerNode> <Signal>Test_sig</Signal> <InnerNode> <Signal>Test_sig_1</Signal> <NodeRef>Ref0</NodeRef> </InnerNode> </InnerNode> </Node> </Path> <Path> <Node> <NodeName>Name1</NodeName> <InnerNode> <Signal>Test_sig_0</Signal> <InnerNode> <Signal>Test_sig_2</Signal>...

Calling method from other class in main

java,xml,methods,xml-parsing,method-invocation
I've set up a method in a Location class to parse an xml file. But when I try to invoke the method from the main class within the main method, it doesn't seem to be called. I set a break point on locObj.parseNetwork(); but it never gets fired, the println's...

Can't extract the data from xml values in oracle sql

sql,oracle,xml-parsing,clob
I have the following 2 xml value which is similar and which is stored in the request_xml column and which is clob data type: <?xml version='1.0' encoding='utf-8'?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns5:updateRechargeTicket xmlns:ns5="http://service.soap.CDRator.com" xmlns:ns2="http://core.result.service.soap.CDRator.com/xsd" xmlns="http://core.data.soap.CDRator.com/xsd" xmlns:ns4="http://data.soap.CDRator.com/xsd"...

EDOMParseError with HTML inner XML

xml,delphi,xml-parsing,delphi-xe2
I have an XML string stored in a variable: <RESULT> <ROW> <MESSAGE> <!DOCTYPE HTML> <html> <body> hello html inner xml on delphi </body> </html> </MESSAGE> </ROW> </RESULT> I use the following code to parse the string into a TXmlDocument object: var xmldoc : TXmlDocument; begin xml := LoadXmlData(resultXml); end; However,...

How to get the full content of an XML file as a String using xmlStreamReader?

java,string,file,xml-parsing,xmlstreamreader
I'm in a part of an application where I have an access to the xmlStreamReader which is representing the XML file needed to be fully read into a String. Is there a way to obtain the XML content without building another xmlStreamReader or using another stream on the file?...

Finding all tags and attributes in a HTML

python,html,xml-parsing,beautifulsoup,html-parsing
I am a newbie and looking at HTML code for first time. For my research I need to know the number of tags and attributes in a webpage. I looked at various parser and found Beautiful Soup to be one of the most preferred one. The following code (taken from...

XSLT processing gives different result on Firefox and Chrome

xml,google-chrome,xslt,xml-parsing,webkit
I have an XML processed by an XSLT, but Mozilla Firefox 24 ESR parses my XML correctly while Google Chrome 42 is failing to get the node from XML. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script> var xslInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\"> <xsl:output method=\"xml\"/> <xsl:variable name=\"outcome\"...

My For-loop inserts xml data in the wrong place

c#,xml,for-loop,xml-parsing
(I don't know exactly what my problem is so I hope I asked it with the right tags and title) When I get my xml file and let the for-loop start it does this 1 (x breakpoint before error )(locals) name "0" string enetSportCode "1.0" string x del "2011-03-15 13:53:12"...

How to convert partial XML to hash in Ruby

ruby,xml,xml-parsing,nokogiri
I have a string which has plain text and extra spaces and carriage returns then XML-like tags followed by XML tags: String = "hi there. <SET-TOPIC> INITIATE </SET-TOPIC> <SETPROFILE> <KEY>name</KEY> <VALUE>Joe</VALUE> </SETPROFILE> <SETPROFILE> <KEY>email</KEY> <VALUE>[email protected]</VALUE> </SETPROFILE> <GET-RELATIONS> <COLLECTION>goals</COLLECTION> <VALUE>walk upstairs</VALUE> </GET-RELATIONS> So what do you think? Is it...

Parsing XML using json raises ValueError

python,json,xml,xml-parsing
I'm trying to parse a XML file using xml ElementTree and json from xml.etree import ElementTree as et import json def parse_file(file_name): tree = et.ElementTree() npcs = {} for npc in tree.parse(file_name): quests = [] for quest in npc: quest_name = quest.attrib['name'] stages = [] for i, stage in enumerate(quest):...

Find all nodes with attribute that matches a pattern

xml,xpath,xml-parsing
I have an xml <mic_root state="mismatch"> <RepoTrade state="mismatch"> <TradeIds state="mismatch"> <TradeId state="mismatch"> <Id state="missing" /> <Id1 state="added" /> <Version state="mismatch"> <mic_elemA_text>1</mic_elemA_text> <mic_elemB_text>2</mic_elemB_text> </Version> </TradeId> <TradeId state="mismatch"> <Id state="mismatch"> <mic_elemA_text>1</mic_elemA_text> <mic_elemB_text>2</mic_elemB_text>...

Selection skipping node on missing childnode

xpath,vbscript,xml-parsing
Here is my XML file: <?xml version="1.0" encoding="iso-8859-1" ?> <data> <metadata> <sector>weather</sector> <title>sourceTitle</title> </metadata> <weather> <countries> <country code="AU" name="Australia" region="Oceania"> <location type="APLOC" code="6700" name="Addington" state="VIC" postcode="3352"> <point_forecasts type="TWC"> <related_location type="TWCID" code="9508" name="Ballarat" state="VIC"> </related_location> <point_forecast...

Parsing large XML file in R is very slow

xml,r,performance,xml-parsing,data.frame
I need to extract data from a large xml file in R. The file size is 60 MB. I use the following R code to download the data from the Internet: library(XML) library(httr) url = "http://hydro1.sci.gsfc.nasa.gov/daac-bin/his/1.0/NLDAS_NOAH_002.cgi" SOAPAction = "http://www.cuahsi.org/his/1.0/ws/GetSites" envelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"...

Parsing xml in Javascript iterate through child nodes

javascript,xml,xml-parsing
I need to parse the below xml in javascript. <Department id='1' name='Admins'> <Floor Id='5' Name='WingA'> <Employee Id='35' Name='John Smith' SysId='120' FileId='135' /> <Employee Id='124' Name='John Doe' SysId='214' FileId='125' /> <Employee Id='79' Name='Lorem Ipsum' SysId='185' FileId='194' /> </Floor> </Department> What I need is to loop through all the employees until I...

list all tags in XML with LINQ

c#,xml,linq,xml-parsing
I am trying to read variety type of XML files and in each xml type, root name and all other tags may change. I need to list all the xml tags but I couldnt succeed to read. this is one of xml types. <?xml version="1.0" encoding="ISO-8859-9"?> <ITEMS> <ITEM DBOP="INS" >...

Getting an XmlNode given one of its XmlAttributes

c#,xml,xpath,xml-parsing
I have an XmlNode like this: XmlNode node = document.GetElementById("myid"); Given its attribute: XmlAttribute a = node.Attributes("type"); Is there a way to obtain back the node? Something like this: XmlNode node = a.Node; I tried ParentNode, but it doesn't seem to work (returning null)....

Unable to construct Document object from xml string

java,xml,xpath,xml-parsing
I have xml string coming to my appliaction like follows <?xml version="1.0" encoding="UTF-8"?><loc:getLocation xmlns:loc="http://www.csapi.org/schema/parlayx/terminal_location/v2_3/local"> <loc:address>tel:+919420161525</loc:address> <loc:requestedAccuracy>500</loc:requestedAccuracy> <loc:acceptableAccuracy>500</loc:acceptableAccuracy> </loc:getLocation> I want to construct Document object from this so that using XPath, I can retrieve required data. I tried following code...

How to retrieve data from an html string from a span tag by using Regular Expressions?

c#,html,regex,xml-parsing
I need to retrieve some info from an html doc since the web service to get a json or an xml is still not ready. Im working with c# and using regular expressions to get the data i need from the html string. I've managed to get the div i...

Melting repeated child nodes XML into a tidy data set using R

xml,r,xml-parsing
I am trying to build a data mash-up from a wide variety o security controls in R. I have had great success with the devices that output CSV, JSON, etc, but XML is really tripping me up. You will quickly see that I am not the boss R developer I...

What should the JCA deployment descriptor (ra.xml) character encoding be?

character-encoding,xml-parsing,findbugs,jca,deployment-descriptor
Looking through JCA 1.7 specification I could only find in one of their examples on the Resource Adapter Deployment Descriptor the following (Chapter 13: Message Inflow P 13-50): This example is showing the usage of UTF-8 encoding, however there is nothing saying if this was an optional selection for the...

how to get specific node and its childs using node's name and a specific attribute value?

java,xml,parsing,xml-parsing
note : i am dealing with xml files that i don't know their structure in advance so i can't use XPath here is an example of my xml files : <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?> <HWData> <Header time="2013-05-29T13:39:34" uploaded="true" version="1.0" /> <NE vendorName="Nokia Siemens Networks" NEId="WBTS-431"> <EQHO vendorName="Nokia Siemens Networks"...

How do I replace an XML node value in SQL?

sql,sql-server,xml,replace,xml-parsing
I have an xml value in sql field <Menu> <MenuItem> <MENU_ID>D</MENU_ID> <MENU_Read>1</MENU_Read> <MENU_Write>1,2,3,4,5</MENU_Write> </MenuItem> <MenuItem> <MENU_ID>A</MENU_ID> <MENU_Read>1</MENU_Read> <MENU_Write>6,7</MENU_Write> </MenuItem> <MenuItem> <MENU_ID>B</MENU_ID> <MENU_Read>1</MENU_Read> <MENU_Write>8,9,10</MENU_Write> </MenuItem> <MenuItem>...

Split string with PHP Wordwrap in to two strings?

php,xml-parsing,query-string
Having a function that writes an XML, Problem is that values can't exceed 30 characters. In this scenario i need to split strings value and maintain readability. Wordwrap can solve this but i don't believe it's the right solution? First of all i need to determine if this is needed...

passing base64 image string in xml tag

javascript,jquery,xml,xml-parsing,base64
I tried this code, but it is not working. Any suggestions or any solutions for above issue for sending base64 string in xml tag. I have searching lot of about base64 string passing to java server using this xml tags(i.e. xml parsing) but not get any results. function fileSelectedForLogo() {...

Entity Reference Loop in large xhtml

html,xml,xml-parsing,notepad++
Im generating a large Xhtml file. When opening the file with notepad++, it says there is an Entity Reference Loop in my file. The file is about 20K lines, and gives these errors on lines like: <p class='tbl__description'> &auml;rzaweqt;&auml;&ouml;&ocirc; &eacute;&icirc;&Auml;&ecirc;&yuml; &Ouml;&yen;&pound;&uacute; </p> Does anyone know what this 'XML parsing error...

Bluebird promise `promisifyAll` not working - cannot read property `then`

xml-parsing,callback,promise,bluebird,node-modules
I am using a node module that uses the node callback convention. I wants to convert this module into an API using Bluebird promises. I am not getting how to do this. Below is my node style callback function. I wants to convert it into thenable promise of bluebird. var...

How to populate a treeview from a XML file with multiple child nodes?

xml,vb.net,xml-parsing,treeview,populate
I´m trying to populate a TreeView component in VB.NET from a XML file. It´s a large XML file and I chopped it up in order to give you guys an idea about how it is structured. I´m new to VB.NET so I´m having a hard time to figure this out....

What is the best way to replace the punctuation in tag names?

php,regex,xml-parsing,preg-replace
I have my reasons to replace the punctuation character with a underscore in all tag names (please don't ask me why it is not relevant for the question). What is relevant to the question is that I would like to: <data:data> <another:data>Content</another:data> <another:data>Content</another:data> <another:data>Content</another:data> <another:data attribute="attr : content">This content should...

in Python, trying to update a RESX with content from 2nd RESX

python,xml,xml-parsing
I only code occasionally and this is the best I could put together, I hope someone can point me in the right direction. (I have been looking for other answers but they only got me this far) import xml.etree.ElementTree as ET tree = ET.parse('FMTranslations.resx') # localised file - contains sub...