Remove Schema from Xml export via XMLPORT

josalmjosalm Member Posts: 5
Hi,

I'm trying to remove the schema part from the xml exported by a xmlport. The objective is to only get the generated xml without the schema part. I'm about to quit this xmlport nonsense and go for a codeunit.
I tried something like this after the export, but it never finds the node i'm after <xs:schema>

TempBlob.CreateOutStream(outstream, TextEncoding::UTF8);

xmlport.Export(Xmlport::"My XmlPort", outstream);
TempBlob.CreateInStream(instream, TextEncoding::UTF8);
XmlDocument.ReadFrom(instream, xmldoc);
xmldoc.SelectSingleNode('xs:schema', node);
node.Remove();


my xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<My_XmlPort>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="Quadro01" mixed="true">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C1De" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C1A" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="Q01C2" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Quadro02" mixed="true">
    <xs:sequence>

I tried different Xpaths like '/My_XmlPort/xs:schema' or '/My_XmlPort/schema'.

Best regards

Answers

  • ftorneroftornero Member Posts: 524
    Hello @josalm,

    I think that a better way is to use SoapUI to create the XML from that output that is in fact a WSDL.

    Regards.
  • vaprogvaprog Member Posts: 1,140
    The reason you don't find `<xs:schema>` is that `xs:` is not literally part of the element's name. Instead xs is a shorthand to a namespace defned elsewhere. You need to search for an element named `schema` in the namespace denoted by `xs`.

    What are you actually doing, i.e. how do you use the xmlport to generate output?

    The schema should not be part of the generated xml document, unless designed like this.
  • josalmjosalm Member Posts: 5
    vaprog wrote: »
    The schema should not be part of the generated xml document, unless designed like this.

    Just realised that I was being dumb and overthinking this. Completely forgot that there's a xmlport property InlineSchema that solves this.

    Thanks to you both for your time

Sign In or Register to comment.