Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace Problem? #15

Open
mikegee opened this issue Jul 17, 2014 · 0 comments
Open

Namespace Problem? #15

mikegee opened this issue Jul 17, 2014 · 0 comments

Comments

@mikegee
Copy link
Contributor

mikegee commented Jul 17, 2014

This sample code raises: undefined method 'new' for "simpletest:testMessage":String (NoMethodError). I would greatly appreciate any help.

require "rxsd"

schema = RXSD::Parser.parse_xsd raw: <<XSD
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
    targetNamespace="http://www.covermymeds.com/cmmtest" version="1.0"
    xmlns:simpletest="http://www.covermymeds.com/cmmtest"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:attribute name="msgType" type="xsd:string"/>
    <xsd:complexType name="testMessage">
        <xsd:sequence>
            <xsd:element name="header" type="simpletest:headerType"/>
            <xsd:element name="body" type="simpletest:bodyType"/>
        </xsd:sequence>
        <xsd:attribute ref="simpletest:msgType"/>
    </xsd:complexType>
    <xsd:element name="Message" type="simpletest:testMessage"/>
    <xsd:simpleType name="headerType">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:simpleType name="bodyType">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
</xsd:schema>
XSD

doc = RXSD::Parser.parse_xml raw: <<XML
<?xml version="1.0" encoding="UTF-8"?>
<simpletest:Message xmlns:simpletest="http://www.covermymeds.com/cmmtest">
    <simpletest:header>header goes here</simpletest:header>
    <simpletest:body>body goes here</simpletest:body>
</simpletest:Message>
XML

doc.to :ruby_objects, schema: schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant