Code Monkey home page Code Monkey logo

Comments (10)

goetas avatar goetas commented on May 25, 2024

Hi, this is not possible at the moment. I have solved it adding the prefix
in the root name.

But it will be an interesting feature for the jms serializer, PR are
welcome

On 12 Nov 2016 1:57 pm, "Frederico Martini" [email protected]
wrote:

While generating metadata files is possible to set namespace prefix to the
root element?
e.g:
myXmlElement:
xml_root_name: "ds1:foobar"
xml_root_namespace: "http://www.example"

will turn serialized:

<ds1:foobar xmlns:ds1="http://www.example">
/ds1:foobar


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#5, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAvaJ3SyrZ2H_SdfWWFb8hu0nTklxNCrks5q9beggaJpZM4KwaVM
.

from xsd2php.

goetas avatar goetas commented on May 25, 2024

Reading better your message, do not understand the problem. What you have suggested in your code snippet is exactly how is implemented now

from xsd2php.

fredericomartini avatar fredericomartini commented on May 25, 2024

I can only set prefix name to xml_root_name in .yml files already generated, not based on config.yml
e.g.
I have the xsd above:
https://gist.github.com/fredericomartini/481a4fd7774cde6e93b85cdb042604c8
When generate my metadata I would like my namespace seems like: xmlns:tipos="http://www.ginfes.com.br/tipos_v03.xsd"
How as wrote on the 1th.
And what is generated is:
https://gist.github.com/fredericomartini/c2a25073750766c65ecb5bd99f3f9329

Default namespace generate is: xmlns:ns-13a1074f="http://www.ginfes.com.br/tipos_v03.xsd"

Better to understand now?

Thanks @goetas

from xsd2php.

goetas avatar goetas commented on May 25, 2024

ah, i see.
this is a know limitation of the jms serializer, but schmittjoh/serializer#644 is a fix for it.

planned to be resolved in 1.5 or 1.6 version of jms serializer

from xsd2php.

steve-rhodes avatar steve-rhodes commented on May 25, 2024

I have the same problem. I still don't know how to set the root_name. And I don't know how schmittjoh/serializer#644 is solving this?

All I get is a random generated string. For example: xml_root_name: 'ns-0a7b0155:ManifestMessage'
Where is ns-0a7b0155: coming from? How can I set it myself?

thanks

from xsd2php.

goetas avatar goetas commented on May 25, 2024

any reason to have a specific prefix? for xml-sematics prefix should be almost irrelevant

from xsd2php.

steve-rhodes avatar steve-rhodes commented on May 25, 2024

Unfortunately our delivery house for Spotify rejected our xml's and said the root_name wasn't set as they need.

I understand that a quick fix would be to change the .yml manually, right?

I also need this added xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance”
How can I do this?

The .yml looks like this:

App\Ci\NewReleaseMessage:
    xml_root_name: 'ns-61e1d5b4:NewReleaseMessage'
    xml_root_namespace: 'http://ddex.net/xml/2010/ern-main/32'

generating this:

<?xml version="1.0" encoding="UTF-8"?>
<ns-0a7b0155:ManifestMessage xmlns:ns-0a7b0155="http://ddex.net/xml/2011/echo/11" MessageVersionId="2010/ern-main/312">

But I need:

<echo:ManifestMessage xmlns:echo="http://ddex.net/xml/2011/echo/11"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://ddex.net/xml/2011/echo/11 http://ddex.net/xml/2011/echo/11/echo.xsd"
                      MessageVersionId="2010/ern-main/312">

Any idea? Thanks again!

from xsd2php.

goetas avatar goetas commented on May 25, 2024

$data["xml_root_name"] = "ns-" . substr(sha1($data["xml_root_namespace"]), 0, 8) . ":" . $data["xml_root_name"];
is the part of code to edit! PR are welcome!

from xsd2php.

pribeirojtm avatar pribeirojtm commented on May 25, 2024

Hello, is this issue still occuring? I'm having the same problem as reported in this post.
Do we still have to hack xsd2php/src/Jms/YamlConverter.php:150 ?

$data["xml_root_name"] = "ns-" . substr(sha1($data["xml_root_namespace"]), 0, 8) . ":" . $data["xml_root_name"];

Or do we have now something to give what we want?

Thanks
?

from xsd2php.

goetas avatar goetas commented on May 25, 2024

This the part of code to edit! PR are welcome!

from xsd2php.

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.