xml-parsing

XML Parsing Error: not well-formed ? anyone can

时间秒杀一切 提交于 2019-12-20 03:10:36
问题 This is my first time creating a xml document but I am having problems with one line not working. can anyone tell me what I have done wrong. http://www.ncerttext.in/flipkart.xml error is 7: 107 The entity "wgtid" was referenced, but not declared. how should i do that. 回答1: As suggested by @Marco Forberg, the problematic character in your XML is "&" . Simply change & to & . By the way: Modern browsers tell you something about XML files even if they are malformed. For example, if you open your

iterparse fails to parse a field, while other similar ones are fine

a 夏天 提交于 2019-12-20 02:57:13
问题 I use Python's iterparse to parse the XML result of a nessus scan (.nessus file). The parsing fails on unexpected records, wile similar ones have been parsed correctly. The general structure of the XML file is a lot of records like the one below: <ReportHost> <ReportItem> <foo>9.3</foo> <bar>hello</bar> </ReportItem> <ReportItem> <foo>10.0</foo> <bar>world</bar> </ReportHost> <ReportHost> ... </ReportHost> In other words a lot of hosts ( ReportHost ) with a lot of items to report ( ReportItem

how to store an xml tag as an array in java

…衆ロ難τιáo~ 提交于 2019-12-19 12:08:11
问题 in my app i am parsing an xml file. In the xml file i am having 50 tags of the same name question , now i want to store all the tag named as question as an array.... Among those tags saved i want only one question tag to be placed in a text view.... how to perform this....pls help me..... 回答1: public class CustomHandler extends DefaultHandler { private ArrayList<String> questionList; private boolean questionBuffering; private StringBuilder sb; @Override public void startDocument() throws

How do you declare a the “nbsp” entity in XML document

丶灬走出姿态 提交于 2019-12-19 11:42:53
问题 I am getting the following error The entity "nbsp" was referenced, but not declared. I tried to declare the nbsp (shown below) in my XML file. But this isn't working for me. <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" > <!DOCTYPE html [<!ENTITY nbsp " "> Am I missing something? Thanks! 回答1: Put the DOCTYPE declaration before the root element start-tag. That is, <?xml version

Extract xml data using oracle query

淺唱寂寞╮ 提交于 2019-12-19 11:20:12
问题 Oracle version 11g HI , When trying to read the XML in a LOOP the query is giving an error but if, I change this to a non existing path then the query is running fine . However the @Name is not fetching is the expected . What should I correct here to make it give the desired output given below: sqlfiddle link Non exsisting path described above, removed the E from the name : for $i in AuxiliaryObject/Row return <C>{$i}<R>{AuxiliaryObject/@NAM} code : SELECT * FROM XMLTABLE ( '<C> {for $i in

get xml as string instead of class with xstream

隐身守侯 提交于 2019-12-19 10:39:13
问题 I have xml something like <parent> <message> <type>15</type> </message> </parent> Instead of creating a message object inside parent object, I need to represent message just as a String . So , when I do parent.message , the output is <type> 15 </type> instead of a message object. 回答1: The idia is to build up the xml of message by processing the HierarchicalStreamReader . If you go down into <messsage> by calling reader.goDown() unfortunately reader.getValue() does not return the whole content

Parsing Amazon MWS Scratchpad response

瘦欲@ 提交于 2019-12-19 10:36:15
问题 I am trying to parse xml file from amazon but found difficulties. I am using simplexml_load_string $xml = simplexml_load_string( 'My xml here' ); but when I do echo $xml->GetMatchingProductResult->Product->AttributeSets; it shows nothing How can I access the Brand value? My xml file: <?xml version="1.0"?> <GetMatchingProductResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01"> <GetMatchingProductResult ASIN="B003IOSNNQ" status="Success"> <Product xmlns="http://mws

How to get enum from boost::property_tree?

情到浓时终转凉″ 提交于 2019-12-19 09:06:40
问题 How do I get an enum from a boost::property_tree ? This is my "non-working" example. config.xml <root> <fooEnum>EMISSION::EMIT1</fooEnum> <fooDouble>42</fooDouble> </root> main.cpp #include <iostream> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> int main() { enum class EMISSION { EMIT1, EMIT2 } ; enum EMISSION myEmission; //Initialize the XML file into property_tree boost::property_tree::ptree pt; read_xml("config.xml", pt); //test enum (SUCCESS)

How to get Matlab to read correct amount of xml nodes

给你一囗甜甜゛ 提交于 2019-12-19 06:03:42
问题 I'm reading a simple xml file using matlab's xmlread internal function. <root> <ref> <requestor>John Doe</requestor> <project>X</project> </ref> </root> But when I call getChildren() of the ref element, it's telling me that it has 5 children. It works fine IF I put all the XML in ONE line . Matlab tells me that ref element has 2 children. It doesn't seem to like the spaces between elements. Even if I run Canonicalize in oXygen XML editor, I still get the same results. Because Canonicalize

In Saxon 9 he Java XML parser, word boundaries (\b) in regular expressions are not recognized

扶醉桌前 提交于 2019-12-19 05:01:08
问题 I have the following simple regular expression: \b\w+\b Saxon reports the following error: syntax error at char 2 in regular expression: Escape character 'b' not allowed Does it mean I can't use word boundaries with Java Saxon parser? Is there an alternative free XML Java parser that has this functionality? 回答1: The regular expression dialect used in XSD and XPath does not recognize \b (either as a word boundary or as a backspace). I think the reason for excluding it was probably a misplaced