Skip to content

Namespace Problem? #15

Open
Open
@mikegee

Description

@mikegee

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions