xmlreader

System.ServiceModel.Syndication.SyndicationFeed throws when the RSS document includes a <script> block embedded in an element

The code: using (XmlReader xmlr = XmlReader.Create(new StringReader(allXml))) { var items = from item in SyndicationFeed.Load(xmlr).Items select item; } The exception: Exception: System.Xml.XmlException: Unexpected node type Element. ReadElementString method can only be called on elements with simple or empty content...

PHP XMLREADER - QUESTION

Hi Guys, I am pretty new to xml parsing and I am using XMLREADER to parse a huge file. Given the following XML (sample): <hotels> <hotel> <name>Bla1</name> </hotel> <hotel> <name>Bla2</name> </hotel> </hotels> And then the XMLREADER in PHP which pulls up the values to my Database: $reader = new XMLReader(); $reader->open(...

How to read from an XmlReader without moving it forwards

hey guys, I've got this scenario: while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == itemElementName) { XElement item = null; try { item = XElement.ReadFrom(reader) as XElement; } catch (XmlException ex) { //log line number a...

Problem with parsing XML with iPhone app

Hi, I have a problem with a xml parsing. I have create a class for parsing. The xmlURL is correct (testing it from debug) but when i call the method parse the variable success become FALSE and a errorParsing is "NSXMLParserErrorDomain". Can you help me? My code is below. #import "xmlParser.h" #import"Posizione.h" @implementation xmlP...

Returning XmlReader with Subsonic 3

Hi, folks. We are trying out Subsonic, and have a situation where we need to work with stored prcedures that are retuning XML, and are used in the app through an XmlReader. How would one go about handling this situation with Subsonic? ...

Is XMLReader a SAX parser, a DOM parser, or neither?

I am testing various methods to read (possibly large, and very often) XML configuration files in PHP. No writing is ever needed. I have two successful implementations, one using SimpleXML (which I know is a DOM parser) and one using XMLReader. I know that a DOM reader must read the whole tree and therefore uses more memory. My tests ...

XmlReader breaks on UTF-8 BOM

I have the following XML Parsing code in my application: public static XElement Parse(string xml, string xsdFilename) { var readerSettings = new XmlReaderSettings { ValidationType = ValidationType.Schema, Schemas = new XmlSchemaSet() }; readerSettings.Schemas.Add(null, xsdF...

ExtJS's XmlReader field mapping.

Hi , I can't manage to get this Ext.data.XmlReader's CDATA field mapping to work. <script> var store = new Ext.data.Store({ url: '../data/data.xml', // specify a XmlReader reader: new Ext.data.XmlReader({ record: 'entry', fields:[ { name: 'field1', type: 'date', mapping:'field1'}, ...

Reading and writing to an XML - DTD error

I have a program where it reads and writes XML using XMLReader and XMLWriter XmlWriter writer = XmlWriter.Create(fullpath, settings); //content... writer.Flush(); writer.Close(); and my reader code XmlReader reader = XmlReader.Create(fullpath); while (reader.Read()) { switch(reader.NodeType) {...

Python .xlsx (Office OpenXML) reader as simple as csv module?

I know some Python xlsx readers are emerging, but from what I've seen they don't seem nearly as intuitive as the built-in csv module. What I want is a module that can do something like this: reader = xlsx.reader(open('/path/to/file')) for sheet in reader: print 'In %s we have the following employees:' % (sheet.name) for row in...

Parsing XML in PHP with XMLReader - mixed content element - where'd my text go?

I'm having trouble parsing out a piece of plain text; even looping over all nodes with a print-statement, none of them contain the text I wrote in the XML file. Here's the element specification from the DTD: <!ELEMENT question (#PCDATA | choice)*> And here's the data I'm using: <question id="porridge" name="porridge" type="multiple"...

SAXParser problem grabbing tag value with & character

I have a SAXParser with with an XMLReader. SAXParserFactory saxPF = SAXParserFactory.newInstance(); SAXParser sp = saxPF .newSAXParser(); XMLReader xmlR = sp.getXMLReader(); MyHandler myHandler = new MyHandler(); xmlR .setContentHandler(myHandler ); My handler code uses startElement and endElement to detect with it's inside a tag. It ...

Questions before writing own RSS reader for iPad

This is not new topic, one about iPhone ( iPhone RSS Reader ) My purpose is to get some latest and useful info before my implementation for RSS reader in iPad.( same with iPhone , right ? only GUI difference ?) Apple already provides TopSongs as example, which use native NSNetwork and XML parser etc. ASIHttpRequest also provides good...

XmlWriter - reading an attribute (quick question)

I'm using this for my code, it outputs to the xml file perfectly, but it adds an ' = ' sign after the element name even though only one of my elements has an attribute. I suppose I could do something like if(reader.Getattribute != "") // I made that up on the spot, I'm not sure if that would really work { Console.WriteLine("<{0}...

Problem reading files greater than 1GB with XMLReader

Is there a maximum file size the XMLReader can handle? I'm trying to process an XML feed about 3GB large. There are certainly no PHP errors as the script runs fine and successfully loads to the database after it's been run. The script also runs fine with smaller test feeds - 1GB and below. However, when processing larger feeds the scr...

XMLReader to read a text

<xhtml:li> content1content1content1content1content1content1content1content1 <xhtml:a href="234455" doc.type="mt">titlex</xhtml:a> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <xhtml:a href="23452345#23556::ah_234555" doc.type="xx">ZZZZZZZZZZZZZZZZ</xhtml:a> </xhtml:li> Hi, From the above xml how to extr...

Prevent XmlTextReader from expanding entities

I am trying to read a XML document without expanding the entities, do some manipulations to it, and re-save it with the unexpanded entities as they were initially. When using the XDocument directly, it fails to load, throwing an exception tell me it has unexpanded entities: XDocument doc = XDocument.Load(file); // <--- Exception // .....

Do I need to Dispose XmlReader if I Dispose its underlying Stream?

I have the following method GetData that creates a StreamReader from a file. private void GetData(string file) { string filename = Path.GetFileNameWithoutExtension(file); XmlDocument xmldoc = new XmlDocument(); using (StreamReader sr = new StreamReader(file)) { Stream bs = sr.BaseStream; Stream cl = main...

How to read an XML file with an undefined namespace with XMLReader?

I'm relatively new to parsing XML files and am attempting to read a large XML file with XMLReader. <?xml version="1.0" encoding="UTF-8"?> <ShowVehicleRemarketing environment="Production" lang="en-CA" release="8.1-Lite" xsi:schemaLocation="http://www.starstandards.org/STAR /STAR/Rev4.2.4/BODs/Standalone/ShowVehicleRemarketing.xsd"> <...

XMLReader - How to handle undeclared namespace

I'm reading a large ~300Mb gzipped XML file with XMLReader that get's automatically dumped to my server nightly (archaic, I know..) It is malformed ie, it has an undefined namespace and it's throwing an error ErrorException [ Warning ]: XMLReader::read() namespace error : Namespace prefix xsi for AttrName on NodeName is not defined ...