Coder Social home page Coder Social logo

Comments (13)

rblaze avatar rblaze commented on July 17, 2024

The parser only looks for specific attributes and ignores all others, so it shouldn't be bothered by namespaces. Maybe xml-conduit requires some additional setup to handle this kind of document.

Can you make a minimal spec that makes the parser fail with namespaces? A fix would be even better, but I'll look into it when I have time.

from haskell-dbus.

crogers1 avatar crogers1 commented on July 17, 2024

Hey rblaze, I work with tsirakisn. A spec trimmed down and "examplified" from the code we're working with is described below, borrowing from telepathy for enum:

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0" name="/">
  <tp:enum name="EX_ENUM" type="s">
    <tp:enumvalue suffix="EX1" value="ex1"/>
  </tp:enum>
  <interface name="my.example.interface">
    <method name="cool_method">
      <arg type="s" name="argin" direction="in"/>
    </method>
  </interface>
</node>

putting this through parseXML fails. Dropping the enum block, and thus leaving only basic interface, method, and arg tags will allow parseXML to succeed.

Thanks for your time in looking at this.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

It has nothing to do with namespaces, at least in the test case.

Here the parser expects that node's child is either a child node or interface definition. enum is neither, so parsing fails.

Could you try replacing X.many with X.many' and see if it works for you?

from haskell-dbus.

tsirakisn avatar tsirakisn commented on July 17, 2024

@rblaze appreciate the quick turnaround! I gave that change a try and it does indeed parse test document above but still fails to parse my files. Going to dig into this a bit and report back. Thanks again.

from haskell-dbus.

tsirakisn avatar tsirakisn commented on July 17, 2024

Okay, after replacing a few more X.many's with the alternative, my files are parsing. I was initially concerned that ignoring the tags would introduce undesired behavior, but it seems that my binaries are behaving correctly somehow. I think those results are good enough to close this issue, at least for my purposes. Thanks for your help!

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

I can patch the parser to make it skip over unknown elements if you send me the full XML file. It already skips unknown attributes and can skip unknown nodes as well.

Just to point out, the Introspection module is not required to operate the library. It is a codegen to produce a service stub. You can write one yourself and save the trouble.

from haskell-dbus.

tsirakisn avatar tsirakisn commented on July 17, 2024

I can patch the parser to make it skip over unknown elements if you send me the full XML file

I have it patched on my end, which is good enough for my purposes. Whether you decide to add formal support is up to you.

Just to point out, the Introspection module is not required to operate the library. It is a codegen to produce a service stub. You can write one yourself and save the trouble.

Ack, good to know

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

I'm closing this issue for now. Feel free to send a pull request if you want this fixed on my side.

from haskell-dbus.

tsirakisn avatar tsirakisn commented on July 17, 2024

@rblaze I can submit it if you'd like the fix to be mainlined. I didn't think you'd want it to be.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

Why not? It is possible other people will run into the same problem.

from haskell-dbus.

rblaze avatar rblaze commented on July 17, 2024

Could you also add a test case covering your changes? It will prevent breakages in the future, given this code path won't be widely used.

from haskell-dbus.

tsirakisn avatar tsirakisn commented on July 17, 2024

Agreed, I just didn't know if this change in particular was the route you wanted to go for a formal fix (and I am definitely no Haskell expert). I have no problem submitting with a test case 👍

from haskell-dbus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.