IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only
Expand all | Collapse all

Need help with validate XML

  • 1.  Need help with validate XML

    Posted 11/03/11 07:39 PM

    I created this XSD and then a doc type based on this XSD.

    <?[/color][/size][/font][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#ff00ff][FONT=Courier New][SIZE=2][COLOR=#ff00ff][FONT=Courier New][SIZE=2][COLOR=#ff00ff]xml version="1.0" encoding="utf-8" [/color][/size][/font][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]?>
    <xs:schema elementFormDefault="qualified"xmlns:xs=“XML Schema”>
    <xs:element name="inputToGetCustomerInfo"type=“inputToGetCustomerInfoType”/>
    <xs:complexType name=“inputToGetCustomerInfoType”>
    <xs:all>
    <xs:element name=“CA”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:minLength value=“1”/>
    <xs:maxLength value=“12”/>
    <xs:pattern value=“[1]+”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=“meter”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:minLength value=“1”/>
    <xs:maxLength value=“18”/>
    <xs:pattern value=“[2]+”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=“phone”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:pattern value=“[3]+”/>
    <xs:minLength value=“10”/>
    <xs:maxLength value=“10”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=“ANI”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:minLength value=“10”/>
    <xs:maxLength value=“11”/>
    <xs:pattern value=“[4]+”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=“streetNum”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:minLength value=“1”/>
    <xs:maxLength value=“10”/>
    <xs:pattern value=“[5]+”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name=“useShadow”>
    <xs:simpleType>
    <xs:restriction base=“xs:string”>
    <xs:minLength value=“1”/>
    <xs:maxLength value=“1”/>
    <xs:pattern value=“[6]$”/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:all>
    </xs:complexType>
    </
    xs:schema>

    In my flow service I convert the input doctype (created above) to XML string and then string to node and try to validate against the schema.

    I always get a false return on the validate call with the error messages reading “Duplicate root element xxx found” (I’m running the flow service in debug mode)

    I’m not sure where I messed up. Need help!!! Thanks


    1. 0-9 ↩︎

    2. 0-9 ↩︎

    3. 0-9 ↩︎

    4. 0-9 ↩︎

    5. 0-9 ↩︎

    6. Y|N|y|n ↩︎


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: Need help with validate XML

    Posted 11/04/11 12:12 AM

    i am not sure how your code is doing the mappings before the validate step but it is working for me with no issues (some whitespace issues while copying the schema). Attached is a sample.

    Cheers,
    Akshith


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB