GithubHelp home page GithubHelp logo

Custom Root element about yaxlib HOT 4 CLOSED

yaxlib avatar yaxlib commented on July 2, 2024
Custom Root element

from yaxlib.

Comments (4)

sinairv avatar sinairv commented on July 2, 2024

The YAXSerializer.Deserialize method has 2 overrides that receive a string or an XElement which you can use. You can pass that section of the XML as a string to the method, as long as it remains a well formed XML. Or alternatively, you can open the whole document as an XDocument, find the desired element using LINQ to XML, and pass the corresponding XElement object to the method.

from yaxlib.

 avatar commented on July 2, 2024

Thats a good idea!
I'm new to XML to Linq and have no idea how to do this.
Could you please give an example, how this would look like in code if I'd be looking for a Element called "product-parameters"?

from yaxlib.

 avatar commented on July 2, 2024

To elaborate, I've already tried the following:

XDocument x = XDocument.Parse(response.Content);
XNamespace xns = x.Root.Name.Namespace;
XElement xe = x.Element(xns +  "product-parameters");

But xe is still null for some reason, even though I'm sure a element product-parameters exists in the XML.

from yaxlib.

 avatar commented on July 2, 2024

Figured out this part, but now I've different problems...
If I can't figure it out I'll open another Issue, thanks for the support here!

from yaxlib.

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.