is there a XML parser library for micropython? - xml-parsing

Is there an XML parser library for micropython? I would like to parse an XML file in a text file or string. This is for a Pico and I am using Thonny. Thanks.

Related

what is the hierarchical structure of XML structure of this output in Map Editor ? I want to Convert CSV Data to XML By Mapping

I need this output by convert csv file in map editor . I want to understand how can we get this output after adding in csv file in input side in map editor.
<code description="1" receiverCode"XYZ" senderCode="ABC" text1="Hydrabad" text2="Mumbai"/>
<code description="2" receiverCode"PPZ" senderCode="ABC" text1="Delhi" text2="Mumbai"/>

How to read a xml file with python with xml.dom

i am having one xml file and i need to fetch value of tags postnumer and regarding every postnumber all the valid number values...i am using xml.dom for reading xml file in python what is the code to fetch the value...how can i do this? please help
xml code:
-<post>
<PostNumber>180</postNumber>
-<validList>
<validNumber>208</validNumber>
<validNumber>209</validNumber>
<validNumber>210</validNumber>
</validlist>
</post>
-<post>
<postNumber>1023832</postNumber>
-<validlist>
<validNumber>264</validNumber>
<validNumber>401</validNumber>
</validlist>
</post>

Deserialize XML with UTF-16 encoding in ServiceStack.Text

I am trying to use ServiceStack.Text to deserialize some XML.
Code:
var buildEvent = dto.EventXml.FromXml<TfsEventBuildComplete>();
The opening xml line is:
<?xml version="1.0" encoding="UTF-16"?>
ServiceStack fails with the following error:
The encoding in the declaration 'utf-16' does not match the encoding of the document 'utf-8'.
I can see from the source of the Xml Serializer that ServiceStack uses UTF-8.
I am wondering whether ServiceStack.Text can deserialize UTF-16 and if so how? And if not, why not?
I have managed to hack my way around the issue. I'm not proud of it but....
var buildEvent = dto.EventXml.Replace("utf-16", "utf-8").FromXml<TfsEventBuildComplete>();

How to read .docx file using F#

How can I read a .docx file using F#. If I use
System.IO.File.ReadAllText("D:/test.docx")
It is returning me some garbage output with beep sounds.
Here is a F# snippet that may give you a jump-start. It successfully extracts all text contents of a Word2010-created .docx file as a string of concatenated lines:
open System
open System.IO
open System.IO.Packaging
open System.Xml
let getDocxContent (path: string) =
use package = Package.Open(path, FileMode.Open)
let stream = package.GetPart(new Uri("/word/document.xml", UriKind.Relative)).GetStream()
stream.Seek(0L, SeekOrigin.Begin) |> ignore
let xmlDoc = new XmlDocument()
xmlDoc.Load(stream)
xmlDoc.DocumentElement.InnerText
printfn "%s" (getDocxContent #"..\..\test.docx")
In order to make it working do not forget to reference WindowsBase.dll in your VS project.
.docx files follow Open Packaging Convention specifications. At the lowest level, they are .ZIP files. To read it programmatically, see example here:
A New Standard For Packaging Your Data
Packages and Parts
Using F#, it's the same story, you'll have to use classes in the System.IO.Packaging Namespace.
System.IO.File.ReadAllText has type of string -> string.
Because a .docx file is a binary file, it's probable that some of the chars in the strings have the bell character. Rather than ReadAllText, look into Word automation, the Packaging, or the OpenXML APIs
Try using the OpenXML SDK from Microsoft.
Also on the linked page is the Microsoft tool that you can use to decompile the office 2007 files. The decompiled code can be quite lengthy even for simple documents though so be warned. There is a big learning curve associated with OpenXML SDK. I'm finding it quite difficult to use.

parse XML file that contains unicode characters in iphone

I am trying to parse one XML file that contains some unicode characters.I tried to parse the file using NSXMLParser but i am unable to parse XML.Parser stops when it encounters any unicode characters.
Is there any other good solution to parse XML file with unicode letters?
Please suggest.
Have you tried TBXML for iPhone http://www.tbxml.co.uk/

Resources